@qwen-code/qwen-code 0.21.14 → 0.21.15

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 (318) hide show
  1. package/bundled/qc-helper/docs/features/channels/dingtalk.md +1 -1
  2. package/bundled/qc-helper/docs/features/code-review.md +20 -2
  3. package/bundled/qc-helper/docs/qwen-serve.md +1 -1
  4. package/bundled/review/SKILL.md +66 -36
  5. package/chunks/{MaxSizedBox-67IDQILY.js → MaxSizedBox-E7CUU3UN.js} +43 -43
  6. package/chunks/{StandaloneSessionPicker-G4QJIRMH.js → StandaloneSessionPicker-XYUB75AQ.js} +63 -63
  7. package/chunks/{acp-startup-profiler-HUYGO57H.js → acp-startup-profiler-DDVSJKJK.js} +2 -2
  8. package/chunks/{acpAgent-BS3YYO33.js → acpAgent-5QZS4VMN.js} +507 -176
  9. package/chunks/{agent-EHHEXKWN.js → agent-242BTA6Q.js} +40 -40
  10. package/chunks/{agent-headless-UT2ZF76T.js → agent-headless-4BF7W4TJ.js} +40 -40
  11. package/chunks/{anthropicContentGenerator-M7XRJMSK.js → anthropicContentGenerator-CU3G53RX.js} +7 -7
  12. package/chunks/{artifact-tool-GEXTOPVO.js → artifact-tool-LIUSI4XK.js} +3 -3
  13. package/chunks/{askUserQuestion-B33XRSB7.js → askUserQuestion-454X3UIV.js} +3 -3
  14. package/chunks/{bridge-WQ4IL2RF.js → bridge-MG4F5NOH.js} +46 -45
  15. package/chunks/{channel-management-service-X6LCQUAD.js → channel-management-service-KHPAWCX7.js} +1 -1
  16. package/chunks/{channel-settings-store-ZDFXY7VY.js → channel-settings-store-GQUCL2YM.js} +47 -47
  17. package/chunks/{channel-worker-group-TJ35JDPE.js → channel-worker-group-IN2UPYHP.js} +6 -5
  18. package/chunks/{channel-worker-manager-G5LKWGOG.js → channel-worker-manager-4CQPHVD4.js} +6 -5
  19. package/chunks/{channel-worker-supervisor-OEVWBHGT.js → channel-worker-supervisor-CPPSL7ZH.js} +4 -3
  20. package/chunks/{chunk-3EZLLVDF.js → chunk-263JC66E.js} +3 -3
  21. package/chunks/{chunk-OO4FKHLO.js → chunk-2GM44E7D.js} +10 -298
  22. package/chunks/{chunk-LSO6EL4Y.js → chunk-2MDUS4XE.js} +2 -2
  23. package/chunks/{chunk-WGHHA7ZH.js → chunk-3C55EUJX.js} +1 -1
  24. package/chunks/{chunk-47L5MLB5.js → chunk-3EAGKRLN.js} +5 -5
  25. package/chunks/{chunk-WPVUOVYX.js → chunk-3EQHT3IC.js} +2 -2
  26. package/chunks/{chunk-OEZCXK7Y.js → chunk-3JZ2AZC6.js} +4 -4
  27. package/chunks/{chunk-PCETXVVV.js → chunk-3X6KVX37.js} +1 -1
  28. package/chunks/{chunk-J63PKMYA.js → chunk-435GZDTF.js} +2 -2
  29. package/chunks/{chunk-I3N2Z25H.js → chunk-47VTGCYK.js} +3 -3
  30. package/chunks/{chunk-3PWNVF6N.js → chunk-4APB4SP2.js} +1 -1
  31. package/chunks/{chunk-MA2HEDVP.js → chunk-4CKU5K2R.js} +1 -1
  32. package/chunks/{chunk-OJB5FYVK.js → chunk-4IOBHNV2.js} +1 -1
  33. package/chunks/{chunk-MIPFDQAF.js → chunk-4W4BROUS.js} +1 -1
  34. package/chunks/{chunk-ZIGC3MUS.js → chunk-55P2ESI6.js} +1 -1
  35. package/chunks/{chunk-CHHABXPE.js → chunk-5AAW6E3C.js} +1 -1
  36. package/chunks/{chunk-J6YS7Z25.js → chunk-5I2U4PDY.js} +12 -12
  37. package/chunks/{chunk-NWNEANAT.js → chunk-5M7YKTYX.js} +6 -6
  38. package/chunks/{chunk-RXHBTKMG.js → chunk-5MA4E4EG.js} +3 -3
  39. package/chunks/{chunk-CEXU72GE.js → chunk-5NAJDTVP.js} +3 -3
  40. package/chunks/{chunk-U657UZJN.js → chunk-5WEMSDPR.js} +5 -5
  41. package/chunks/{chunk-73JUK3ZW.js → chunk-63AIQ2IZ.js} +96 -15
  42. package/chunks/{chunk-E5WQMF3K.js → chunk-67L6PVD6.js} +2 -2
  43. package/chunks/{chunk-CZK622ZK.js → chunk-6IFWBM24.js} +3 -3
  44. package/chunks/{chunk-CPHEPGAO.js → chunk-722JBVVW.js} +1 -1
  45. package/chunks/chunk-7NLDU6J2.js +367 -0
  46. package/chunks/{chunk-AKBOLMUF.js → chunk-7S22SX2L.js} +2 -2
  47. package/chunks/{chunk-SCZU65AI.js → chunk-7VRNXKKK.js} +8 -8
  48. package/chunks/{chunk-XUJNK7Y6.js → chunk-7WVB4FMG.js} +1 -1
  49. package/chunks/{chunk-55VKMB7X.js → chunk-A7MIUCUQ.js} +6 -6
  50. package/chunks/{chunk-NVRMCWTP.js → chunk-A7NBZBGQ.js} +3 -3
  51. package/chunks/{chunk-N6RSOOWJ.js → chunk-AAG7I5CR.js} +7 -7
  52. package/chunks/{chunk-EOPBFLA5.js → chunk-AKN26LMT.js} +3 -3
  53. package/chunks/{chunk-UC67T4SF.js → chunk-AQFWV4YF.js} +2 -1
  54. package/chunks/{chunk-DVR7XKO5.js → chunk-B5LEKTE7.js} +2 -2
  55. package/chunks/{chunk-V6WEMZPD.js → chunk-B72KNVKO.js} +3 -3
  56. package/chunks/{chunk-544KT7X4.js → chunk-BBMVUTXO.js} +1 -1
  57. package/chunks/{chunk-DHUPMYMC.js → chunk-BORX4PBQ.js} +12 -12
  58. package/chunks/{chunk-5IJSFWQO.js → chunk-BUZESYJT.js} +4 -4
  59. package/chunks/{chunk-Y4RVDOXV.js → chunk-DF7KFKCL.js} +4 -4
  60. package/chunks/{chunk-K2Y45XXS.js → chunk-DFOKBPH5.js} +108 -26
  61. package/chunks/{chunk-3SL2P3WX.js → chunk-DIHJXVT4.js} +1 -1
  62. package/chunks/{chunk-WAO53ZQF.js → chunk-DITDNF3D.js} +22 -2
  63. package/chunks/{chunk-2A6VQJYK.js → chunk-DK4HL3IB.js} +7 -7
  64. package/chunks/{chunk-6BJSYAML.js → chunk-DPXZUGDQ.js} +46 -21
  65. package/chunks/{chunk-MVHJZ3FZ.js → chunk-DZNQHKZZ.js} +2 -2
  66. package/chunks/{chunk-SNQZZ765.js → chunk-EB27VF5Z.js} +2 -2
  67. package/chunks/{chunk-KC4WMLZO.js → chunk-EXY6APEA.js} +81 -50
  68. package/chunks/{chunk-7VNHO4MN.js → chunk-F3FRTY4Q.js} +16 -7
  69. package/chunks/{chunk-FS5NGKWC.js → chunk-F5JZDC4O.js} +3 -3
  70. package/chunks/{chunk-6QFDQMQX.js → chunk-F7ZK5VMA.js} +1 -1
  71. package/chunks/{chunk-2B2BF7P7.js → chunk-FAIJ5UIU.js} +3 -3
  72. package/chunks/{chunk-G6KI5UOJ.js → chunk-FQ6G527Y.js} +3 -3
  73. package/chunks/{chunk-WSSH2BNO.js → chunk-FQZBD3PY.js} +1 -1
  74. package/chunks/{chunk-OVY67CYC.js → chunk-G32ESUUC.js} +1 -1
  75. package/chunks/{chunk-OBJYN4MX.js → chunk-G64PEZZ5.js} +2 -2
  76. package/chunks/{chunk-QRVHGEVY.js → chunk-GCWILQKA.js} +3 -3
  77. package/chunks/{chunk-QUGAUQGJ.js → chunk-GX2THELY.js} +1 -0
  78. package/chunks/{chunk-L3T4V5GZ.js → chunk-GYVB4P5B.js} +721 -331
  79. package/chunks/{chunk-FAAUPSY2.js → chunk-HEMFCAHG.js} +1 -1
  80. package/chunks/{chunk-AZQ3DT76.js → chunk-HGGMEDDY.js} +2 -2
  81. package/chunks/{chunk-SG7ZP5PG.js → chunk-HHNSO2Y4.js} +4 -4
  82. package/chunks/{chunk-YHXQK4SR.js → chunk-HSCPOEBL.js} +3 -3
  83. package/chunks/{chunk-H3SHU2XU.js → chunk-I3AB5DOZ.js} +3 -3
  84. package/chunks/{chunk-SFJMFZT5.js → chunk-IBUXQJHH.js} +1 -1
  85. package/chunks/{chunk-FN6M5WUL.js → chunk-IFOR6I5C.js} +4 -4
  86. package/chunks/{chunk-PHN4R2ZV.js → chunk-IU2XWUSI.js} +1 -1
  87. package/chunks/{chunk-OJOP26ET.js → chunk-J2LZ5OCH.js} +3 -3
  88. package/chunks/{chunk-4ZMS3JCR.js → chunk-JBSW7JA6.js} +83 -4
  89. package/chunks/{chunk-QAVTWAHL.js → chunk-JIR6JDGE.js} +3 -3
  90. package/chunks/{chunk-UGK4K2N2.js → chunk-JS73NNWF.js} +8 -0
  91. package/chunks/{chunk-2M55OBEB.js → chunk-JV443R5X.js} +1 -1
  92. package/chunks/{chunk-QEHH23OM.js → chunk-K6GQS2WN.js} +1 -1
  93. package/chunks/{chunk-6LAPGPVA.js → chunk-KCUGOZPL.js} +2 -2
  94. package/chunks/{chunk-KV27IEHM.js → chunk-L5JHSPET.js} +1 -1
  95. package/chunks/{chunk-OFTPCOGR.js → chunk-L7RG5PVT.js} +2902 -1393
  96. package/chunks/{chunk-TSMPNGBC.js → chunk-LBQBFRFN.js} +2 -2
  97. package/chunks/chunk-LJZSMWOH.js +18 -0
  98. package/chunks/{chunk-IA2K2HJE.js → chunk-M53UJS6H.js} +2 -2
  99. package/chunks/{chunk-KBXKR5R2.js → chunk-M5AIO24H.js} +1 -1
  100. package/chunks/{chunk-ROIYNTHJ.js → chunk-MD7XDTW7.js} +3 -3
  101. package/chunks/{chunk-3PWCMXIR.js → chunk-MGEWDLRO.js} +1 -1
  102. package/chunks/{chunk-4ZS3BLER.js → chunk-NAGJPIPW.js} +22 -7
  103. package/chunks/{chunk-3YRVPHT3.js → chunk-NCTHX2Z3.js} +14 -14
  104. package/chunks/{chunk-YP5KH5Y7.js → chunk-ND7NOI4P.js} +1 -1
  105. package/chunks/{chunk-4W5U2TUT.js → chunk-NGY7B7VF.js} +1 -1
  106. package/chunks/{chunk-S7N3HUIB.js → chunk-NMSSH43P.js} +6 -6
  107. package/chunks/{chunk-UYDGFWIJ.js → chunk-NYN4RD3K.js} +66 -7
  108. package/chunks/{chunk-DGJ7O55J.js → chunk-O327G3QW.js} +3 -3
  109. package/chunks/{chunk-2C6HJMG3.js → chunk-O75QDGQF.js} +3 -3
  110. package/chunks/{chunk-SFTKAX4O.js → chunk-OFJ6OFIT.js} +1 -1
  111. package/chunks/{chunk-6HY6IF3Z.js → chunk-OUYRA764.js} +1 -1
  112. package/chunks/{chunk-OEYAK5O6.js → chunk-OVS33JJM.js} +5 -5
  113. package/chunks/{chunk-VFP5YOHJ.js → chunk-PRIX4D6T.js} +6 -6
  114. package/chunks/{chunk-H4A72DE5.js → chunk-PTMVPFCZ.js} +1 -1
  115. package/chunks/{chunk-W7EYJGN7.js → chunk-PWQPWISR.js} +8 -8
  116. package/chunks/{chunk-QFJ5JHQR.js → chunk-PXOIRYE5.js} +1 -1
  117. package/chunks/{chunk-4SR45OM4.js → chunk-Q5QDZXKL.js} +1 -1
  118. package/chunks/{chunk-YECDICIO.js → chunk-Q6ETBOWF.js} +1 -1
  119. package/chunks/{chunk-WP4WIUOJ.js → chunk-QQUVPMMZ.js} +2 -2
  120. package/chunks/{chunk-C3T6M24E.js → chunk-RLYXWNS3.js} +3 -3
  121. package/chunks/{chunk-XT4RKHVE.js → chunk-RZ4PE3ER.js} +512 -24
  122. package/chunks/{chunk-6RDZLBSJ.js → chunk-SGKUVDBX.js} +80 -44
  123. package/chunks/{chunk-YZHRN3CF.js → chunk-SWOKDPS5.js} +2 -2
  124. package/chunks/{chunk-SLILKYV2.js → chunk-T2LUUKRI.js} +3 -3
  125. package/chunks/{chunk-5CVO7YES.js → chunk-U4GL4WDY.js} +1 -1
  126. package/chunks/{chunk-QEJZUXSK.js → chunk-U53XZHAE.js} +1 -1
  127. package/chunks/{chunk-XYRBK56E.js → chunk-U7U3CX4K.js} +3353 -1306
  128. package/chunks/{chunk-HIBNSEJE.js → chunk-UDG5EZJI.js} +0 -2
  129. package/chunks/{chunk-BQWNIPTE.js → chunk-V4UBYT3Y.js} +1 -1
  130. package/chunks/{chunk-XITLNXLX.js → chunk-VWS7DWY6.js} +3 -3
  131. package/chunks/{chunk-PT4I7NBA.js → chunk-VX7TFATF.js} +1 -1
  132. package/chunks/{chunk-VTOLYFWM.js → chunk-W3M6P3UR.js} +2 -2
  133. package/chunks/{chunk-CH5OFRV7.js → chunk-W4MLKRZD.js} +3 -3
  134. package/chunks/chunk-W5YD3QRT.js +367 -0
  135. package/chunks/{chunk-5IYS4WWR.js → chunk-WAPL2PHU.js} +1 -1
  136. package/chunks/{chunk-NRPXRNN4.js → chunk-WXFFCRKG.js} +1 -1
  137. package/chunks/{chunk-E3DYKPYZ.js → chunk-X7EQHW5L.js} +3 -3
  138. package/chunks/{chunk-BUQDLC2G.js → chunk-XFRYCCVC.js} +3 -3
  139. package/chunks/{chunk-DRAONPUW.js → chunk-XZ3J6E5Z.js} +2 -2
  140. package/chunks/{chunk-P3AA6S7O.js → chunk-Y7JGWFTK.js} +1 -1
  141. package/chunks/{chunk-SXCOEJO4.js → chunk-YLFFVY3G.js} +1 -1
  142. package/chunks/{chunk-YZOSNW4R.js → chunk-YO7PNVBJ.js} +1 -1
  143. package/chunks/{chunk-MDIGJH5X.js → chunk-ZL3HKVEQ.js} +4 -4
  144. package/chunks/{chunk-Y7QY6DKW.js → chunk-ZTLSYXFY.js} +4 -4
  145. package/chunks/{chunk-RWDNJBWN.js → chunk-ZUISK67X.js} +2 -2
  146. package/chunks/{chunk-PJSD2FOR.js → chunk-ZVJ5R5LM.js} +33 -33
  147. package/chunks/{chunk-XLLKYULU.js → chunk-ZWWU6KNS.js} +2 -2
  148. package/chunks/{computer-use-YORZJQE5.js → computer-use-34X5XJMV.js} +40 -40
  149. package/chunks/{config-utils-NJQA5YLJ.js → config-utils-XJTGZVY3.js} +2 -2
  150. package/chunks/{contextCommand-PACHGIF4.js → contextCommand-Q54VMGPA.js} +42 -42
  151. package/chunks/{core-runtime-6HD5DSPX.js → core-runtime-TIWTFHOR.js} +45 -44
  152. package/chunks/{create-sub-session-IQFIPUQA.js → create-sub-session-DPEBT657.js} +40 -40
  153. package/chunks/{create-sub-session-KRQULJE6.js → create-sub-session-TCKWBXEM.js} +6 -4
  154. package/chunks/{cron-create-NFRZEOQX.js → cron-create-PUCRMWQ6.js} +5 -5
  155. package/chunks/{cron-delete-GFVSVO7C.js → cron-delete-EOQR5CXU.js} +5 -5
  156. package/chunks/{cron-list-NRW34CLU.js → cron-list-7O22SQBF.js} +5 -5
  157. package/chunks/{daemon-XH76IXOC.js → daemon-JE2UIWSY.js} +304 -160
  158. package/chunks/{daemon-git-worktree-guard-6P27GKSU.js → daemon-git-worktree-guard-XSZ3362V.js} +40 -40
  159. package/chunks/daemon-status-provider-JBEST4SF.js +104 -0
  160. package/chunks/{daemon-trust-policy-5QJHAS3N.js → daemon-trust-policy-S6LBG4WN.js} +46 -46
  161. package/chunks/{daemon-trust-policy-monitor-JA2WZRZ3.js → daemon-trust-policy-monitor-NFO3OIBN.js} +46 -46
  162. package/chunks/{deferred-core-runtime-R2VWOVG3.js → deferred-core-runtime-Z2TLD2L7.js} +40 -40
  163. package/chunks/{display-image-ON3EYFRD.js → display-image-6FCICTXS.js} +5 -5
  164. package/chunks/{dist-IYYN3RUT.js → dist-IELOWDOT.js} +81 -17
  165. package/chunks/{earlyInputCapture-PQEEOFKJ.js → earlyInputCapture-KCZDAQWY.js} +41 -41
  166. package/chunks/{edit-RASZHTU2.js → edit-3UADXGNC.js} +41 -41
  167. package/chunks/{enter-worktree-CH5OMHJE.js → enter-worktree-J66YDAJE.js} +40 -40
  168. package/chunks/{enterPlanMode-AQKR3CAH.js → enterPlanMode-YUZUKY5F.js} +40 -40
  169. package/chunks/{environment-7QRYIEBA.js → environment-6IEK2353.js} +42 -42
  170. package/chunks/{errors-P2LL5452.js → errors-RVLRX7XI.js} +42 -42
  171. package/chunks/{exit-worktree-WUDL26CY.js → exit-worktree-SNMPATZE.js} +40 -40
  172. package/chunks/{exitPlanMode-JM75SAUI.js → exitPlanMode-DP4TURUC.js} +40 -40
  173. package/chunks/{fast-path-KVNSOHVA.js → fast-path-5CC6RKES.js} +2 -2
  174. package/chunks/{gemini-ADMD2EOS.js → gemini-F64ZP4SG.js} +83 -82
  175. package/chunks/{geminiContentGenerator-CS3M7SOS.js → geminiContentGenerator-KAFSMFA6.js} +7 -7
  176. package/chunks/{getMachineId-bsd-FG7IUY6U.js → getMachineId-bsd-LSY4WMOF.js} +1 -1
  177. package/chunks/{getMachineId-darwin-GLCJI2RA.js → getMachineId-darwin-JOFR4UIT.js} +1 -1
  178. package/chunks/{getMachineId-linux-O6OPPAKO.js → getMachineId-linux-QEDBS6GI.js} +1 -1
  179. package/chunks/{getMachineId-unsupported-S6CKYVGC.js → getMachineId-unsupported-IPZ3YRKP.js} +1 -1
  180. package/chunks/{getMachineId-win-X5SRNEH7.js → getMachineId-win-TJ2OZ7AA.js} +1 -1
  181. package/chunks/{glob-WIJOGYVV.js → glob-OE27ZGK4.js} +40 -40
  182. package/chunks/{goal-tools-K5OHOJ6B.js → goal-tools-YIADM4RZ.js} +5 -5
  183. package/chunks/{grep-CIFRQBR7.js → grep-VBV6BWSP.js} +40 -40
  184. package/chunks/{handleAutoUpdate-KJ4SN7DM.js → handleAutoUpdate-YDMS57ZN.js} +46 -44
  185. package/chunks/{i18n-36SZUO4C.js → i18n-JIW77MSO.js} +41 -41
  186. package/chunks/{image-gen-R4B5VUYB.js → image-gen-L4A2ISEH.js} +11 -11
  187. package/chunks/{initializer-CW5YCAOL.js → initializer-F7I7QDHK.js} +47 -47
  188. package/chunks/{installationInfo-NMQIOUGY.js → installationInfo-KOUBU7MH.js} +43 -41
  189. package/chunks/{keychain-token-storage-3XFJ5ZB2.js → keychain-token-storage-7SL4ZWQQ.js} +3 -3
  190. package/chunks/{list-HHGT3S4P.js → list-AJ5BRB7C.js} +49 -49
  191. package/chunks/{list-agents-OSVDFI6S.js → list-agents-XO4EONWC.js} +6 -6
  192. package/chunks/{loadedSettingsAdapter-SJ2MJF35.js → loadedSettingsAdapter-X7FC5332.js} +46 -46
  193. package/chunks/{loggingContentGenerator-GR2QQ2C5.js → loggingContentGenerator-5G4ZR5D5.js} +22 -22
  194. package/chunks/{loop-wakeup-HWVUU5CF.js → loop-wakeup-HWSTFUTQ.js} +6 -6
  195. package/chunks/{ls-D3HUFHDP.js → ls-52HUW4B6.js} +5 -5
  196. package/chunks/{lsp-3QDDJTCS.js → lsp-VJESYEC6.js} +3 -3
  197. package/chunks/{managed-npm-update-ADQJHKTO.js → managed-npm-update-ZR2T2ST3.js} +41 -41
  198. package/chunks/{mcp-QW3OTL5W.js → mcp-TZNHG7CF.js} +46 -46
  199. package/chunks/{monitor-RJKPVERH.js → monitor-TN6Z4SXF.js} +40 -40
  200. package/chunks/{nonInteractiveCli-MROMHSTL.js → nonInteractiveCli-I7K6KH5U.js} +81 -80
  201. package/chunks/{notebook-edit-2ENWDBZO.js → notebook-edit-77V2IP3Y.js} +40 -40
  202. package/chunks/{openaiContentGenerator-Z3GPWJU4.js → openaiContentGenerator-2S2UT4RR.js} +25 -26
  203. package/chunks/{pidfile-5G42YSTP.js → pidfile-WDSDXBY3.js} +41 -41
  204. package/chunks/{processUtils-ZDMXYKQY.js → processUtils-JOJNZOW4.js} +2 -2
  205. package/chunks/prompt-terminal-ledger-RW62JIPP.js +93 -0
  206. package/chunks/{qwenContentGenerator-NLEMBZVU.js → qwenContentGenerator-G3H2TCXF.js} +45 -45
  207. package/chunks/{qwenOAuth2-EBV52DWJ.js → qwenOAuth2-UI2OC2RN.js} +10 -10
  208. package/chunks/{read-file-5BYIF53O.js → read-file-DI64TNOE.js} +13 -14
  209. package/chunks/{read-mcp-resource-XD54ZQMC.js → read-mcp-resource-6VFF47Z3.js} +3 -3
  210. package/chunks/{record-artifact-GLU3UWBV.js → record-artifact-TJTN2GBV.js} +5 -5
  211. package/chunks/{resumeHistoryUtils-AFTBRS3G.js → resumeHistoryUtils-3FIDQ6YQ.js} +46 -46
  212. package/chunks/{ripGrep-NN7AOLQY.js → ripGrep-EUTGRCN3.js} +40 -40
  213. package/chunks/{run-qwen-serve-UR3DYDAF.js → run-qwen-serve-SQBF7QZM.js} +505 -161
  214. package/chunks/{runtime-PR5RKGNH.js → runtime-7QGB6SY4.js} +49 -49
  215. package/chunks/{scheduler-GPMLVKJM.js → scheduler-V6AZCQVU.js} +42 -42
  216. package/chunks/{sdk-exporters-grpc-54L4LS5L.js → sdk-exporters-grpc-P3LA24AV.js} +3 -3
  217. package/chunks/{sdk-exporters-http-NC746HLT.js → sdk-exporters-http-K3LH2SD7.js} +9 -11
  218. package/chunks/{sdk-impl-YVL7BP6Y.js → sdk-impl-WCUNMLVX.js} +11 -6
  219. package/chunks/{send-message-TNBG5EVA.js → send-message-NUK5DTTI.js} +7 -7
  220. package/chunks/{serve-E7V2JVA2.js → serve-WVNAO2NA.js} +46 -46
  221. package/chunks/{server-YXB3DBN7.js → server-ZMZPHJEC.js} +992 -271
  222. package/chunks/{session-DZEAUT7S.js → session-JV74G6EZ.js} +82 -81
  223. package/chunks/{settings-ESZ3NWAP.js → settings-GBBVKBQ2.js} +45 -45
  224. package/chunks/{shell-JMSK5WIL.js → shell-JNNRUZPA.js} +40 -40
  225. package/chunks/{skill-5K5CSUJV.js → skill-JRGRCWD5.js} +18 -18
  226. package/chunks/{skill-settings-V64NIOTI.js → skill-settings-VEC7C44Z.js} +45 -45
  227. package/chunks/{spawnChannel-S63APBZZ.js → spawnChannel-TVKIFXXA.js} +42 -42
  228. package/chunks/{standalone-update-P42HDFXX.js → standalone-update-OSHF2CX3.js} +42 -42
  229. package/chunks/{startInteractiveUI-LFBLFHJ4.js → startInteractiveUI-2HTUHVQO.js} +310 -156
  230. package/chunks/{syntheticOutput-7GWFIDXT.js → syntheticOutput-GZV6O6UL.js} +4 -4
  231. package/chunks/{task-create-EILHJJB7.js → task-create-BXGKNND4.js} +11 -11
  232. package/chunks/{task-list-WGJR6YL5.js → task-list-4ZMIDYGD.js} +6 -6
  233. package/chunks/{task-stop-X37KYTKB.js → task-stop-WBO7LWTS.js} +3 -3
  234. package/chunks/{task-update-XZAHVXJ5.js → task-update-UFO3BI7O.js} +11 -11
  235. package/chunks/{team-create-EDNOUM2U.js → team-create-DTPGJ6RH.js} +40 -40
  236. package/chunks/{team-delete-UEP4QOOT.js → team-delete-OCFJS444.js} +6 -6
  237. package/chunks/{team-plan-approval-QRSNK2DX.js → team-plan-approval-4433RWHB.js} +40 -40
  238. package/chunks/{terminal-image-renderer-6J2NPL32.js → terminal-image-renderer-QZLIKIVA.js} +42 -42
  239. package/chunks/{theme-manager-WJMLRBXS.js → theme-manager-RM7C7Q3L.js} +41 -41
  240. package/chunks/{todoWrite-ATS62CAP.js → todoWrite-BGM5MCPY.js} +5 -5
  241. package/chunks/{tool-search-MZ6WU7DM.js → tool-search-4NQJASFC.js} +17 -18
  242. package/chunks/{total-session-admission-DQVW2LIP.js → total-session-admission-NZNCU5NU.js} +46 -45
  243. package/chunks/{trustedFolders-QMH25GOX.js → trustedFolders-FDJ2Q4ZK.js} +41 -41
  244. package/chunks/{update-relaunch-EG75LLW5.js → update-relaunch-HZMDPRTF.js} +5 -5
  245. package/chunks/{updateCheck-MTZIVGT5.js → updateCheck-ZB2CRVVG.js} +43 -43
  246. package/chunks/{useAutoAcceptIndicator-IGCW5EPO.js → useAutoAcceptIndicator-O3JI4KTR.js} +48 -48
  247. package/chunks/{validateNonInterActiveAuth-D5FPAB2C.js → validateNonInterActiveAuth-7Z4KG4N5.js} +78 -77
  248. package/chunks/{version-UOLDLLRB.js → version-RFVS6QDY.js} +1 -1
  249. package/chunks/{web-fetch-QKKW6CWH.js → web-fetch-RAN377BH.js} +17 -18
  250. package/chunks/{web-search-JYRBZMCW.js → web-search-XKS6ZPY7.js} +10 -10
  251. package/chunks/{workflow-SR7SEAU7.js → workflow-HF6G5XNX.js} +232 -73
  252. package/chunks/{workspace-providers-status-OXGV4EFF.js → workspace-providers-status-LNMP7NED.js} +49 -49
  253. package/chunks/{workspace-registration-store-V5EGKLBH.js → workspace-registration-store-QZ3P3ILN.js} +1 -1
  254. package/chunks/{workspace-registry-KJVIYTF5.js → workspace-registry-KWPGC2LG.js} +46 -45
  255. package/chunks/{workspace-service-6RLSGUB5.js → workspace-service-RWB4KMY3.js} +51 -51
  256. package/chunks/{workspace-skills-status-BHFEPDGH.js → workspace-skills-status-P3XXZY7C.js} +47 -47
  257. package/chunks/{workspace-trust-reconciler-DB5ERSUN.js → workspace-trust-reconciler-XU6WB2MF.js} +52 -51
  258. package/chunks/{write-file-IUP4GTZ4.js → write-file-V7Y6KUPR.js} +40 -40
  259. package/chunks/{zoom-image-SRBDTIVA.js → zoom-image-N4RSASH7.js} +13 -14
  260. package/cli.js +13 -13
  261. package/package.json +3 -3
  262. package/web-shell/assets/{arc-DItbX0DI.js → arc-CN-xeqBM.js} +1 -1
  263. package/web-shell/assets/{architectureDiagram-3BPJPVTR-CmnIlH8y.js → architectureDiagram-3BPJPVTR-XQJ6hBnv.js} +1 -1
  264. package/web-shell/assets/{blockDiagram-GPEHLZMM-pObnB9kw.js → blockDiagram-GPEHLZMM-n35AKogw.js} +1 -1
  265. package/web-shell/assets/{c4Diagram-AAUBKEIU-BNBmMS0Y.js → c4Diagram-AAUBKEIU-DXeDVokb.js} +1 -1
  266. package/web-shell/assets/channel-BdTBh3qf.js +1 -0
  267. package/web-shell/assets/{chunk-2J33WTMH-Dz4JBOO6.js → chunk-2J33WTMH-BYcmYjz_.js} +1 -1
  268. package/web-shell/assets/{chunk-4BX2VUAB-Cz2GnvAR.js → chunk-4BX2VUAB-w3UyeGtt.js} +1 -1
  269. package/web-shell/assets/{chunk-55IACEB6-CC6kOQYx.js → chunk-55IACEB6-Td3JbOH_.js} +1 -1
  270. package/web-shell/assets/{chunk-727SXJPM-Z4lY4gbh.js → chunk-727SXJPM-gC_NR7u6.js} +1 -1
  271. package/web-shell/assets/{chunk-AQP2D5EJ-Yz0hZr3D.js → chunk-AQP2D5EJ-aD7bI3c3.js} +1 -1
  272. package/web-shell/assets/{chunk-FMBD7UC4-nKmTWTv9.js → chunk-FMBD7UC4-sHMhD16X.js} +1 -1
  273. package/web-shell/assets/{chunk-ND2GUHAM-CjZz0f6Y.js → chunk-ND2GUHAM-DiV49BLl.js} +1 -1
  274. package/web-shell/assets/{chunk-QZHKN3VN-Bab3FpuS.js → chunk-QZHKN3VN-Dnoagqin.js} +1 -1
  275. package/web-shell/assets/classDiagram-4FO5ZUOK-qVxLMMuK.js +1 -0
  276. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-qVxLMMuK.js +1 -0
  277. package/web-shell/assets/{cose-bilkent-S5V4N54A-BuSAGFox.js → cose-bilkent-S5V4N54A-K6l_zsrZ.js} +1 -1
  278. package/web-shell/assets/{dagre-BM42HDAG-CRZXTg3g.js → dagre-BM42HDAG-Chh9hQ0a.js} +1 -1
  279. package/web-shell/assets/{diagram-2AECGRRQ-BFx1Ayrz.js → diagram-2AECGRRQ-Clrbd8SB.js} +1 -1
  280. package/web-shell/assets/{diagram-5GNKFQAL-B2hMZ3gS.js → diagram-5GNKFQAL-BkNExywD.js} +1 -1
  281. package/web-shell/assets/{diagram-KO2AKTUF-DKxAQLmc.js → diagram-KO2AKTUF-kTX14ngI.js} +1 -1
  282. package/web-shell/assets/{diagram-LMA3HP47-Bo1xGqVY.js → diagram-LMA3HP47-Ba1QOCJy.js} +1 -1
  283. package/web-shell/assets/{diagram-OG6HWLK6-B9NG78d-.js → diagram-OG6HWLK6-CtH5BVYm.js} +1 -1
  284. package/web-shell/assets/{erDiagram-TEJ5UH35-DltQKiqQ.js → erDiagram-TEJ5UH35-DCxSIC83.js} +1 -1
  285. package/web-shell/assets/{flowDiagram-I6XJVG4X-5xXGmS4I.js → flowDiagram-I6XJVG4X-C4rNAypQ.js} +1 -1
  286. package/web-shell/assets/{ganttDiagram-6RSMTGT7-bhGL5n0l.js → ganttDiagram-6RSMTGT7-s3P5tBwL.js} +1 -1
  287. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-ZYnz9hgh.js → gitGraphDiagram-PVQCEYII-C7Eg-1ok.js} +1 -1
  288. package/web-shell/assets/index-BXoIYIJg.css +5 -0
  289. package/web-shell/assets/{index-CBBeUArD.js → index-CszoC8cN.js} +1 -1
  290. package/web-shell/assets/index-Dxj7Naa0.js +1788 -0
  291. package/web-shell/assets/{infoDiagram-5YYISTIA-Cg-jamQf.js → infoDiagram-5YYISTIA-BDKsgMt6.js} +1 -1
  292. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-CcmvKlyq.js → ishikawaDiagram-YF4QCWOH-CkcSHbvL.js} +1 -1
  293. package/web-shell/assets/{journeyDiagram-JHISSGLW-BRsOQZp1.js → journeyDiagram-JHISSGLW-CDWt-t81.js} +1 -1
  294. package/web-shell/assets/{kanban-definition-UN3LZRKU-xW-dmEHK.js → kanban-definition-UN3LZRKU-FI2owcEa.js} +1 -1
  295. package/web-shell/assets/{linear-ClBfEZH2.js → linear-BQzLqkJi.js} +1 -1
  296. package/web-shell/assets/{mermaid.core-D65NDkzc.js → mermaid.core-CvV91DP1.js} +5 -5
  297. package/web-shell/assets/{mindmap-definition-RKZ34NQL-CyvFslYa.js → mindmap-definition-RKZ34NQL-Dx2kLUpN.js} +1 -1
  298. package/web-shell/assets/{pieDiagram-4H26LBE5-BwSefMyG.js → pieDiagram-4H26LBE5-CMXOmBrj.js} +1 -1
  299. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-GqBJspFS.js → quadrantDiagram-W4KKPZXB-Bziww7Co.js} +1 -1
  300. package/web-shell/assets/{requirementDiagram-4Y6WPE33-B137PlTJ.js → requirementDiagram-4Y6WPE33-DMOXAxzp.js} +1 -1
  301. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-maHkkt8i.js → sankeyDiagram-5OEKKPKP-B3y1cfVV.js} +1 -1
  302. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-DJ1mRaG3.js → sequenceDiagram-3UESZ5HK-ChrV1jiM.js} +1 -1
  303. package/web-shell/assets/{stateDiagram-AJRCARHV-aRmP7Q4i.js → stateDiagram-AJRCARHV-CWuLzLFE.js} +1 -1
  304. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DEDPMLgq.js +1 -0
  305. package/web-shell/assets/{timeline-definition-PNZ67QCA-CIQ3BRPA.js → timeline-definition-PNZ67QCA-Cl6am_to.js} +1 -1
  306. package/web-shell/assets/{vennDiagram-CIIHVFJN-DR9VPd5h.js → vennDiagram-CIIHVFJN-OuocxGAu.js} +1 -1
  307. package/web-shell/assets/{wardley-L42UT6IY-ZcfIbT4D.js → wardley-L42UT6IY-DLYdvSJW.js} +1 -1
  308. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-D0jgPi4T.js → wardleyDiagram-YWT4CUSO-7a3DreXX.js} +1 -1
  309. package/web-shell/assets/{xychartDiagram-2RQKCTM6-BGWU4s5o.js → xychartDiagram-2RQKCTM6-CgfjUxW_.js} +1 -1
  310. package/web-shell/index.html +2 -2
  311. package/chunks/chunk-D34RDOLP.js +0 -529
  312. package/chunks/daemon-status-provider-SXS66ZIR.js +0 -103
  313. package/web-shell/assets/channel-hZnMfWA9.js +0 -1
  314. package/web-shell/assets/classDiagram-4FO5ZUOK-BRnxm8DX.js +0 -1
  315. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BRnxm8DX.js +0 -1
  316. package/web-shell/assets/index-CbgU-jUo.css +0 -5
  317. package/web-shell/assets/index-_nhzXqab.js +0 -1750
  318. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-Db39gvZ_.js +0 -1
@@ -10,6 +10,7 @@ import {
10
10
  formatWorkspaceMemoryForgetSummary,
11
11
  isCompatibleLiveSessionSource,
12
12
  isReservedLiveSessionSource,
13
+ isReservedStandaloneSessionSource,
13
14
  isValidServerName,
14
15
  normalizeChannelDelivery,
15
16
  parseChannelDelivery,
@@ -20,13 +21,13 @@ import {
20
21
  shouldSuppressRememberErrorDetails,
21
22
  workspaceMemoryFailureCode,
22
23
  workspaceMemoryFailureDiagnostics
23
- } from "./chunk-73JUK3ZW.js";
24
+ } from "./chunk-63AIQ2IZ.js";
24
25
  import {
25
26
  deriveWebSocketBase,
26
27
  openQwenAsrRealtimeStream,
27
28
  openVoiceStream,
28
29
  openVoiceStreamWithRetry
29
- } from "./chunk-WSSH2BNO.js";
30
+ } from "./chunk-FQZBD3PY.js";
30
31
  import {
31
32
  SetupGithubError,
32
33
  collectSessionData,
@@ -38,15 +39,15 @@ import {
38
39
  toJson,
39
40
  toJsonl,
40
41
  toMarkdown
41
- } from "./chunk-K2Y45XXS.js";
42
+ } from "./chunk-DFOKBPH5.js";
42
43
  import {
43
44
  OBSERVED_CONTACT_MAX_FRESH_WITHIN_SECONDS,
44
45
  ObservedChannelContactStore
45
- } from "./chunk-OVY67CYC.js";
46
+ } from "./chunk-G32ESUUC.js";
46
47
  import {
47
48
  escapeAnsiCtrlCodes
48
49
  } from "./chunk-E7REAOTN.js";
49
- import "./chunk-4SR45OM4.js";
50
+ import "./chunk-Q5QDZXKL.js";
50
51
  import "./chunk-2MIN6GRR.js";
51
52
  import "./chunk-QHTIBUWB.js";
52
53
  import "./chunk-3Z43GZUQ.js";
@@ -90,6 +91,8 @@ import {
90
91
  createManagedScratchDirectory,
91
92
  createMutationGate,
92
93
  createRateLimiter,
94
+ daemonInboundTraceIdContext,
95
+ daemonTelemetryResponseContext,
93
96
  detectFromLoopback,
94
97
  getAdvertisedServeFeatures,
95
98
  getDeferredRuntimeRequestTiming,
@@ -124,7 +127,7 @@ import {
124
127
  tagListener,
125
128
  unsafeRevealSecret,
126
129
  validateMcpRuntimeServerName
127
- } from "./chunk-UYDGFWIJ.js";
130
+ } from "./chunk-NYN4RD3K.js";
128
131
  import "./chunk-VGHZT6JR.js";
129
132
  import {
130
133
  isLoopbackBind,
@@ -135,7 +138,12 @@ import "./chunk-UXEO7E3V.js";
135
138
  import {
136
139
  evaluateDaemonWorkspaceTrust,
137
140
  readDaemonTrustPolicySnapshot
138
- } from "./chunk-QRVHGEVY.js";
141
+ } from "./chunk-GCWILQKA.js";
142
+ import {
143
+ readRecentPromptTerminals,
144
+ reconcileDanglingPromptTerminals,
145
+ withPromptTerminals
146
+ } from "./chunk-W5YD3QRT.js";
139
147
  import {
140
148
  EMPTY_WORKSPACE_VOICE_UPDATE_ERROR,
141
149
  MAX_WORKSPACE_SKILL_NAME_LENGTH,
@@ -149,14 +157,14 @@ import {
149
157
  validateWorkspaceSkillName,
150
158
  validateWorkspaceVoiceState,
151
159
  voiceSettingsScopeToWire
152
- } from "./chunk-W7EYJGN7.js";
160
+ } from "./chunk-PWQPWISR.js";
153
161
  import {
154
162
  PermissionRulesValidationError,
155
163
  buildPermissionSettings,
156
164
  isPermissionRuleType,
157
165
  normalizePermissionRules,
158
166
  readPermissionRuleSet
159
- } from "./chunk-OJB5FYVK.js";
167
+ } from "./chunk-4IOBHNV2.js";
160
168
  import {
161
169
  assertVoiceBaseUrlNetworkAllowed,
162
170
  isStreamingVoiceModel,
@@ -164,13 +172,13 @@ import {
164
172
  resolveVoiceTranscriptionConfig,
165
173
  sanitizeVoiceErrorMessage,
166
174
  transcribeVoiceAudio
167
- } from "./chunk-H3SHU2XU.js";
175
+ } from "./chunk-I3AB5DOZ.js";
168
176
  import {
169
177
  isVoiceEnabled,
170
178
  isVoiceMode,
171
179
  readVoiceModel
172
- } from "./chunk-SFJMFZT5.js";
173
- import "./chunk-WGHHA7ZH.js";
180
+ } from "./chunk-IBUXQJHH.js";
181
+ import "./chunk-3C55EUJX.js";
174
182
  import {
175
183
  createTotalSessionAdmissionController
176
184
  } from "./chunk-X2UOOG5V.js";
@@ -190,18 +198,18 @@ import {
190
198
  } from "./chunk-4JRM2BSM.js";
191
199
  import {
192
200
  assertValidChannelSecretUpdates
193
- } from "./chunk-E5WQMF3K.js";
201
+ } from "./chunk-67L6PVD6.js";
194
202
  import {
195
203
  createDaemonStatusProvider
196
- } from "./chunk-FN6M5WUL.js";
197
- import "./chunk-UGK4K2N2.js";
198
- import "./chunk-MDIGJH5X.js";
204
+ } from "./chunk-IFOR6I5C.js";
205
+ import "./chunk-JS73NNWF.js";
206
+ import "./chunk-ZL3HKVEQ.js";
199
207
  import {
200
208
  SessionArtifactAuthorizationError,
201
209
  SessionArtifactValidationError,
202
210
  createAcpSessionBridge,
203
211
  parseSessionSource
204
- } from "./chunk-L3T4V5GZ.js";
212
+ } from "./chunk-GYVB4P5B.js";
205
213
  import {
206
214
  EVENT_SCHEMA_VERSION,
207
215
  EventBus,
@@ -211,17 +219,17 @@ import "./chunk-WCCLLK7X.js";
211
219
  import "./chunk-OCPBI7J5.js";
212
220
  import {
213
221
  createWorkspaceProvidersStatusProvider
214
- } from "./chunk-N6RSOOWJ.js";
222
+ } from "./chunk-AAG7I5CR.js";
215
223
  import {
216
224
  getAuthTypeFromEnv,
217
225
  resolveCliGenerationConfig
218
- } from "./chunk-EOPBFLA5.js";
226
+ } from "./chunk-AKN26LMT.js";
219
227
  import {
220
228
  snapshotProcessEnv
221
- } from "./chunk-CEXU72GE.js";
229
+ } from "./chunk-5NAJDTVP.js";
222
230
  import {
223
231
  createWorkspaceSkillsStatusProvider
224
- } from "./chunk-V6WEMZPD.js";
232
+ } from "./chunk-B72KNVKO.js";
225
233
  import "./chunk-BGXZBI5B.js";
226
234
  import "./chunk-Z4X5MTRT.js";
227
235
  import {
@@ -240,16 +248,16 @@ import {
240
248
  import {
241
249
  daemonObservedContactsPath,
242
250
  loadChannelsConfig
243
- } from "./chunk-55VKMB7X.js";
244
- import "./chunk-U657UZJN.js";
251
+ } from "./chunk-A7MIUCUQ.js";
252
+ import "./chunk-5WEMSDPR.js";
245
253
  import "./chunk-57OAHC2Y.js";
246
254
  import {
247
255
  parseChannelWebhookConfigLenient
248
- } from "./chunk-NRPXRNN4.js";
256
+ } from "./chunk-WXFFCRKG.js";
249
257
  import "./chunk-45NQKMYB.js";
250
258
  import {
251
259
  supportedChannelCatalog
252
- } from "./chunk-5IYS4WWR.js";
260
+ } from "./chunk-WAPL2PHU.js";
253
261
  import "./chunk-V6WHFGST.js";
254
262
  import {
255
263
  getStableLiveDiscoveryBaseDir
@@ -259,13 +267,13 @@ import {
259
267
  LIVE_HOST_PROTOCOL_VERSION,
260
268
  LIVE_INPUT_AUDIO_EPOCH_BYTES
261
269
  } from "./chunk-NKLP3DCK.js";
262
- import "./chunk-BQWNIPTE.js";
270
+ import "./chunk-V4UBYT3Y.js";
263
271
  import {
264
272
  STATUS_SCHEMA_VERSION,
265
273
  SessionRestoreTimeoutError,
266
274
  createIdleWorkspaceMemoryStatus,
267
275
  mapDomainErrorToErrorKind
268
- } from "./chunk-UC67T4SF.js";
276
+ } from "./chunk-AQFWV4YF.js";
269
277
  import "./chunk-K6KS3LTN.js";
270
278
  import "./chunk-FC4KQFCS.js";
271
279
  import "./chunk-T3CHYWJZ.js";
@@ -276,13 +284,13 @@ import {
276
284
  WorkspaceRegistrationStoreLimitError,
277
285
  normalizeWorkspaceDisplayName,
278
286
  workspaceRegistrationId
279
- } from "./chunk-SFTKAX4O.js";
287
+ } from "./chunk-OFJ6OFIT.js";
280
288
  import {
281
289
  CHANNEL_PROMPT_META_KEY,
282
290
  DAEMON_PROMPT_DISPLAY_TEXT_META_KEY,
283
291
  REQUESTED_SESSION_ID_META_KEY,
284
292
  gradeActiveWorkCoverage
285
- } from "./chunk-WP4WIUOJ.js";
293
+ } from "./chunk-QQUVPMMZ.js";
286
294
  import {
287
295
  BranchWhilePromptActiveError,
288
296
  BridgeChannelQuarantinedError,
@@ -336,14 +344,14 @@ import {
336
344
  QWEN_SERVER_TOKEN_ENV,
337
345
  isChannelDeliveryError,
338
346
  isChannelWebhookEnqueueError
339
- } from "./chunk-YP5KH5Y7.js";
347
+ } from "./chunk-ND7NOI4P.js";
340
348
  import {
341
349
  normalizeWorkerDiagnostic
342
350
  } from "./chunk-A6NRNRKE.js";
343
351
  import {
344
352
  normalizeServeChannelSelection
345
353
  } from "./chunk-ALMR3E6Q.js";
346
- import "./chunk-HIBNSEJE.js";
354
+ import "./chunk-UDG5EZJI.js";
347
355
  import {
348
356
  redactLogCredentials
349
357
  } from "./chunk-M5GB774H.js";
@@ -362,30 +370,31 @@ import {
362
370
  getWritableScopes,
363
371
  loadSettings,
364
372
  validateSettingValue
365
- } from "./chunk-VFP5YOHJ.js";
373
+ } from "./chunk-PRIX4D6T.js";
366
374
  import "./chunk-RKUWKYED.js";
367
- import "./chunk-CZK622ZK.js";
375
+ import "./chunk-6IFWBM24.js";
368
376
  import "./chunk-GOXKNSDZ.js";
369
377
  import "./chunk-IDS7MSUP.js";
370
378
  import {
371
379
  detectSystemLanguage,
372
380
  resolveLanguageSetting
373
- } from "./chunk-VTOLYFWM.js";
381
+ } from "./chunk-W3M6P3UR.js";
374
382
  import {
375
383
  SUPPORTED_LANGUAGES,
376
384
  resolveSupportedLanguage
377
385
  } from "./chunk-5EJZE3FP.js";
378
- import "./chunk-MVHJZ3FZ.js";
386
+ import "./chunk-DZNQHKZZ.js";
379
387
  import "./chunk-CXJHQVEK.js";
380
- import "./chunk-PCETXVVV.js";
388
+ import "./chunk-3X6KVX37.js";
381
389
  import "./chunk-WZMH7II3.js";
382
390
  import {
383
391
  getWorkspaceTrustStatus
384
- } from "./chunk-C3T6M24E.js";
392
+ } from "./chunk-RLYXWNS3.js";
385
393
  import "./chunk-NPQ5ZKRP.js";
386
394
  import {
387
395
  isWithinRoot as isWithinRoot2
388
396
  } from "./chunk-MR3PXB6E.js";
397
+ import "./chunk-LJZSMWOH.js";
389
398
  import {
390
399
  ALL_PROVIDERS,
391
400
  BTW_MAX_INPUT_LENGTH,
@@ -394,6 +403,7 @@ import {
394
403
  ClientMcpRegistrar,
395
404
  DEFAULT_LOG_LIMIT,
396
405
  ExtensionManager,
406
+ ExtensionNotUpdatableError,
397
407
  GITHUB_PR_ERROR_MESSAGE_MAX,
398
408
  GROUP_COLOR_OPTIONS,
399
409
  GitWorktreeService,
@@ -407,6 +417,7 @@ import {
407
417
  SESSION_TRANSCRIPT_MAX_LIMIT,
408
418
  SESSION_TRANSCRIPT_MAX_PAGE_BYTES,
409
419
  SESSION_WRITER_RPC_CODES,
420
+ SessionIdCaseConflictError,
410
421
  SessionOrganizationError,
411
422
  SessionOrganizationService,
412
423
  SessionService,
@@ -443,6 +454,7 @@ import {
443
454
  gitPull,
444
455
  gitPush,
445
456
  glob,
457
+ isSupportedArchiveUrl,
446
458
  isValidCheckoutRef,
447
459
  isValidRefName,
448
460
  loadIgnoreRules,
@@ -460,7 +472,7 @@ import {
460
472
  writeWorkspaceContextFile,
461
473
  writeWorktreeSession,
462
474
  writeWorktreeSessionMarker
463
- } from "./chunk-OFTPCOGR.js";
475
+ } from "./chunk-L7RG5PVT.js";
464
476
  import "./chunk-GOFAQQZA.js";
465
477
  import "./chunk-5M6IDOMF.js";
466
478
  import "./chunk-TWPJO254.js";
@@ -468,12 +480,12 @@ import "./chunk-CQ35AJ4Z.js";
468
480
  import {
469
481
  MAX_JOBS,
470
482
  nextDurableFireMs
471
- } from "./chunk-FS5NGKWC.js";
472
- import "./chunk-SLILKYV2.js";
473
- import "./chunk-NVRMCWTP.js";
474
- import "./chunk-AKBOLMUF.js";
483
+ } from "./chunk-F5JZDC4O.js";
484
+ import "./chunk-T2LUUKRI.js";
485
+ import "./chunk-A7NBZBGQ.js";
486
+ import "./chunk-7S22SX2L.js";
475
487
  import "./chunk-6PVPNMXU.js";
476
- import "./chunk-544KT7X4.js";
488
+ import "./chunk-BBMVUTXO.js";
477
489
  import {
478
490
  nextFireTime,
479
491
  parseCron
@@ -486,48 +498,42 @@ import {
486
498
  readCronTasks,
487
499
  taskHasLegacyCondition,
488
500
  updateCronTasks
489
- } from "./chunk-OBJYN4MX.js";
490
- import "./chunk-2C6HJMG3.js";
501
+ } from "./chunk-G64PEZZ5.js";
502
+ import "./chunk-O75QDGQF.js";
491
503
  import "./chunk-O6GEWCJA.js";
492
504
  import "./chunk-T26EAKDL.js";
493
505
  import "./chunk-ZPJWUGCS.js";
494
506
  import "./chunk-CPBF7KYF.js";
495
507
  import {
496
508
  APPROVAL_MODES
497
- } from "./chunk-RWDNJBWN.js";
498
- import "./chunk-WPVUOVYX.js";
499
- import "./chunk-MIPFDQAF.js";
509
+ } from "./chunk-ZUISK67X.js";
510
+ import "./chunk-3EQHT3IC.js";
511
+ import "./chunk-4W4BROUS.js";
500
512
  import "./chunk-MLXTMF7H.js";
501
- import "./chunk-KV27IEHM.js";
502
- import "./chunk-E3DYKPYZ.js";
503
- import "./chunk-4ZMS3JCR.js";
504
- import "./chunk-DGJ7O55J.js";
513
+ import "./chunk-L5JHSPET.js";
514
+ import "./chunk-X7EQHW5L.js";
515
+ import {
516
+ parseGoalControlRequest
517
+ } from "./chunk-JBSW7JA6.js";
518
+ import "./chunk-O327G3QW.js";
505
519
  import {
506
- addDaemonRequestAttribute,
507
- captureDaemonTelemetryContext,
508
- emitDaemonLog,
509
- hashDaemonWorkspace,
510
520
  recordDaemonBridgeError,
511
- recordDaemonError,
512
- recordDaemonHttpRequest,
513
- recordDaemonHttpResponse,
514
- runWithDaemonTelemetryContext,
515
- withDaemonRequestSpan
516
- } from "./chunk-OO4FKHLO.js";
521
+ recordDaemonHttpRequest
522
+ } from "./chunk-2GM44E7D.js";
517
523
  import "./chunk-SAH4BD2J.js";
518
- import "./chunk-XLLKYULU.js";
519
- import "./chunk-PT4I7NBA.js";
524
+ import "./chunk-ZWWU6KNS.js";
525
+ import "./chunk-VX7TFATF.js";
520
526
  import "./chunk-S6LOFUVP.js";
521
527
  import "./chunk-2J3OJGTL.js";
522
528
  import {
523
529
  SubagentError,
524
530
  SubagentErrorCode
525
- } from "./chunk-SG7ZP5PG.js";
531
+ } from "./chunk-HHNSO2Y4.js";
526
532
  import "./chunk-K623ENWT.js";
527
533
  import {
528
534
  escapeXml
529
535
  } from "./chunk-AQ37AY7B.js";
530
- import "./chunk-KBXKR5R2.js";
536
+ import "./chunk-M5AIO24H.js";
531
537
  import {
532
538
  QwenOAuth2Client,
533
539
  QwenOAuthPollError,
@@ -536,24 +542,36 @@ import {
536
542
  isDeviceAuthorizationSuccess,
537
543
  isDeviceTokenPending,
538
544
  isDeviceTokenSuccess
539
- } from "./chunk-I3N2Z25H.js";
545
+ } from "./chunk-47VTGCYK.js";
540
546
  import "./chunk-NAVJD2PQ.js";
541
- import "./chunk-ROIYNTHJ.js";
542
- import "./chunk-2B2BF7P7.js";
547
+ import "./chunk-MD7XDTW7.js";
548
+ import "./chunk-FAIJ5UIU.js";
543
549
  import "./chunk-P3QQPMQA.js";
544
- import "./chunk-YZHRN3CF.js";
545
- import "./chunk-FAAUPSY2.js";
550
+ import "./chunk-SWOKDPS5.js";
551
+ import "./chunk-HEMFCAHG.js";
546
552
  import "./chunk-KM73TBQ4.js";
547
553
  import "./chunk-AXMWHKXA.js";
548
554
  import "./chunk-GLCZKT5V.js";
549
555
  import "./chunk-DJ2GSRLV.js";
550
- import "./chunk-QFJ5JHQR.js";
556
+ import "./chunk-PXOIRYE5.js";
551
557
  import "./chunk-CR3C7WXL.js";
558
+ import {
559
+ addDaemonRequestAttribute,
560
+ captureDaemonTelemetryContext,
561
+ emitDaemonLog,
562
+ extractDaemonHttpTraceContext,
563
+ extractInboundTraceId,
564
+ hashDaemonWorkspace,
565
+ recordDaemonError,
566
+ recordDaemonHttpResponse,
567
+ runWithDaemonTelemetryContext,
568
+ withDaemonRequestSpan
569
+ } from "./chunk-7NLDU6J2.js";
552
570
  import "./chunk-XWRJCPHC.js";
553
571
  import {
554
572
  parseLineTolerant,
555
573
  read
556
- } from "./chunk-KC4WMLZO.js";
574
+ } from "./chunk-EXY6APEA.js";
557
575
  import "./chunk-YRLW2MSX.js";
558
576
  import "./chunk-VGC4I5JJ.js";
559
577
  import {
@@ -564,32 +582,32 @@ import {
564
582
  getAllGeminiMdFilenames,
565
583
  isUtf8CompatibleEncoding,
566
584
  isWithinRoot
567
- } from "./chunk-3PWCMXIR.js";
568
- import "./chunk-CHHABXPE.js";
569
- import "./chunk-MA2HEDVP.js";
570
- import "./chunk-XUJNK7Y6.js";
571
- import "./chunk-6HY6IF3Z.js";
572
- import "./chunk-2A6VQJYK.js";
585
+ } from "./chunk-MGEWDLRO.js";
586
+ import "./chunk-5AAW6E3C.js";
587
+ import "./chunk-4CKU5K2R.js";
588
+ import "./chunk-7WVB4FMG.js";
589
+ import "./chunk-OUYRA764.js";
590
+ import "./chunk-DK4HL3IB.js";
573
591
  import "./chunk-F6WFNA7U.js";
574
592
  import "./chunk-WZAD4ZNJ.js";
575
593
  import "./chunk-FPGTNKCP.js";
576
594
  import "./chunk-YHC2EYYG.js";
577
- import "./chunk-CPHEPGAO.js";
578
- import "./chunk-DVR7XKO5.js";
579
- import "./chunk-YECDICIO.js";
595
+ import "./chunk-722JBVVW.js";
596
+ import "./chunk-B5LEKTE7.js";
597
+ import "./chunk-Q6ETBOWF.js";
598
+ import "./chunk-HHJLM3WQ.js";
580
599
  import {
600
+ isTelemetrySdkInitialized,
581
601
  redactUrlCredentials,
582
602
  stripAnsiAndControl
583
- } from "./chunk-XT4RKHVE.js";
584
- import "./chunk-HHJLM3WQ.js";
585
- import "./chunk-D34RDOLP.js";
603
+ } from "./chunk-RZ4PE3ER.js";
586
604
  import {
587
605
  FatalConfigError,
588
606
  Storage,
589
607
  createDebugLogger,
590
608
  getErrorMessage,
591
609
  runWithoutDebugLogSession
592
- } from "./chunk-BUQDLC2G.js";
610
+ } from "./chunk-XFRYCCVC.js";
593
611
  import "./chunk-VOQXFAY5.js";
594
612
  import {
595
613
  writeStderrLine,
@@ -606,7 +624,7 @@ import {
606
624
  } from "./chunk-TYAMGABM.js";
607
625
  import "./chunk-FCMNKVXT.js";
608
626
  import "./chunk-AMDSOFFV.js";
609
- import "./chunk-QUGAUQGJ.js";
627
+ import "./chunk-GX2THELY.js";
610
628
  import {
611
629
  init_esbuild_shims
612
630
  } from "./chunk-5O2XNYP6.js";
@@ -5998,11 +6016,13 @@ var RequestedSessionIdAdmissionError = class extends Error {
5998
6016
  name = "RequestedSessionIdAdmissionError";
5999
6017
  };
6000
6018
  async function persistedSessionExists(sessionService, sessionId) {
6001
- if (await sessionService.getSessionLocation(sessionId) !== void 0) {
6002
- return true;
6003
- }
6004
- if (await sessionService.findSessionIdIgnoringCase?.(sessionId) !== void 0) {
6005
- return true;
6019
+ try {
6020
+ if (await sessionService.findSessionIdIgnoringCase(sessionId) !== void 0) {
6021
+ return true;
6022
+ }
6023
+ } catch (error2) {
6024
+ if (error2 instanceof SessionIdCaseConflictError) return true;
6025
+ throw error2;
6006
6026
  }
6007
6027
  for (const state of ["active", "archived"]) {
6008
6028
  try {
@@ -8311,8 +8331,13 @@ var SessionArchiveCoordinator = class {
8311
8331
  maintenanceSealed = false;
8312
8332
  activeMaintenance = 0;
8313
8333
  maintenanceDrain;
8334
+ // Lock keys are canonicalized like every other session-id lookup: batch
8335
+ // delete/archive/unarchive lock raw caller spellings while restore locks
8336
+ // the request spelling, and on a case-insensitive filesystem both reach
8337
+ // the same transcript file — uncanonicalized keys would let a differently
8338
+ // cased caller id slip past a held guard and unlink it mid-restore.
8314
8339
  assertNotTransitioning(sessionId) {
8315
- if (this.exclusive.has(sessionId)) {
8340
+ if (this.exclusive.has(normalizeSessionIdForLookup(sessionId))) {
8316
8341
  throw new SessionArchivingError(sessionId);
8317
8342
  }
8318
8343
  }
@@ -8320,7 +8345,9 @@ var SessionArchiveCoordinator = class {
8320
8345
  if (this.maintenanceSealed) {
8321
8346
  throw new DaemonDrainingError();
8322
8347
  }
8323
- const uniqueSessionIds = [...new Set(sessionIds)];
8348
+ const uniqueSessionIds = [
8349
+ ...new Set(sessionIds.map(normalizeSessionIdForLookup))
8350
+ ];
8324
8351
  for (const sessionId of uniqueSessionIds) {
8325
8352
  this.assertNotTransitioning(sessionId);
8326
8353
  if ((this.shared.get(sessionId) ?? 0) > 0) {
@@ -8362,7 +8389,9 @@ var SessionArchiveCoordinator = class {
8362
8389
  if (this.maintenanceSealed) {
8363
8390
  throw new DaemonDrainingError();
8364
8391
  }
8365
- const uniqueSessionIds = [...new Set(sessionIds)];
8392
+ const uniqueSessionIds = [
8393
+ ...new Set(sessionIds.map(normalizeSessionIdForLookup))
8394
+ ];
8366
8395
  for (const sessionId of uniqueSessionIds) {
8367
8396
  this.assertNotTransitioning(sessionId);
8368
8397
  }
@@ -8556,7 +8585,9 @@ async function deleteDaemonSessions(params) {
8556
8585
  coordinatorLockHeld = false,
8557
8586
  onError
8558
8587
  } = params;
8559
- const uniqueSessionIds = [...new Set(sessionIds)];
8588
+ const uniqueSessionIds = [
8589
+ ...new Set(sessionIds.map(normalizeSessionIdForLookup))
8590
+ ];
8560
8591
  if (!coordinatorLockHeld) {
8561
8592
  for (const sessionId of uniqueSessionIds) {
8562
8593
  coordinator.assertNotTransitioning(sessionId);
@@ -8566,22 +8597,40 @@ async function deleteDaemonSessions(params) {
8566
8597
  uniqueSessionIds.map(async (sessionId) => {
8567
8598
  try {
8568
8599
  const mutateSession = /* @__PURE__ */ __name(async () => {
8600
+ const removePersistedSession = /* @__PURE__ */ __name(async () => {
8601
+ const result = await deletePersistedSessionWithLease(
8602
+ service,
8603
+ sessionId
8604
+ );
8605
+ if (result.kind === "error") {
8606
+ onError?.({
8607
+ phase: "remove",
8608
+ sessionId,
8609
+ error: errorMessage(result.error)
8610
+ });
8611
+ return result;
8612
+ }
8613
+ try {
8614
+ await bridge.deleteSessionAttachments(sessionId);
8615
+ return result;
8616
+ } catch (error2) {
8617
+ onError?.({
8618
+ phase: "delete",
8619
+ sessionId,
8620
+ error: errorMessage(error2)
8621
+ });
8622
+ return {
8623
+ kind: "error",
8624
+ error: error2,
8625
+ mutationApplied: result.mutationApplied
8626
+ };
8627
+ }
8628
+ }, "removePersistedSession");
8569
8629
  try {
8570
8630
  await bridge.closeSession(sessionId);
8571
8631
  } catch (error2) {
8572
8632
  if (isSessionNotFoundError(error2)) {
8573
- const result2 = await deletePersistedSessionWithLease(
8574
- service,
8575
- sessionId
8576
- );
8577
- if (result2.kind === "error") {
8578
- onError?.({
8579
- phase: "remove",
8580
- sessionId,
8581
- error: errorMessage(result2.error)
8582
- });
8583
- }
8584
- return result2;
8633
+ return await removePersistedSession();
8585
8634
  }
8586
8635
  onError?.({
8587
8636
  phase: "close",
@@ -8594,18 +8643,7 @@ async function deleteDaemonSessions(params) {
8594
8643
  mutationApplied: false
8595
8644
  };
8596
8645
  }
8597
- const result = await deletePersistedSessionWithLease(
8598
- service,
8599
- sessionId
8600
- );
8601
- if (result.kind === "error") {
8602
- onError?.({
8603
- phase: "remove",
8604
- sessionId,
8605
- error: errorMessage(result.error)
8606
- });
8607
- }
8608
- return result;
8646
+ return await removePersistedSession();
8609
8647
  }, "mutateSession");
8610
8648
  return await (coordinatorLockHeld ? mutateSession() : coordinator.runExclusiveMany([sessionId], mutateSession));
8611
8649
  } catch (error2) {
@@ -8746,7 +8784,9 @@ async function archiveDaemonSessions(params) {
8746
8784
  coordinator,
8747
8785
  coordinatorLockHeld = false
8748
8786
  } = params;
8749
- const uniqueSessionIds = [...new Set(sessionIds)];
8787
+ const uniqueSessionIds = [
8788
+ ...new Set(sessionIds.map(normalizeSessionIdForLookup))
8789
+ ];
8750
8790
  if (!coordinatorLockHeld) {
8751
8791
  for (const sessionId of uniqueSessionIds) {
8752
8792
  coordinator.assertNotTransitioning(sessionId);
@@ -8888,7 +8928,9 @@ async function unarchiveDaemonSessions(params) {
8888
8928
  coordinator,
8889
8929
  coordinatorLockHeld = false
8890
8930
  } = params;
8891
- const uniqueSessionIds = [...new Set(sessionIds)];
8931
+ const uniqueSessionIds = [
8932
+ ...new Set(sessionIds.map(normalizeSessionIdForLookup))
8933
+ ];
8892
8934
  if (!coordinatorLockHeld) {
8893
8935
  for (const sessionId of uniqueSessionIds) {
8894
8936
  coordinator.assertNotTransitioning(sessionId);
@@ -9676,6 +9718,15 @@ function toRpcError(err) {
9676
9718
  sessionId: err.sessionId
9677
9719
  }
9678
9720
  };
9721
+ case "SessionIdCaseConflictError":
9722
+ return {
9723
+ code: RPC.INTERNAL_ERROR,
9724
+ message: errMsg(err),
9725
+ data: {
9726
+ errorKind: "session_conflict",
9727
+ sessionId: err.sessionId
9728
+ }
9729
+ };
9679
9730
  case "SessionArchivingError":
9680
9731
  return {
9681
9732
  code: RPC.INTERNAL_ERROR,
@@ -10272,6 +10323,19 @@ var AcpDispatcher = class {
10272
10323
  return;
10273
10324
  }
10274
10325
  const sessionRuntime = this.getSessionRuntimeContext();
10326
+ if (isReservedStandaloneSessionSource({
10327
+ sourceType: typeof params["sourceType"] === "string" ? params["sourceType"] : void 0
10328
+ })) {
10329
+ conn.sendConn(
10330
+ error(
10331
+ id,
10332
+ RPC.INVALID_PARAMS,
10333
+ "The requested session source is reserved for daemon-owned standalone sessions.",
10334
+ { errorKind: "reserved_session_source" }
10335
+ )
10336
+ );
10337
+ return;
10338
+ }
10275
10339
  const source = parseSessionSource(
10276
10340
  params["sourceType"],
10277
10341
  params["sourceId"]
@@ -10405,23 +10469,54 @@ var AcpDispatcher = class {
10405
10469
  }
10406
10470
  );
10407
10471
  try {
10472
+ const guardSessionService = new SessionService(cwd, {
10473
+ runtimeBaseDir: sessionRuntime.sessionRuntimeBaseDir
10474
+ });
10475
+ let persistedGuardId;
10476
+ try {
10477
+ persistedGuardId = await guardSessionService.findSessionIdIgnoringCase(sessionId);
10478
+ } catch (error2) {
10479
+ if (error2 instanceof SessionIdCaseConflictError && await guardSessionService.getSessionLocation(
10480
+ error2.candidateSessionId ?? sessionId
10481
+ ) === "conflict") {
10482
+ throw new SessionConflictError(sessionId);
10483
+ }
10484
+ throw error2;
10485
+ }
10408
10486
  const restored = await this.archiveCoordinator.runSharedMany(
10409
10487
  [sessionId],
10410
10488
  async () => {
10411
10489
  assertGenerationOpen?.();
10490
+ const sessionService = new SessionService(cwd, {
10491
+ runtimeBaseDir: sessionRuntime.sessionRuntimeBaseDir
10492
+ });
10493
+ let storageSessionId = persistedGuardId ?? sessionId;
10494
+ let persistedSessionId;
10495
+ try {
10496
+ persistedSessionId = await sessionService.findSessionIdIgnoringCase(sessionId);
10497
+ } catch (error2) {
10498
+ if (error2 instanceof SessionIdCaseConflictError && await sessionService.getSessionLocation(
10499
+ error2.candidateSessionId ?? sessionId
10500
+ ) === "conflict") {
10501
+ throw new SessionConflictError(sessionId);
10502
+ }
10503
+ throw error2;
10504
+ }
10505
+ if (persistedSessionId) {
10506
+ storageSessionId = persistedSessionId;
10507
+ } else if (this.liveSessionIsolation) {
10508
+ throw new SessionNotFoundError(sessionId);
10509
+ }
10412
10510
  await assertSessionLoadable(
10413
10511
  cwd,
10414
- sessionId,
10512
+ storageSessionId,
10415
10513
  sessionRuntime.sessionRuntimeBaseDir
10416
10514
  );
10417
- const sessionService = new SessionService(cwd, {
10418
- runtimeBaseDir: sessionRuntime.sessionRuntimeBaseDir
10419
- });
10420
10515
  const metadata = this.liveSessionIsolation ? await readLoadableLiveConversationMetadata(
10421
- sessionId,
10422
- (candidateId) => sessionService.readCreationMetadata(candidateId)
10423
- ) : await sessionService.readCreationMetadata(sessionId);
10424
- if (metadata === void 0) {
10516
+ storageSessionId,
10517
+ sessionService
10518
+ ) : await sessionService.readCreationMetadata(storageSessionId);
10519
+ if (metadata === void 0 || this.liveSessionIsolation !== void 0 && isReservedStandaloneSessionSource(metadata)) {
10425
10520
  throw new SessionNotFoundError(sessionId);
10426
10521
  }
10427
10522
  const liveConversationCwd = this.liveSessionIsolation ? await this.liveSessionIsolation.materializeConversationDirectory(
@@ -19348,7 +19443,7 @@ function createExtensionsController(deps) {
19348
19443
  version: ext.version,
19349
19444
  isActive: ext.isActive,
19350
19445
  path: ext.path,
19351
- ...ext.installMetadata?.source ? {
19446
+ ...ext.installMetadata?.source && ext.installMetadata.type !== "snapshot" ? {
19352
19447
  source: redactExtensionDisplaySource(
19353
19448
  ext.installMetadata.source
19354
19449
  )
@@ -19357,7 +19452,8 @@ function createExtensionsController(deps) {
19357
19452
  ...ext.installMetadata?.originSource ? { originSource: ext.installMetadata.originSource } : {},
19358
19453
  ...ext.installMetadata?.ref ? { ref: ext.installMetadata.ref } : {},
19359
19454
  ...ext.installMetadata?.autoUpdate !== void 0 ? { autoUpdate: ext.installMetadata.autoUpdate } : {},
19360
- updateState: ext.installMetadata ? "unknown" : "not updatable",
19455
+ ...ext.installMetadata?.type === "snapshot" ? { credentialPersistence: "one_time" } : ext.installMetadata?.credentialPersistence === "stored" ? { credentialPersistence: "stored" } : {},
19456
+ updateState: ext.installMetadata?.type === "snapshot" ? "not updatable" : ext.installMetadata ? "unknown" : "not updatable",
19361
19457
  capabilities,
19362
19458
  details: {
19363
19459
  mcpServers: ext.mcpServers ? Object.keys(ext.mcpServers) : [],
@@ -19407,6 +19503,7 @@ var EXTENSION_INTERACTION_DEADLINE_MS = 10 * 6e4;
19407
19503
  var EXTENSION_INTERACTIVE_PREPARE_DEADLINE_MS = EXTENSION_PREPARE_DEADLINE_MS + EXTENSION_INTERACTION_DEADLINE_MS;
19408
19504
  var EXTENSION_UPDATE_CHECK_DEADLINE_MS = 2 * 6e4;
19409
19505
  var EXTENSION_ARCHIVE_UPLOAD_LIMIT = "10mb";
19506
+ var MAX_EXTENSION_BATCH_SIZE = 100;
19410
19507
  var extensionArchiveBodyParser = import_express2.default.raw({
19411
19508
  type: "application/octet-stream",
19412
19509
  limit: EXTENSION_ARCHIVE_UPLOAD_LIMIT
@@ -19447,6 +19544,32 @@ var parseExtensionScope = /* @__PURE__ */ __name((body, res) => {
19447
19544
  }
19448
19545
  return scope === "user" ? "User" /* User */ : "Workspace" /* Workspace */;
19449
19546
  }, "parseExtensionScope");
19547
+ var parseExtensionBatchNames = /* @__PURE__ */ __name((req, res, safeBody2) => {
19548
+ const rawNames = safeBody2(req)["extensionNames"];
19549
+ if (!Array.isArray(rawNames) || rawNames.length === 0 || rawNames.length > MAX_EXTENSION_BATCH_SIZE || !rawNames.every((name) => typeof name === "string")) {
19550
+ res.status(400).json({
19551
+ error: `\`extensionNames\` must be a non-empty string array (max ${MAX_EXTENSION_BATCH_SIZE})`,
19552
+ code: "invalid_extension_names"
19553
+ });
19554
+ return void 0;
19555
+ }
19556
+ const names = [];
19557
+ const seen = /* @__PURE__ */ new Set();
19558
+ for (const name of rawNames) {
19559
+ if (!/^[a-zA-Z0-9-_.]+$/.test(name)) {
19560
+ res.status(400).json({
19561
+ error: `Invalid extension name "${name}"`,
19562
+ code: "invalid_extension_name"
19563
+ });
19564
+ return void 0;
19565
+ }
19566
+ const normalizedName = name.toLowerCase();
19567
+ if (seen.has(normalizedName)) continue;
19568
+ seen.add(normalizedName);
19569
+ names.push(name);
19570
+ }
19571
+ return names;
19572
+ }, "parseExtensionBatchNames");
19450
19573
  var parseExtensionRegistryUrl = /* @__PURE__ */ __name((value, res) => {
19451
19574
  let parsed;
19452
19575
  try {
@@ -19487,23 +19610,76 @@ var parsePotentialSourceUrl = /* @__PURE__ */ __name((source) => {
19487
19610
  }
19488
19611
  }
19489
19612
  }, "parsePotentialSourceUrl");
19490
- var validateExtensionSourceHost = /* @__PURE__ */ __name((source, res) => {
19613
+ var parseExtensionInstallSource = /* @__PURE__ */ __name((source, persistence, res) => {
19614
+ if (persistence !== void 0 && persistence !== "stored" && persistence !== "one_time") {
19615
+ res.status(400).json({
19616
+ error: '`credentialPersistence` must be "stored" or "one_time"'
19617
+ });
19618
+ return null;
19619
+ }
19491
19620
  const parsed = parsePotentialSourceUrl(source);
19492
- if (!parsed) return true;
19493
- if (parsed.username || parsed.password) {
19494
- res.status(400).json({ error: "`source` must not include credentials" });
19495
- return false;
19621
+ if (!parsed) {
19622
+ if (persistence !== void 0) {
19623
+ res.status(400).json({
19624
+ error: "`credentialPersistence` requires source URL credentials"
19625
+ });
19626
+ return null;
19627
+ }
19628
+ return { source };
19496
19629
  }
19497
19630
  if (isBlockedAuthProviderHost(parsed.hostname)) {
19498
19631
  res.status(400).json({ error: "`source` host is not allowed" });
19499
- return false;
19632
+ return null;
19500
19633
  }
19501
19634
  if (parsed.protocol !== "https:") {
19502
19635
  res.status(400).json({ error: "`source` must use https" });
19503
- return false;
19636
+ return null;
19504
19637
  }
19505
- return true;
19506
- }, "validateExtensionSourceHost");
19638
+ const authority = /^[a-z][a-z\d+.-]*:\/\/([^/?#]*)/i.exec(source)?.[1];
19639
+ const hasUserInfo = !!parsed.username || !!parsed.password || authority?.includes("@") === true;
19640
+ if (!hasUserInfo) {
19641
+ if (persistence !== void 0) {
19642
+ res.status(400).json({
19643
+ error: "`credentialPersistence` requires source URL credentials"
19644
+ });
19645
+ return null;
19646
+ }
19647
+ return { source };
19648
+ }
19649
+ const hasControlCharacter = /* @__PURE__ */ __name((value) => Array.from(value).some((character) => {
19650
+ const code = character.charCodeAt(0);
19651
+ return code <= 31 || code >= 127 && code <= 159;
19652
+ }), "hasControlCharacter");
19653
+ if (hasControlCharacter(source)) {
19654
+ res.status(400).json({ error: "`source` credentials are invalid" });
19655
+ return null;
19656
+ }
19657
+ let username;
19658
+ let password;
19659
+ try {
19660
+ username = decodeURIComponent(parsed.username);
19661
+ password = decodeURIComponent(parsed.password);
19662
+ } catch {
19663
+ res.status(400).json({ error: "`source` credentials are invalid" });
19664
+ return null;
19665
+ }
19666
+ const invalidText = /* @__PURE__ */ __name((value, maxBytes) => Buffer.byteLength(value, "utf8") > maxBytes || hasControlCharacter(value), "invalidText");
19667
+ if (!username && !password || invalidText(username, 256) || invalidText(password, 4096)) {
19668
+ res.status(400).json({ error: "`source` credentials are invalid" });
19669
+ return null;
19670
+ }
19671
+ parsed.username = "";
19672
+ parsed.password = "";
19673
+ const credentialPersistence = persistence ?? "one_time";
19674
+ return {
19675
+ source: parsed.toString(),
19676
+ gitCredential: {
19677
+ username,
19678
+ password,
19679
+ persistence: credentialPersistence
19680
+ }
19681
+ };
19682
+ }, "parseExtensionInstallSource");
19507
19683
  var validateExtensionSourceMetadata = /* @__PURE__ */ __name((installMetadata) => {
19508
19684
  if (installMetadata.type !== "git") return true;
19509
19685
  const parsed = parsePotentialSourceUrl(installMetadata.source);
@@ -20020,6 +20196,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20020
20196
  const allowPreRelease = body["allowPreRelease"];
20021
20197
  const registry = body["registry"];
20022
20198
  const consent = body["consent"];
20199
+ const credentialPersistence = body["credentialPersistence"];
20023
20200
  if (!source || typeof source !== "string") {
20024
20201
  res.status(400).json({ error: "Missing or invalid source" });
20025
20202
  return;
@@ -20044,7 +20221,6 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20044
20221
  res.status(400).json({ error: "`registry` must be a string" });
20045
20222
  return;
20046
20223
  }
20047
- const sourceValue = source;
20048
20224
  const refValue = typeof ref === "string" ? ref : void 0;
20049
20225
  const autoUpdateValue = typeof autoUpdate === "boolean" ? autoUpdate : void 0;
20050
20226
  const allowPreReleaseValue = typeof allowPreRelease === "boolean" ? allowPreRelease : void 0;
@@ -20057,7 +20233,25 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20057
20233
  });
20058
20234
  return;
20059
20235
  }
20060
- if (!validateExtensionSourceHost(sourceValue, res)) {
20236
+ const parsedSource = parseExtensionInstallSource(
20237
+ source,
20238
+ credentialPersistence,
20239
+ res
20240
+ );
20241
+ if (!parsedSource) return;
20242
+ const sourceValue = parsedSource.source;
20243
+ body["source"] = sourceValue;
20244
+ const gitCredential = parsedSource.gitCredential;
20245
+ if (gitCredential?.persistence === "one_time" && autoUpdateValue) {
20246
+ res.status(400).json({
20247
+ error: "`autoUpdate` is not supported with one-time credentials"
20248
+ });
20249
+ return;
20250
+ }
20251
+ if (gitCredential && isSupportedArchiveUrl(sourceValue)) {
20252
+ res.status(400).json({
20253
+ error: "Git credentials require an HTTPS Git install source."
20254
+ });
20061
20255
  return;
20062
20256
  }
20063
20257
  const localSource = /^[A-Za-z]:[\\/]/.test(sourceValue) || sourceValue.startsWith("/") || sourceValue.startsWith(".");
@@ -20107,7 +20301,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20107
20301
  }
20108
20302
  ctrl.runQueuedExtensionMutation(
20109
20303
  "install",
20110
- { source: sourceValue },
20304
+ gitCredential?.persistence === "one_time" ? {} : { source: sourceValue },
20111
20305
  res,
20112
20306
  async (extensionManager, _signal, context, operationId) => {
20113
20307
  const prepared = await context.prepare(async (signal) => {
@@ -20119,6 +20313,11 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20119
20313
  "Only GitHub, Git, and npm extension installs are supported over the daemon endpoint."
20120
20314
  );
20121
20315
  }
20316
+ if (gitCredential && installMetadata.type !== "git" && installMetadata.type !== "github-release") {
20317
+ throw new Error(
20318
+ "Git credentials require an HTTPS Git install source."
20319
+ );
20320
+ }
20122
20321
  if (installMetadata.type === "npm" && refValue) {
20123
20322
  throw new Error("--ref is not applicable for npm extensions.");
20124
20323
  }
@@ -20143,7 +20342,8 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20143
20342
  },
20144
20343
  initialActivation: { scope: "user" },
20145
20344
  requestConsent: /* @__PURE__ */ __name(() => Promise.resolve(), "requestConsent"),
20146
- signal
20345
+ signal,
20346
+ ...gitCredential ? { gitCredential } : {}
20147
20347
  });
20148
20348
  });
20149
20349
  try {
@@ -20155,9 +20355,13 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20155
20355
  );
20156
20356
  return {
20157
20357
  status: "installed",
20158
- source: sourceValue,
20358
+ ...gitCredential?.persistence === "one_time" ? {} : { source: sourceValue },
20159
20359
  name: committed.identity.name,
20160
- version: committed.version
20360
+ version: committed.version,
20361
+ ...gitCredential ? {
20362
+ credentialPersistence: gitCredential.persistence,
20363
+ ...prepared.credentialStorage ? { credentialStorage: prepared.credentialStorage } : {}
20364
+ } : {}
20161
20365
  };
20162
20366
  } finally {
20163
20367
  await extensionManager.disposePreparedExtension(prepared);
@@ -20530,6 +20734,17 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20530
20734
  }
20531
20735
  return state;
20532
20736
  }, "parseActivationState");
20737
+ const parseWorkspaceBatchActivationState = /* @__PURE__ */ __name((req, res) => {
20738
+ const state = safeBody2(req)["state"];
20739
+ if (state !== "enabled" && state !== "disabled" && state !== "inherit") {
20740
+ res.status(400).json({
20741
+ error: '`state` must be "enabled", "disabled", or "inherit"',
20742
+ code: "invalid_extension_activation"
20743
+ });
20744
+ return null;
20745
+ }
20746
+ return state;
20747
+ }, "parseWorkspaceBatchActivationState");
20533
20748
  const sendOperation = /* @__PURE__ */ __name((req, res, route, manager, operation, failureContext, run2, options = {}) => {
20534
20749
  if (!primaryController.validateExtensionMutationClient(req, res, {
20535
20750
  requireClientId: false,
@@ -20568,6 +20783,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20568
20783
  name: extension.name,
20569
20784
  version: extension.version,
20570
20785
  ...extension.installMetadata?.type ? { installType: extension.installMetadata.type } : {},
20786
+ ...extension.installMetadata?.type === "snapshot" ? { credentialPersistence: "one_time" } : extension.installMetadata?.credentialPersistence === "stored" ? { credentialPersistence: "stored" } : {},
20571
20787
  defaultActivation: policy?.defaultActivation ?? "enabled",
20572
20788
  workspaceOverrideCount: Object.values(
20573
20789
  policy?.workspaceOverrides ?? {}
@@ -20595,6 +20811,43 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20595
20811
  }
20596
20812
  res.status(200).json(operation);
20597
20813
  });
20814
+ app.put("/extensions/activation", mutate({ strict: true }), (req, res) => {
20815
+ const names = parseExtensionBatchNames(req, res, safeBody2);
20816
+ if (!names) return;
20817
+ const state = parseActivationState(req, res);
20818
+ if (!state) return;
20819
+ const manager = primaryController.createExtensionManager(
20820
+ boundWorkspace,
20821
+ true
20822
+ );
20823
+ sendOperation(
20824
+ req,
20825
+ res,
20826
+ "PUT /extensions/activation",
20827
+ manager,
20828
+ "set_default_activation_batch",
20829
+ {},
20830
+ async (extensionManager, _signal, context) => {
20831
+ await context.commit(
20832
+ async (onCommitted) => await extensionManager.setExtensionDefaultActivations(
20833
+ names,
20834
+ state,
20835
+ onCommitted
20836
+ )
20837
+ );
20838
+ return {
20839
+ status: "updated",
20840
+ results: names.map((name) => ({
20841
+ name,
20842
+ defaultActivation: state
20843
+ }))
20844
+ };
20845
+ },
20846
+ {
20847
+ ...workspaceRegistry ? { refreshRuntimes: /* @__PURE__ */ __name(() => workspaceRegistry.listAll(), "refreshRuntimes") } : {}
20848
+ }
20849
+ );
20850
+ });
20598
20851
  app.put(
20599
20852
  "/extensions/:extensionId/activation",
20600
20853
  mutate({ strict: true }),
@@ -20644,6 +20897,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20644
20897
  const autoUpdate = body["autoUpdate"];
20645
20898
  const allowPreRelease = body["allowPreRelease"];
20646
20899
  const registry = body["registry"];
20900
+ const credentialPersistence = body["credentialPersistence"];
20647
20901
  if (typeof source !== "string" || !source) {
20648
20902
  res.status(400).json({ error: "Missing or invalid source" });
20649
20903
  return;
@@ -20676,7 +20930,27 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20676
20930
  });
20677
20931
  return;
20678
20932
  }
20679
- if (!validateExtensionSourceHost(source, res)) return;
20933
+ const parsedSource = parseExtensionInstallSource(
20934
+ source,
20935
+ credentialPersistence,
20936
+ res
20937
+ );
20938
+ if (!parsedSource) return;
20939
+ const sourceValue = parsedSource.source;
20940
+ body["source"] = sourceValue;
20941
+ const gitCredential = parsedSource.gitCredential;
20942
+ if (gitCredential?.persistence === "one_time" && autoUpdate === true) {
20943
+ res.status(400).json({
20944
+ error: "`autoUpdate` is not supported with one-time credentials"
20945
+ });
20946
+ return;
20947
+ }
20948
+ if (gitCredential && isSupportedArchiveUrl(sourceValue)) {
20949
+ res.status(400).json({
20950
+ error: "Git credentials require an HTTPS Git install source."
20951
+ });
20952
+ return;
20953
+ }
20680
20954
  if (!activation || typeof activation !== "object") {
20681
20955
  res.status(400).json({ error: "Missing initial activation" });
20682
20956
  return;
@@ -20715,10 +20989,10 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20715
20989
  "POST /extensions/install",
20716
20990
  manager,
20717
20991
  "install",
20718
- { source },
20992
+ gitCredential?.persistence === "one_time" ? {} : { source: sourceValue },
20719
20993
  async (extensionManager, _signal, context) => {
20720
20994
  const prepared = await context.prepare(async (signal) => {
20721
- const metadata = await parseInstallSource(source, {
20995
+ const metadata = await parseInstallSource(sourceValue, {
20722
20996
  networkPolicy: "public"
20723
20997
  });
20724
20998
  if (metadata.type !== "git" && metadata.type !== "github-release" && metadata.type !== "npm") {
@@ -20726,6 +21000,11 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20726
21000
  "Only GitHub, Git, and npm extension installs are supported over the daemon endpoint."
20727
21001
  );
20728
21002
  }
21003
+ if (gitCredential && metadata.type !== "git" && metadata.type !== "github-release") {
21004
+ throw new Error(
21005
+ "Git credentials require an HTTPS Git install source."
21006
+ );
21007
+ }
20729
21008
  if (!validateExtensionSourceMetadata(metadata)) {
20730
21009
  throw new Error("`source` host is not allowed");
20731
21010
  }
@@ -20750,7 +21029,8 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20750
21029
  requestConsent: /* @__PURE__ */ __name(() => Promise.resolve(), "requestConsent"),
20751
21030
  cwd: boundWorkspace,
20752
21031
  initialActivation,
20753
- signal
21032
+ signal,
21033
+ ...gitCredential ? { gitCredential } : {}
20754
21034
  });
20755
21035
  });
20756
21036
  try {
@@ -20762,9 +21042,13 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20762
21042
  );
20763
21043
  return {
20764
21044
  status: "installed",
20765
- source,
21045
+ ...gitCredential?.persistence === "one_time" ? {} : { source: sourceValue },
20766
21046
  name: committed.identity.name,
20767
- version: committed.version
21047
+ version: committed.version,
21048
+ ...gitCredential ? {
21049
+ credentialPersistence: gitCredential.persistence,
21050
+ ...prepared.credentialStorage ? { credentialStorage: prepared.credentialStorage } : {}
21051
+ } : {}
20768
21052
  };
20769
21053
  } finally {
20770
21054
  await extensionManager.disposePreparedExtension(prepared);
@@ -20831,9 +21115,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20831
21115
  if (!extension)
20832
21116
  throw new Error(`Extension "${extensionId}" not found`);
20833
21117
  if (extension.installMetadata?.type !== "git" && extension.installMetadata?.type !== "archive-url" && extension.installMetadata?.type !== "github-release" && extension.installMetadata?.type !== "npm") {
20834
- throw new Error(
20835
- `Extension "${extension.name}" is not remotely updatable.`
20836
- );
21118
+ throw new ExtensionNotUpdatableError(extension.name);
20837
21119
  }
20838
21120
  const preparedResult = await context.prepare(
20839
21121
  async (signal) => await extensionManager.prepareExtensionUpdate({
@@ -20895,7 +21177,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20895
21177
  );
20896
21178
  const snapshot = await manager.getExtensionStoreSnapshot();
20897
21179
  const policy = snapshot.extensions[extensionId];
20898
- if (!policy) {
21180
+ if (!policy || policy.declarationOnly) {
20899
21181
  res.status(204).end();
20900
21182
  return;
20901
21183
  }
@@ -20969,6 +21251,57 @@ function registerWorkspaceExtensionRoutes(app, deps) {
20969
21251
  });
20970
21252
  }
20971
21253
  });
21254
+ app.put(
21255
+ "/workspaces/:workspace/extensions/activation",
21256
+ mutate({ strict: true }),
21257
+ (req, res) => {
21258
+ const runtime = resolveWorkspaceRuntimeFromParam(registry, req, res);
21259
+ if (!runtime || !requireTrustedWorkspaceRuntime(runtime, res)) return;
21260
+ const names = parseExtensionBatchNames(req, res, safeBody2);
21261
+ if (!names) return;
21262
+ const state = parseWorkspaceBatchActivationState(req, res);
21263
+ if (!state) return;
21264
+ const manager = primaryController.createExtensionManager(
21265
+ runtime.workspaceCwd,
21266
+ true
21267
+ );
21268
+ sendOperation(
21269
+ req,
21270
+ res,
21271
+ "PUT /workspaces/:workspace/extensions/activation",
21272
+ manager,
21273
+ "set_workspace_activation_batch",
21274
+ {},
21275
+ async (extensionManager, _signal, context) => {
21276
+ const snapshot = await context.commit(
21277
+ async (onCommitted) => await extensionManager.setExtensionWorkspaceActivations(
21278
+ names,
21279
+ runtime.workspaceCwd,
21280
+ state,
21281
+ onCommitted
21282
+ )
21283
+ );
21284
+ return {
21285
+ status: "updated",
21286
+ updated: snapshot.updated,
21287
+ results: names.map((name) => ({
21288
+ name,
21289
+ workspaceActivation: state === "inherit" ? null : state,
21290
+ effectiveActivation: extensionManager.getExtensionActivationForNameFromSnapshot(
21291
+ name,
21292
+ snapshot,
21293
+ runtime.workspaceCwd
21294
+ ).effective
21295
+ }))
21296
+ };
21297
+ },
21298
+ {
21299
+ refreshRuntimes: [runtime],
21300
+ assertGenerationOpen: /* @__PURE__ */ __name(() => runtime.generationGuard?.assertOpen(), "assertGenerationOpen")
21301
+ }
21302
+ );
21303
+ }
21304
+ );
20972
21305
  app.put(
20973
21306
  "/workspaces/:workspace/extensions/:extensionId/activation",
20974
21307
  mutate({ strict: true }),
@@ -21986,6 +22319,7 @@ init_esbuild_shims();
21986
22319
 
21987
22320
  // packages/cli/src/serve/server/telemetry.ts
21988
22321
  init_esbuild_shims();
22322
+ import { performance as performance2 } from "node:perf_hooks";
21989
22323
  var legacySessionTelemetryRoutes = [
21990
22324
  {
21991
22325
  method: "POST",
@@ -22125,6 +22459,18 @@ var legacySessionTelemetryRoutes = [
22125
22459
  attribution: "handler_resolved",
22126
22460
  route: "POST /session/:id/tasks/:taskId/cancel"
22127
22461
  },
22462
+ {
22463
+ method: "POST",
22464
+ path: "/session/:id/goal",
22465
+ attribution: "handler_resolved",
22466
+ route: "POST /session/:id/goal"
22467
+ },
22468
+ {
22469
+ method: "GET",
22470
+ path: "/session/:id/goal",
22471
+ attribution: "handler_resolved",
22472
+ route: "GET /session/:id/goal"
22473
+ },
22128
22474
  {
22129
22475
  method: "POST",
22130
22476
  path: "/session/:id/goal/clear",
@@ -22139,21 +22485,21 @@ var legacySessionTelemetryRoutes = [
22139
22485
  },
22140
22486
  {
22141
22487
  method: "POST",
22142
- path: "/session/:id/media",
22488
+ path: "/session/:id/attachments",
22143
22489
  attribution: "handler_resolved",
22144
- route: "POST /session/:id/media"
22490
+ route: "POST /session/:id/attachments"
22145
22491
  },
22146
22492
  {
22147
22493
  method: "GET",
22148
- path: "/session/:id/media/:mediaId",
22494
+ path: "/session/:id/attachments/:attachmentId",
22149
22495
  attribution: "handler_resolved",
22150
- route: "GET /session/:id/media/:mediaId"
22496
+ route: "GET /session/:id/attachments/:attachmentId"
22151
22497
  },
22152
22498
  {
22153
22499
  method: "DELETE",
22154
- path: "/session/:id/media/:mediaId",
22500
+ path: "/session/:id/attachments/:attachmentId",
22155
22501
  attribution: "handler_resolved",
22156
- route: "DELETE /session/:id/media/:mediaId"
22502
+ route: "DELETE /session/:id/attachments/:attachmentId"
22157
22503
  },
22158
22504
  {
22159
22505
  method: "POST",
@@ -22342,7 +22688,6 @@ var legacySessionTelemetryRoutes = [
22342
22688
  route: "POST /session/:id/a2ui-action"
22343
22689
  }
22344
22690
  ];
22345
- var daemonTelemetryResponseContext = Symbol("daemonTelemetryResponseContext");
22346
22691
  function decodePathSegment(value) {
22347
22692
  try {
22348
22693
  return decodeURIComponent(value);
@@ -22569,8 +22914,34 @@ function resolveDaemonTelemetryRoute(req) {
22569
22914
  return void 0;
22570
22915
  }
22571
22916
  __name(resolveDaemonTelemetryRoute, "resolveDaemonTelemetryRoute");
22917
+ var TRACEPARENT_BREADCRUMB_BURST = 60;
22918
+ var TRACEPARENT_BREADCRUMB_REFILL_PER_SECOND = 2;
22919
+ function daemonInboundTraceIdCaptureMiddleware(req, res, next) {
22920
+ try {
22921
+ const inboundTraceId = extractInboundTraceId(req.headers);
22922
+ if (inboundTraceId !== void 0) {
22923
+ res[daemonInboundTraceIdContext] = inboundTraceId;
22924
+ }
22925
+ } catch {
22926
+ }
22927
+ next();
22928
+ }
22929
+ __name(daemonInboundTraceIdCaptureMiddleware, "daemonInboundTraceIdCaptureMiddleware");
22572
22930
  function daemonTelemetryMiddleware(resolveWorkspaceCwd, recordRequest) {
22573
22931
  const workspaceHashByCwd = /* @__PURE__ */ new Map();
22932
+ let breadcrumbTokens = TRACEPARENT_BREADCRUMB_BURST;
22933
+ let breadcrumbRefillBaseline = performance2.now();
22934
+ const acquireBreadcrumbToken = /* @__PURE__ */ __name(() => {
22935
+ const now = Math.max(performance2.now(), breadcrumbRefillBaseline);
22936
+ breadcrumbTokens = Math.min(
22937
+ TRACEPARENT_BREADCRUMB_BURST,
22938
+ breadcrumbTokens + (now - breadcrumbRefillBaseline) / 1e3 * TRACEPARENT_BREADCRUMB_REFILL_PER_SECOND
22939
+ );
22940
+ breadcrumbRefillBaseline = now;
22941
+ if (breadcrumbTokens < 1) return false;
22942
+ breadcrumbTokens -= 1;
22943
+ return true;
22944
+ }, "acquireBreadcrumbToken");
22574
22945
  const resolveWorkspaceHash = /* @__PURE__ */ __name((workspaceCwd) => {
22575
22946
  const existing = workspaceHashByCwd.get(workspaceCwd);
22576
22947
  if (existing !== void 0) return existing;
@@ -22599,10 +22970,39 @@ function daemonTelemetryMiddleware(resolveWorkspaceCwd, recordRequest) {
22599
22970
  const clientId = rawClientId !== void 0 && rawClientId !== "" && rawClientId.length <= MAX_CLIENT_ID_LENGTH && CLIENT_ID_RE.test(rawClientId) ? rawClientId : void 0;
22600
22971
  const deferredRuntime = getDeferredRuntimeRequestTiming(req);
22601
22972
  const startMs = deferredRuntime?.startedAt.getTime() ?? Date.now();
22973
+ let parentContext;
22974
+ if (isTelemetrySdkInitialized()) {
22975
+ try {
22976
+ parentContext = extractDaemonHttpTraceContext(req.headers);
22977
+ } catch {
22978
+ parentContext = void 0;
22979
+ }
22980
+ try {
22981
+ const inboundTraceparent = req.headers?.["traceparent"];
22982
+ if (!parentContext && typeof inboundTraceparent === "string" && inboundTraceparent.length > 0 && acquireBreadcrumbToken()) {
22983
+ emitDaemonLog(
22984
+ "Rejected invalid inbound traceparent header.",
22985
+ {
22986
+ "http.route": route.route,
22987
+ "http.request.header.traceparent": sanitizeLogText(
22988
+ inboundTraceparent,
22989
+ 128
22990
+ )
22991
+ },
22992
+ {
22993
+ eventName: "qwen-code.daemon.traceparent.invalid",
22994
+ severityNumber: 5
22995
+ // SeverityNumber.DEBUG
22996
+ }
22997
+ );
22998
+ }
22999
+ } catch {
23000
+ }
23001
+ }
22602
23002
  const telemetryRes = res;
22603
23003
  if (route.attribution === "handler_resolved") {
22604
23004
  try {
22605
- telemetryRes[daemonTelemetryResponseContext] = {};
23005
+ telemetryRes[daemonTelemetryResponseContext] ??= {};
22606
23006
  } catch {
22607
23007
  }
22608
23008
  }
@@ -22614,6 +23014,7 @@ function daemonTelemetryMiddleware(resolveWorkspaceCwd, recordRequest) {
22614
23014
  ...sessionId ? { sessionId } : {},
22615
23015
  ...route.permissionRequestId ? { permissionRequestId: route.permissionRequestId } : {},
22616
23016
  ...clientId ? { clientId } : {},
23017
+ ...parentContext ? { parentContext } : {},
22617
23018
  ...deferredRuntime?.waitMs !== void 0 ? {
22618
23019
  startTime: deferredRuntime.startedAt,
22619
23020
  deferredRuntimeWaitMs: deferredRuntime.waitMs,
@@ -23049,10 +23450,27 @@ var PersistedSessionListCache = class {
23049
23450
  }
23050
23451
  };
23051
23452
 
23453
+ // packages/cli/src/serve/server/activity-timestamp.ts
23454
+ init_esbuild_shims();
23455
+ function laterActivityTimestamp(live, persisted) {
23456
+ const liveTime = live === void 0 ? Number.NaN : Date.parse(live);
23457
+ const persistedTime = persisted === void 0 ? Number.NaN : Date.parse(persisted);
23458
+ const liveValid = Number.isFinite(liveTime);
23459
+ const persistedValid = Number.isFinite(persistedTime);
23460
+ if (liveValid && persistedValid) {
23461
+ return liveTime >= persistedTime ? live : persisted;
23462
+ }
23463
+ if (liveValid) return live;
23464
+ if (persistedValid) return persisted;
23465
+ return live ?? persisted;
23466
+ }
23467
+ __name(laterActivityTimestamp, "laterActivityTimestamp");
23468
+
23052
23469
  // packages/cli/src/serve/server/session-list.ts
23053
23470
  var DEFAULT_SESSION_PAGE_SIZE = 20;
23054
23471
  var MAX_SESSION_PAGE_SIZE = 100;
23055
23472
  var MAX_ORGANIZED_SESSIONS = 5e4;
23473
+ var MAX_EMITTED_CURSOR_SESSION_IDS = 64;
23056
23474
  var PERSISTED_SESSION_LIST_CACHE_TTL_MS = 2e3;
23057
23475
  var persistedSessionListCache = new PersistedSessionListCache(
23058
23476
  PERSISTED_SESSION_LIST_CACHE_TTL_MS,
@@ -23087,6 +23505,14 @@ function parseSessionCursor(cursor) {
23087
23505
  return parsed;
23088
23506
  }
23089
23507
  __name(parseSessionCursor, "parseSessionCursor");
23508
+ function parseEmittedSessionIds(value) {
23509
+ if (value === void 0) return [];
23510
+ if (!Array.isArray(value) || value.some((id) => typeof id !== "string" || id.length === 0)) {
23511
+ return void 0;
23512
+ }
23513
+ return value;
23514
+ }
23515
+ __name(parseEmittedSessionIds, "parseEmittedSessionIds");
23090
23516
  function parseOrganizedCursor(cursor, expected) {
23091
23517
  if (cursor === "") return void 0;
23092
23518
  try {
@@ -23096,15 +23522,26 @@ function parseOrganizedCursor(cursor, expected) {
23096
23522
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed) || typeof last !== "object" || last === null || Array.isArray(last) || typeof last.isPinned !== "boolean" || typeof last.activityTime !== "number" || !Number.isFinite(last.activityTime) || typeof last.sessionId !== "string" || last.sessionId.length === 0 || parsed.group !== expected.group || parsed.archiveState !== expected.archiveState || parsed.sourceType !== expected.sourceType || parsed.sourceId !== expected.sourceId) {
23097
23523
  throw new Error("invalid organized cursor");
23098
23524
  }
23099
- return last;
23525
+ const emitted = parseEmittedSessionIds(parsed.emitted);
23526
+ if (emitted === void 0) {
23527
+ throw new Error("invalid organized cursor");
23528
+ }
23529
+ return { last, emitted };
23100
23530
  } catch {
23101
23531
  throw new InvalidCursorError(cursor, "organized");
23102
23532
  }
23103
23533
  }
23104
23534
  __name(parseOrganizedCursor, "parseOrganizedCursor");
23105
- function encodeOrganizedCursor(last, group, archiveState, sourceType, sourceId) {
23535
+ function encodeOrganizedCursor(last, group, archiveState, sourceType, sourceId, emitted = []) {
23106
23536
  return Buffer.from(
23107
- JSON.stringify({ group, archiveState, sourceType, sourceId, last }),
23537
+ JSON.stringify({
23538
+ group,
23539
+ archiveState,
23540
+ sourceType,
23541
+ sourceId,
23542
+ last,
23543
+ ...emitted.length > 0 ? { emitted } : {}
23544
+ }),
23108
23545
  "utf8"
23109
23546
  ).toString("base64url");
23110
23547
  }
@@ -23145,7 +23582,16 @@ function parseMetadataSessionCursor(cursor, expected) {
23145
23582
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed) || typeof last !== "object" || last === null || Array.isArray(last) || typeof last.activityTime !== "number" || !Number.isFinite(last.activityTime) || typeof last.sessionId !== "string" || last.sessionId.length === 0 || parsed.parentSessionId !== expected.parentSessionId || parsed.sourceType !== expected.sourceType || parsed.sourceId !== expected.sourceId || parsed.archiveState !== expected.archiveState) {
23146
23583
  throw new Error("invalid metadata cursor");
23147
23584
  }
23148
- return { activityTime: last.activityTime, sessionId: last.sessionId };
23585
+ const emitted = parseEmittedSessionIds(
23586
+ parsed.emitted
23587
+ );
23588
+ if (emitted === void 0) {
23589
+ throw new Error("invalid metadata cursor");
23590
+ }
23591
+ return {
23592
+ last: { activityTime: last.activityTime, sessionId: last.sessionId },
23593
+ emitted
23594
+ };
23149
23595
  } catch {
23150
23596
  throw new InvalidCursorError(
23151
23597
  cursor,
@@ -23154,9 +23600,14 @@ function parseMetadataSessionCursor(cursor, expected) {
23154
23600
  }
23155
23601
  }
23156
23602
  __name(parseMetadataSessionCursor, "parseMetadataSessionCursor");
23157
- function encodeMetadataSessionCursor(last, filter, archiveState) {
23603
+ function encodeMetadataSessionCursor(last, filter, archiveState, emitted = []) {
23158
23604
  return Buffer.from(
23159
- JSON.stringify({ ...filter, archiveState, last }),
23605
+ JSON.stringify({
23606
+ ...filter,
23607
+ archiveState,
23608
+ last,
23609
+ ...emitted.length > 0 ? { emitted } : {}
23610
+ }),
23160
23611
  "utf8"
23161
23612
  ).toString("base64url");
23162
23613
  }
@@ -23216,7 +23667,7 @@ function mergeLiveSessionSummary(existing, live) {
23216
23667
  parentSessionId: existing.parentSessionId ?? live.parentSessionId,
23217
23668
  sourceType: existing.sourceType ?? live.sourceType,
23218
23669
  sourceId: existing.sourceType !== void 0 ? existing.sourceId : live.sourceId,
23219
- updatedAt: live.updatedAt ?? existing.updatedAt,
23670
+ updatedAt: laterActivityTimestamp(live.updatedAt, existing.updatedAt),
23220
23671
  clientCount: live.clientCount,
23221
23672
  hasActivePrompt: live.hasActivePrompt,
23222
23673
  isArchived: false
@@ -23366,6 +23817,36 @@ function compareOrganizedCursorKeys(a, b) {
23366
23817
  return a.sessionId.localeCompare(b.sessionId);
23367
23818
  }
23368
23819
  __name(compareOrganizedCursorKeys, "compareOrganizedCursorKeys");
23820
+ function nextEmittedSessionIds(options) {
23821
+ const candidates = new Set(options.carried);
23822
+ for (const row of options.page) {
23823
+ if (options.liveSessionIds.has(row.sessionId)) {
23824
+ candidates.add(row.sessionId);
23825
+ }
23826
+ }
23827
+ const kept = [];
23828
+ for (const sessionId of candidates) {
23829
+ const row = options.listedById.get(sessionId);
23830
+ if (!row) {
23831
+ kept.push({ sessionId, persistedTime: Number.NEGATIVE_INFINITY });
23832
+ continue;
23833
+ }
23834
+ const persistedTime = options.persistedTimeById.get(sessionId);
23835
+ if (persistedTime === void 0) {
23836
+ kept.push({ sessionId, persistedTime: Number.NEGATIVE_INFINITY });
23837
+ continue;
23838
+ }
23839
+ if (options.reenters(row, persistedTime)) {
23840
+ kept.push({ sessionId, persistedTime });
23841
+ }
23842
+ }
23843
+ if (kept.length > MAX_EMITTED_CURSOR_SESSION_IDS) {
23844
+ kept.sort((a, b) => a.persistedTime - b.persistedTime);
23845
+ kept.length = MAX_EMITTED_CURSOR_SESSION_IDS;
23846
+ }
23847
+ return kept.map((entry) => entry.sessionId);
23848
+ }
23849
+ __name(nextEmittedSessionIds, "nextEmittedSessionIds");
23369
23850
  function applyOrganization(session, organization) {
23370
23851
  return {
23371
23852
  ...session,
@@ -23392,12 +23873,14 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
23392
23873
  "group"
23393
23874
  );
23394
23875
  }
23395
- const cursorKey = options.cursor !== void 0 ? parseOrganizedCursor(options.cursor, {
23876
+ const cursor = options.cursor !== void 0 ? parseOrganizedCursor(options.cursor, {
23396
23877
  group,
23397
23878
  archiveState,
23398
23879
  sourceType: options.sourceType,
23399
23880
  sourceId: options.sourceId
23400
23881
  }) : void 0;
23882
+ const cursorKey = cursor?.last;
23883
+ const emittedBeforePage = new Set(cursor?.emitted ?? []);
23401
23884
  const isFirstPage = cursorKey === void 0;
23402
23885
  let liveMergeFailed = false;
23403
23886
  const bySessionId = /* @__PURE__ */ new Map();
@@ -23419,10 +23902,18 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
23419
23902
  )
23420
23903
  );
23421
23904
  }
23422
- if (readOptions.mergeLive !== false && archiveState !== "archived" && isFirstPage) {
23905
+ const persistedTimeById = new Map(
23906
+ persisted.sessions.map((session) => [
23907
+ session.sessionId,
23908
+ getSummaryActivityTime(session)
23909
+ ])
23910
+ );
23911
+ const liveSessionIds = /* @__PURE__ */ new Set();
23912
+ if (readOptions.mergeLive !== false && archiveState !== "archived") {
23423
23913
  try {
23424
23914
  const liveSessions = bridge.listWorkspaceSessions(workspaceCwd);
23425
23915
  for (const live of liveSessions) {
23916
+ liveSessionIds.add(live.sessionId);
23426
23917
  const existing = bySessionId.get(live.sessionId);
23427
23918
  const organization = snapshot.sessions.get(live.sessionId);
23428
23919
  if (existing) {
@@ -23434,7 +23925,9 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
23434
23925
  )
23435
23926
  );
23436
23927
  } else if (
23437
- // `listAllPersistedSummaries` already scanned every persisted
23928
+ // A live-only row has no persisted key to page by, so it stays a
23929
+ // first-page-only insertion as before.
23930
+ isFirstPage && // `listAllPersistedSummaries` already scanned every persisted
23438
23931
  // session when the scan wasn't truncated, so a `sessionId` missing
23439
23932
  // from `bySessionId` is definitively new — no disk re-check
23440
23933
  // needed. Re-checking here raced a session that persists its
@@ -23442,9 +23935,9 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
23442
23935
  // above and this point: `existing` stayed undefined but
23443
23936
  // `sessionExists` flipped to true, silently dropping the live
23444
23937
  // session from the response instead of merging it.
23445
- !persisted.truncated || !await (readOptions.signal ? sessionService.sessionExists(live.sessionId, {
23938
+ (!persisted.truncated || !await (readOptions.signal ? sessionService.sessionExists(live.sessionId, {
23446
23939
  signal: readOptions.signal
23447
- }) : sessionService.sessionExists(live.sessionId))
23940
+ }) : sessionService.sessionExists(live.sessionId)))
23448
23941
  ) {
23449
23942
  bySessionId.set(
23450
23943
  live.sessionId,
@@ -23487,19 +23980,52 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
23487
23980
  filtered.sort((a, b) => compareOrganizedSessions(activityTimeById, a, b));
23488
23981
  readOptions.signal?.throwIfAborted();
23489
23982
  const afterCursor = cursorKey === void 0 ? filtered : filtered.filter(
23490
- (session) => compareOrganizedCursorKeys(
23491
- cursorKey,
23492
- getOrganizedCursorKey(activityTimeById, session)
23493
- ) < 0
23983
+ (session) => (
23984
+ // A row already emitted at a live-derived key stays excluded even
23985
+ // if its key regressed behind the cursor (live retirement, or a
23986
+ // live-only row that persisted mid-pass).
23987
+ !emittedBeforePage.has(session.sessionId) && compareOrganizedCursorKeys(
23988
+ cursorKey,
23989
+ getOrganizedCursorKey(activityTimeById, session)
23990
+ ) < 0
23991
+ )
23494
23992
  );
23495
23993
  const page = afterCursor.slice(0, pageSize);
23496
- const nextCursor = page.length < afterCursor.length ? encodeOrganizedCursor(
23497
- getOrganizedCursorKey(activityTimeById, page[page.length - 1]),
23498
- group,
23499
- archiveState,
23500
- options.sourceType,
23501
- options.sourceId
23502
- ) : void 0;
23994
+ let nextCursor;
23995
+ if (page.length < afterCursor.length) {
23996
+ const boundary = getOrganizedCursorKey(
23997
+ activityTimeById,
23998
+ page[page.length - 1]
23999
+ );
24000
+ const emitted = nextEmittedSessionIds({
24001
+ carried: emittedBeforePage,
24002
+ page,
24003
+ liveSessionIds,
24004
+ listedById: new Map(
24005
+ filtered.map((session) => [session.sessionId, session])
24006
+ ),
24007
+ persistedTimeById,
24008
+ // `isPinned` is re-read from the organization snapshot on every page
24009
+ // request, so a pin flip between fetches can move the persisted key
24010
+ // across the pinned/unpinned blocks. Keep the identity while the key
24011
+ // could re-enter under either state.
24012
+ reenters: /* @__PURE__ */ __name((row, persistedTime) => [true, false].some(
24013
+ (isPinned) => compareOrganizedCursorKeys(boundary, {
24014
+ isPinned,
24015
+ activityTime: persistedTime,
24016
+ sessionId: row.sessionId
24017
+ }) < 0
24018
+ ), "reenters")
24019
+ });
24020
+ nextCursor = encodeOrganizedCursor(
24021
+ boundary,
24022
+ group,
24023
+ archiveState,
24024
+ options.sourceType,
24025
+ options.sourceId,
24026
+ emitted
24027
+ );
24028
+ }
23503
24029
  return {
23504
24030
  sessions: page,
23505
24031
  ...nextCursor !== void 0 ? { nextCursor } : {},
@@ -23524,10 +24050,18 @@ async function listWorkspaceSessionsByMetadataForResponse(bridge, workspaceCwd,
23524
24050
  for (const session of persisted.sessions) {
23525
24051
  bySessionId.set(session.sessionId, clonePersistedSummary(session));
23526
24052
  }
24053
+ const persistedTimeById = new Map(
24054
+ persisted.sessions.map((session) => [
24055
+ session.sessionId,
24056
+ getSummaryActivityTime(session)
24057
+ ])
24058
+ );
24059
+ const liveSessionIds = /* @__PURE__ */ new Set();
23527
24060
  let liveMergeFailed = false;
23528
24061
  if (readOptions.mergeLive !== false && archiveState !== "archived") {
23529
24062
  try {
23530
24063
  for (const live of bridge.listWorkspaceSessions(workspaceCwd)) {
24064
+ liveSessionIds.add(live.sessionId);
23531
24065
  const existing = bySessionId.get(live.sessionId);
23532
24066
  if (existing) {
23533
24067
  bySessionId.set(
@@ -23569,22 +24103,46 @@ async function listWorkspaceSessionsByMetadataForResponse(bridge, workspaceCwd,
23569
24103
  )
23570
24104
  );
23571
24105
  readOptions.signal?.throwIfAborted();
23572
- const cursorKey = options.cursor !== void 0 && options.cursor !== "" ? parseMetadataSessionCursor(options.cursor, {
24106
+ const cursor = options.cursor !== void 0 && options.cursor !== "" ? parseMetadataSessionCursor(options.cursor, {
23573
24107
  ...filter,
23574
24108
  archiveState
23575
24109
  }) : void 0;
24110
+ const cursorKey = cursor?.last;
24111
+ const emittedBeforePage = new Set(cursor?.emitted ?? []);
23576
24112
  const afterCursor = cursorKey === void 0 ? matches : matches.filter(
23577
- (session) => compareLiveSessionCursorKeys(
23578
- cursorKey,
23579
- getLiveSessionCursorKey(session)
23580
- ) < 0
24113
+ (session) => (
24114
+ // See the organized path: exclude rows already emitted at a
24115
+ // live-derived key whose key regressed behind the cursor.
24116
+ !emittedBeforePage.has(session.sessionId) && compareLiveSessionCursorKeys(
24117
+ cursorKey,
24118
+ getLiveSessionCursorKey(session)
24119
+ ) < 0
24120
+ )
23581
24121
  );
23582
24122
  const page = afterCursor.slice(0, pageSize);
23583
- const nextCursor = page.length < afterCursor.length ? encodeMetadataSessionCursor(
23584
- getLiveSessionCursorKey(page[page.length - 1]),
23585
- filter,
23586
- archiveState
23587
- ) : void 0;
24123
+ let nextCursor;
24124
+ if (page.length < afterCursor.length) {
24125
+ const boundary = getLiveSessionCursorKey(page[page.length - 1]);
24126
+ const emitted = nextEmittedSessionIds({
24127
+ carried: emittedBeforePage,
24128
+ page,
24129
+ liveSessionIds,
24130
+ listedById: new Map(
24131
+ matches.map((session) => [session.sessionId, session])
24132
+ ),
24133
+ persistedTimeById,
24134
+ reenters: /* @__PURE__ */ __name((row, persistedTime) => compareLiveSessionCursorKeys(boundary, {
24135
+ activityTime: persistedTime,
24136
+ sessionId: row.sessionId
24137
+ }) < 0, "reenters")
24138
+ });
24139
+ nextCursor = encodeMetadataSessionCursor(
24140
+ boundary,
24141
+ filter,
24142
+ archiveState,
24143
+ emitted
24144
+ );
24145
+ }
23588
24146
  return {
23589
24147
  sessions: page,
23590
24148
  ...nextCursor !== void 0 ? { nextCursor } : {},
@@ -24688,20 +25246,33 @@ function parseMediaContentBlock(block) {
24688
25246
  const record = block;
24689
25247
  const type = record["type"];
24690
25248
  const data = record["data"];
24691
- const mediaId = record["mediaId"];
25249
+ const attachmentId = record["attachmentId"];
24692
25250
  const mimeType = record["mimeType"];
24693
25251
  const size = record["size"];
24694
25252
  const inline = typeof data === "string" && data.length > 0;
24695
- const reference = typeof mediaId === "string" && mediaId.length > 0 && typeof size === "number" && Number.isSafeInteger(size) && size > 0;
24696
- if (type !== "image" || inline === reference || typeof mimeType !== "string" || !mimeType.startsWith(`${type}/`)) {
25253
+ const reference = typeof attachmentId === "string" && attachmentId.length > 0 && typeof size === "number" && Number.isSafeInteger(size) && size >= 0 && (type !== "image" || size > 0);
25254
+ if (type === "resource" && !reference) {
25255
+ const resource = record["resource"];
25256
+ if (typeof resource !== "object" || resource === null) {
25257
+ return { valid: false, code: "invalid-shape" };
25258
+ }
25259
+ const value = resource;
25260
+ const hasText = typeof value["text"] === "string";
25261
+ const hasBlob = typeof value["blob"] === "string";
25262
+ if (typeof value["uri"] !== "string" || value["uri"].length === 0 || hasText === hasBlob) {
25263
+ return { valid: false, code: "invalid-shape" };
25264
+ }
25265
+ return { valid: true, block };
25266
+ }
25267
+ if (type !== "image" && type !== "resource" || (type === "image" ? inline === reference : inline || !reference) || typeof mimeType !== "string" || type === "image" && !mimeType.startsWith("image/")) {
24697
25268
  return { valid: false, code: "invalid-shape" };
24698
25269
  }
24699
- if (isSvgMimeType(mimeType)) {
25270
+ if (type === "image" && isSvgMimeType(mimeType)) {
24700
25271
  return { valid: false, code: "svg" };
24701
25272
  }
24702
25273
  return {
24703
25274
  valid: true,
24704
- block: inline ? { type, data, mimeType } : { type, mediaId, mimeType, size }
25275
+ block: inline ? { type, data, mimeType } : { type, attachmentId, mimeType, size }
24705
25276
  };
24706
25277
  }
24707
25278
  __name(parseMediaContentBlock, "parseMediaContentBlock");
@@ -24712,7 +25283,7 @@ function mediaBlockParseError(code, entryLabel) {
24712
25283
  if (code === "svg") {
24713
25284
  return "SVG images are not supported";
24714
25285
  }
24715
- return `each ${entryLabel} must be an image block with either \`data\`, or \`mediaId\` and \`size\`, plus a matching \`mimeType\``;
25286
+ return `each ${entryLabel} must be an inline content block or carry \`attachmentId\`, \`size\`, and \`mimeType\``;
24716
25287
  }
24717
25288
  __name(mediaBlockParseError, "mediaBlockParseError");
24718
25289
  var PRIMARY_ONLY_LIVE_SESSION_ROUTES = ["POST /session/:id/cd"];
@@ -25300,7 +25871,7 @@ function registerSessionRoutes(app, deps) {
25300
25871
  }
25301
25872
  const metadata = await readLoadableLiveConversationMetadata(
25302
25873
  sessionId,
25303
- (candidateId) => service.readCreationMetadata(candidateId)
25874
+ service
25304
25875
  );
25305
25876
  if (!metadata) throw new SessionNotFoundError(sessionId);
25306
25877
  }
@@ -25624,10 +26195,7 @@ function registerSessionRoutes(app, deps) {
25624
26195
  if (location !== "active") return false;
25625
26196
  if (!isInternalWorkspaceRuntime(runtime)) return true;
25626
26197
  const service = createWorkspaceRuntimeSessionService(runtime);
25627
- return await readLoadableLiveConversationMetadata(
25628
- sessionId,
25629
- (candidateId) => service.readCreationMetadata(candidateId)
25630
- ) !== void 0;
26198
+ return await readLoadableLiveConversationMetadata(sessionId, service) !== void 0;
25631
26199
  }, "activeInRuntime");
25632
26200
  const throwMissingActiveTranscript = /* @__PURE__ */ __name(() => {
25633
26201
  if (hasCursor) {
@@ -25823,7 +26391,7 @@ function registerSessionRoutes(app, deps) {
25823
26391
  if (!exists) continue;
25824
26392
  const metadata = await readLoadableLiveConversationMetadata(
25825
26393
  sessionId,
25826
- (candidateId) => service.readCreationMetadata(candidateId)
26394
+ service
25827
26395
  );
25828
26396
  if (!assertCurrentInternalGeneration(entry, generation, res)) {
25829
26397
  return void 0;
@@ -25910,7 +26478,7 @@ function registerSessionRoutes(app, deps) {
25910
26478
  if (!exists) continue;
25911
26479
  const metadata = await readLoadableLiveConversationMetadata(
25912
26480
  sessionId,
25913
- (candidateId) => service.readCreationMetadata(candidateId)
26481
+ service
25914
26482
  );
25915
26483
  if (!assertCurrentInternalGeneration(entry, generation2, res)) {
25916
26484
  return void 0;
@@ -25964,7 +26532,7 @@ function registerSessionRoutes(app, deps) {
25964
26532
  }
25965
26533
  const metadata = await readLoadableLiveConversationMetadata(
25966
26534
  sessionId,
25967
- (candidateId) => service.readCreationMetadata(candidateId)
26535
+ service
25968
26536
  );
25969
26537
  if (!metadata) {
25970
26538
  throw new SessionNotFoundError(sessionId);
@@ -26164,6 +26732,15 @@ function registerSessionRoutes(app, deps) {
26164
26732
  }
26165
26733
  const approvalMode = parseOptionalApprovalMode(body, res);
26166
26734
  if (approvalMode === null) return;
26735
+ if (isReservedStandaloneSessionSource({
26736
+ sourceType: typeof body["sourceType"] === "string" ? body["sourceType"] : void 0
26737
+ })) {
26738
+ res.status(400).json({
26739
+ error: "The requested session source is reserved for daemon-owned standalone sessions.",
26740
+ code: "reserved_session_source"
26741
+ });
26742
+ return;
26743
+ }
26167
26744
  const source = parseSessionSource(body["sourceType"], body["sourceId"]);
26168
26745
  if ("error" in source) {
26169
26746
  res.status(400).json({
@@ -26734,24 +27311,54 @@ function registerSessionRoutes(app, deps) {
26734
27311
  throw error2;
26735
27312
  }
26736
27313
  }
27314
+ let restoredStorageSessionId = sessionId;
26737
27315
  try {
27316
+ const guardSessionService = createWorkspaceRuntimeSessionService(runtime);
27317
+ try {
27318
+ await guardSessionService.findSessionIdIgnoringCase(sessionId);
27319
+ } catch (error2) {
27320
+ if (error2 instanceof SessionIdCaseConflictError && await guardSessionService.getSessionLocation(
27321
+ error2.candidateSessionId ?? sessionId
27322
+ ) === "conflict") {
27323
+ throw new SessionConflictError(sessionId);
27324
+ }
27325
+ throw error2;
27326
+ }
26738
27327
  const session = await archiveCoordinator.runSharedMany(
26739
27328
  [sessionId],
26740
27329
  async () => {
27330
+ const sessionService = createWorkspaceRuntimeSessionService(runtime);
27331
+ let persistedSessionId;
27332
+ try {
27333
+ persistedSessionId = await sessionService.findSessionIdIgnoringCase(sessionId);
27334
+ } catch (error2) {
27335
+ if (error2 instanceof SessionIdCaseConflictError && await sessionService.getSessionLocation(
27336
+ error2.candidateSessionId ?? sessionId
27337
+ ) === "conflict") {
27338
+ throw new SessionConflictError(sessionId);
27339
+ }
27340
+ throw error2;
27341
+ }
27342
+ if (persistedSessionId) {
27343
+ restoredStorageSessionId = persistedSessionId;
27344
+ } else if (isInternalWorkspaceRuntime(runtime)) {
27345
+ throw new SessionNotFoundError(sessionId);
27346
+ }
26741
27347
  const location = await assertSessionLoadable(
26742
27348
  workspaceCwd,
26743
- sessionId,
27349
+ restoredStorageSessionId,
26744
27350
  runtime.sessionRuntimeBaseDir
26745
27351
  );
26746
27352
  if (location === void 0 && isInternalWorkspaceRuntime(runtime)) {
26747
27353
  throw new SessionNotFoundError(sessionId);
26748
27354
  }
26749
- const sessionService = createWorkspaceRuntimeSessionService(runtime);
26750
27355
  const metadata = runtime.provenance === "live-conversation" ? await readLoadableLiveConversationMetadata(
26751
- sessionId,
26752
- (candidateId) => sessionService.readCreationMetadata(candidateId)
26753
- ) : await sessionService.readCreationMetadata(sessionId);
26754
- if (metadata === void 0) {
27356
+ restoredStorageSessionId,
27357
+ sessionService
27358
+ ) : await sessionService.readCreationMetadata(
27359
+ restoredStorageSessionId
27360
+ );
27361
+ if (metadata === void 0 || isInternalWorkspaceRuntime(runtime) && isReservedStandaloneSessionSource(metadata)) {
26755
27362
  throw new SessionNotFoundError(sessionId);
26756
27363
  }
26757
27364
  assertRuntimeGenerationOpen?.();
@@ -26843,7 +27450,19 @@ function registerSessionRoutes(app, deps) {
26843
27450
  throw error2;
26844
27451
  }
26845
27452
  }
26846
- return restored;
27453
+ if (action === "load" && !restored.attached && !restored.hasActivePrompt && runtime.provenance !== "live-conversation") {
27454
+ try {
27455
+ await reconcileDanglingPromptTerminals(
27456
+ sessionService,
27457
+ sessionId
27458
+ );
27459
+ } catch {
27460
+ }
27461
+ }
27462
+ return withPromptTerminals(
27463
+ restored,
27464
+ action === "load" ? readRecentPromptTerminals(sessionService, sessionId) : void 0
27465
+ );
26847
27466
  }
26848
27467
  );
26849
27468
  try {
@@ -26878,7 +27497,7 @@ function registerSessionRoutes(app, deps) {
26878
27497
  const sidecar = await readWorktreeSession(
26879
27498
  createWorkspaceRuntimeSessionService(
26880
27499
  runtime
26881
- ).getWorktreeSessionPath(sessionId)
27500
+ ).getWorktreeSessionPath(restoredStorageSessionId)
26882
27501
  ).catch(() => null);
26883
27502
  if (sidecar) {
26884
27503
  let realTarget;
@@ -27713,6 +28332,42 @@ function registerSessionRoutes(app, deps) {
27713
28332
  }
27714
28333
  )
27715
28334
  );
28335
+ app.post(
28336
+ "/session/:id/goal",
28337
+ mutate({ strict: true }),
28338
+ withOwnerMutableSession(
28339
+ "POST /session/:id/goal",
28340
+ async (req, res, sessionId, runtime) => {
28341
+ const request2 = parseGoalControlRequest(safeBody(req));
28342
+ if (!request2) {
28343
+ res.status(400).json({
28344
+ error: "Invalid Goal control request",
28345
+ code: "invalid_goal_control_request"
28346
+ });
28347
+ return;
28348
+ }
28349
+ const clientId = parseClientIdHeader(req, res);
28350
+ if (clientId === null) return;
28351
+ res.status(200).json(
28352
+ await runtime.bridge.controlSessionGoal(
28353
+ sessionId,
28354
+ request2,
28355
+ clientId === void 0 ? void 0 : { clientId }
28356
+ )
28357
+ );
28358
+ }
28359
+ )
28360
+ );
28361
+ app.get(
28362
+ "/session/:id/goal",
28363
+ withOwnerReadSession(
28364
+ "GET /session/:id/goal",
28365
+ async (_req, res, sessionId, runtime) => {
28366
+ const goal = await runtime.bridge.getSessionGoal(sessionId);
28367
+ res.status(200).json({ snapshot: goal.snapshot });
28368
+ }
28369
+ )
28370
+ );
27716
28371
  app.post(
27717
28372
  "/session/:id/goal/clear",
27718
28373
  mutate({ strict: true }),
@@ -27748,9 +28403,9 @@ function registerSessionRoutes(app, deps) {
27748
28403
  )
27749
28404
  );
27750
28405
  app.post(
27751
- "/session/:id/media",
28406
+ "/session/:id/attachments",
27752
28407
  mutate(),
27753
- import_express4.default.raw({ type: "image/*", limit: "8mb" }),
28408
+ import_express4.default.raw({ type: "*/*", limit: "8mb" }),
27754
28409
  (error2, _req, res, next) => {
27755
28410
  if (error2 && typeof error2 === "object" && "status" in error2 && error2.status === 413) {
27756
28411
  res.status(413).json({ error: "Request body too large (max 8 MiB)" });
@@ -27759,27 +28414,35 @@ function registerSessionRoutes(app, deps) {
27759
28414
  next(error2);
27760
28415
  },
27761
28416
  withOwnerMutableSession(
27762
- "POST /session/:id/media",
28417
+ "POST /session/:id/attachments",
27763
28418
  async (req, res, sessionId, runtime) => {
28419
+ const name = req.query["name"];
27764
28420
  const contentType = req.headers["content-type"]?.split(";", 1)[0]?.trim().toLowerCase();
27765
- if (isSvgMimeType(contentType)) {
27766
- res.status(415).json({ error: "SVG uploads are not supported" });
27767
- return;
27768
- }
27769
- if (!contentType || !contentType.startsWith("image/") || !Buffer.isBuffer(req.body) || req.body.byteLength === 0) {
28421
+ if (typeof name !== "string" || !contentType || !Buffer.isBuffer(req.body)) {
27770
28422
  res.status(400).json({
27771
- error: "request body must contain image/* bytes with a matching Content-Type"
28423
+ error: "request body, Content-Type, and name query parameter are required"
27772
28424
  });
27773
28425
  return;
27774
28426
  }
27775
28427
  const clientId = parseClientIdHeader(req, res);
27776
28428
  if (clientId === null) return;
28429
+ if (req.body.length === 0 && [
28430
+ "image/bmp",
28431
+ "image/gif",
28432
+ "image/jpeg",
28433
+ "image/png",
28434
+ "image/webp"
28435
+ ].includes(contentType)) {
28436
+ res.status(400).json({ error: "Image attachments cannot be empty" });
28437
+ return;
28438
+ }
27777
28439
  try {
27778
- const reference = await runtime.bridge.storeSessionMedia(
28440
+ const reference = await runtime.bridge.storeSessionAttachment(
27779
28441
  sessionId,
27780
28442
  req.body,
27781
28443
  contentType,
27782
- clientId !== void 0 ? { clientId } : void 0
28444
+ clientId !== void 0 ? { clientId } : void 0,
28445
+ name
27783
28446
  );
27784
28447
  res.status(201).json(reference);
27785
28448
  } catch (error2) {
@@ -27787,57 +28450,61 @@ function registerSessionRoutes(app, deps) {
27787
28450
  res.status(413).json({ error: error2.message });
27788
28451
  return;
27789
28452
  }
28453
+ if (error2 instanceof TypeError) {
28454
+ res.status(400).json({ error: error2.message });
28455
+ return;
28456
+ }
27790
28457
  throw error2;
27791
28458
  }
27792
28459
  }
27793
28460
  )
27794
28461
  );
27795
28462
  app.get(
27796
- "/session/:id/media/:mediaId",
28463
+ "/session/:id/attachments/:attachmentId",
27797
28464
  withOwnerReadSession(
27798
- "GET /session/:id/media/:mediaId",
28465
+ "GET /session/:id/attachments/:attachmentId",
27799
28466
  async (req, res, sessionId, runtime) => {
27800
- const mediaId = req.params["mediaId"];
27801
- if (!mediaId) {
27802
- res.status(400).json({ error: "`mediaId` is required" });
28467
+ const attachmentId = req.params["attachmentId"];
28468
+ if (!attachmentId) {
28469
+ res.status(400).json({ error: "`attachmentId` is required" });
27803
28470
  return;
27804
28471
  }
27805
28472
  const clientId = parseClientIdHeader(req, res);
27806
28473
  if (clientId === null) return;
27807
- const media = await runtime.bridge.readSessionMedia(
28474
+ const attachment = await runtime.bridge.readSessionAttachment(
27808
28475
  sessionId,
27809
- mediaId,
28476
+ attachmentId,
27810
28477
  clientId !== void 0 ? { clientId } : void 0
27811
28478
  );
27812
- if (!media) {
27813
- res.status(404).json({ error: "session media not found" });
28479
+ if (!attachment) {
28480
+ res.status(404).json({ error: "session attachment not found" });
27814
28481
  return;
27815
28482
  }
27816
- res.setHeader("Content-Type", media.mimeType);
27817
- res.setHeader("Content-Length", String(media.data.byteLength));
28483
+ res.setHeader("Content-Type", attachment.mimeType);
28484
+ res.setHeader("Content-Length", String(attachment.data.byteLength));
27818
28485
  res.setHeader("Cache-Control", "private, max-age=300");
27819
28486
  res.setHeader("Content-Disposition", "attachment");
27820
28487
  res.setHeader("X-Content-Type-Options", "nosniff");
27821
- res.status(200).send(media.data);
28488
+ res.status(200).send(attachment.data);
27822
28489
  }
27823
28490
  )
27824
28491
  );
27825
28492
  app.delete(
27826
- "/session/:id/media/:mediaId",
28493
+ "/session/:id/attachments/:attachmentId",
27827
28494
  mutate(),
27828
28495
  withOwnerMutableSession(
27829
- "DELETE /session/:id/media/:mediaId",
28496
+ "DELETE /session/:id/attachments/:attachmentId",
27830
28497
  async (req, res, sessionId, runtime) => {
27831
- const mediaId = req.params["mediaId"];
27832
- if (!mediaId) {
27833
- res.status(400).json({ error: "`mediaId` is required" });
28498
+ const attachmentId = req.params["attachmentId"];
28499
+ if (!attachmentId) {
28500
+ res.status(400).json({ error: "`attachmentId` is required" });
27834
28501
  return;
27835
28502
  }
27836
28503
  const clientId = parseClientIdHeader(req, res);
27837
28504
  if (clientId === null) return;
27838
- const removed = await runtime.bridge.removeSessionMedia(
28505
+ const removed = await runtime.bridge.removeSessionAttachment(
27839
28506
  sessionId,
27840
- mediaId,
28507
+ attachmentId,
27841
28508
  clientId !== void 0 ? { clientId } : void 0
27842
28509
  );
27843
28510
  res.status(200).json({ removed });
@@ -29031,7 +29698,11 @@ function registerSessionRoutes(app, deps) {
29031
29698
  clientCount: session.clientCount,
29032
29699
  hasActivePrompt: session.hasActivePrompt,
29033
29700
  isWaitingForPermission: session.isWaitingForPermission ?? false,
29034
- isWaitingForUserQuestion: session.isWaitingForUserQuestion ?? false
29701
+ isWaitingForUserQuestion: session.isWaitingForUserQuestion ?? false,
29702
+ // Bridge-local activity watermark, absent until a running prompt in
29703
+ // this bridge publishes its first terminal. Reading it costs nothing
29704
+ // extra: the summary is already in memory.
29705
+ ...session.updatedAt !== void 0 ? { updatedAt: session.updatedAt } : {}
29035
29706
  }));
29036
29707
  assertRuntimeOpen?.();
29037
29708
  lastExposedCatalogVersions.set(bridge, catalogVersion);
@@ -29261,7 +29932,10 @@ function registerSessionRoutes(app, deps) {
29261
29932
  trimmed,
29262
29933
  clientId !== void 0 ? { clientId } : void 0,
29263
29934
  typeof messageId === "string" ? messageId : void 0,
29264
- mediaBlocks ? { content: mediaBlocks } : void 0
29935
+ {
29936
+ rejectIfIdle: true,
29937
+ ...mediaBlocks ? { content: mediaBlocks } : {}
29938
+ }
29265
29939
  );
29266
29940
  res.status(200).json(result);
29267
29941
  }
@@ -30696,15 +31370,17 @@ function registerGoalsRoutes(app, deps) {
30696
31370
  continue;
30697
31371
  }
30698
31372
  const { session, goal } = outcome.value;
30699
- if (!goal.active) continue;
31373
+ const record = goal.snapshot.goal;
31374
+ if (!record || record.status === "complete") continue;
30700
31375
  goals.push({
30701
31376
  sessionId: session.sessionId,
30702
31377
  displayName: session.displayName ?? null,
30703
- condition: goal.active.condition,
30704
- iterations: goal.active.iterations,
30705
- setAt: goal.active.setAt,
30706
- ...goal.active.lastReason !== void 0 ? { lastReason: goal.active.lastReason } : {},
30707
- hasActivePrompt: session.hasActivePrompt
31378
+ condition: record.objective,
31379
+ iterations: record.turnCount,
31380
+ setAt: record.createdAt,
31381
+ ...record.lastReason !== void 0 ? { lastReason: record.lastReason } : {},
31382
+ hasActivePrompt: session.hasActivePrompt,
31383
+ snapshot: goal.snapshot
30708
31384
  });
30709
31385
  }
30710
31386
  if (dropped.length > 0) {
@@ -32492,7 +33168,7 @@ __name(registerWorkspaceQualifiedSettingsRoutes, "registerWorkspaceQualifiedSett
32492
33168
  // packages/cli/src/serve/routes/sse-events.ts
32493
33169
  init_esbuild_shims();
32494
33170
  import { randomUUID as randomUUID8 } from "node:crypto";
32495
- import { performance as performance2 } from "node:perf_hooks";
33171
+ import { performance as performance3 } from "node:perf_hooks";
32496
33172
 
32497
33173
  // packages/cli/src/serve/server/error-response.ts
32498
33174
  init_esbuild_shims();
@@ -32609,8 +33285,8 @@ function sendBridgeError(res, err, ctx, daemonLog) {
32609
33285
  return;
32610
33286
  }
32611
33287
  if (sendGenerationClosedError(res, err)) return;
32612
- if (err instanceof Error && "code" in err && (err.code === "session_media_gone" || err.code === "invalid_session_media_reference")) {
32613
- res.status(err.code === "session_media_gone" ? 410 : 400).json({ error: err.message, code: err.code });
33288
+ if (err instanceof Error && "code" in err && (err.code === "session_attachment_gone" || err.code === "invalid_session_attachment_reference")) {
33289
+ res.status(err.code === "session_attachment_gone" ? 410 : 400).json({ error: err.message, code: err.code });
32614
33290
  return;
32615
33291
  }
32616
33292
  if (err instanceof SessionWriterError) {
@@ -32777,6 +33453,14 @@ function sendBridgeError(res, err, ctx, daemonLog) {
32777
33453
  });
32778
33454
  return;
32779
33455
  }
33456
+ if (err instanceof SessionIdCaseConflictError) {
33457
+ res.status(409).json({
33458
+ error: err.message,
33459
+ code: "session_conflict",
33460
+ sessionId: err.sessionId
33461
+ });
33462
+ return;
33463
+ }
32780
33464
  if (err instanceof SessionArchivingError) {
32781
33465
  res.set("Retry-After", "5");
32782
33466
  res.status(409).json({
@@ -32938,6 +33622,22 @@ function sendBridgeError(res, err, ctx, daemonLog) {
32938
33622
  });
32939
33623
  return;
32940
33624
  }
33625
+ if (kind === "untrusted_workspace") {
33626
+ res.status(403).json({
33627
+ error: errorMessage2(err),
33628
+ code: kind
33629
+ });
33630
+ return;
33631
+ }
33632
+ if (kind === "goal_conflict" || kind === "goal_invalid_transition" || kind === "goal_persist_failed") {
33633
+ const d = data;
33634
+ res.status(kind === "goal_persist_failed" ? 500 : 409).json({
33635
+ error: errorMessage2(err),
33636
+ code: kind,
33637
+ ...d.current !== void 0 ? { current: d.current } : {}
33638
+ });
33639
+ return;
33640
+ }
32941
33641
  if (kind === "branch_point_invalid") {
32942
33642
  res.status(409).json({
32943
33643
  error: errorMessage2(err),
@@ -33377,7 +34077,7 @@ function registerSseEventsRoutes(app, deps) {
33377
34077
  });
33378
34078
  return;
33379
34079
  }
33380
- const openedAt = performance2.now();
34080
+ const openedAt = performance3.now();
33381
34081
  let closeReason;
33382
34082
  let terminalCandidate;
33383
34083
  let terminalEventType;
@@ -33396,10 +34096,10 @@ function registerSseEventsRoutes(app, deps) {
33396
34096
  if (activeDrainStartedAt !== void 0) {
33397
34097
  maxDrainWaitMs = Math.max(
33398
34098
  maxDrainWaitMs,
33399
- performance2.now() - activeDrainStartedAt
34099
+ performance3.now() - activeDrainStartedAt
33400
34100
  );
33401
34101
  }
33402
- const durationMs = Math.max(0, performance2.now() - openedAt);
34102
+ const durationMs = Math.max(0, performance3.now() - openedAt);
33403
34103
  const resolvedCloseReason = closeReason ?? terminalCandidate ?? "client_disconnect";
33404
34104
  const closeAttributes = {
33405
34105
  "qwen-code.daemon.sse.duration_ms": durationMs,
@@ -33508,7 +34208,7 @@ function registerSseEventsRoutes(app, deps) {
33508
34208
  if (activeDrainStartedAt === void 0) return;
33509
34209
  maxDrainWaitMs = Math.max(
33510
34210
  maxDrainWaitMs,
33511
- performance2.now() - activeDrainStartedAt
34211
+ performance3.now() - activeDrainStartedAt
33512
34212
  );
33513
34213
  activeDrainStartedAt = void 0;
33514
34214
  }, "settleDrainMeasurement");
@@ -33531,7 +34231,7 @@ function registerSseEventsRoutes(app, deps) {
33531
34231
  return;
33532
34232
  }
33533
34233
  backpressureCount += 1;
33534
- activeDrainStartedAt = performance2.now();
34234
+ activeDrainStartedAt = performance3.now();
33535
34235
  const onDrain = /* @__PURE__ */ __name(() => {
33536
34236
  res.off("close", onClose);
33537
34237
  res.off("error", onError);
@@ -34571,7 +35271,14 @@ __name(setupDeviceFlowRegistry, "setupDeviceFlowRegistry");
34571
35271
  init_esbuild_shims();
34572
35272
  var import_express5 = __toESM(require_express(), 1);
34573
35273
  function installJsonBodyParser(app) {
34574
- app.use(import_express5.default.json({ limit: "10mb" }));
35274
+ const parseJson = import_express5.default.json({ limit: "10mb" });
35275
+ app.use((req, res, next) => {
35276
+ if (req.method === "POST" && /^\/session\/[^/]+\/attachments\/?$/i.test(req.path)) {
35277
+ next();
35278
+ return;
35279
+ }
35280
+ parseJson(req, res, next);
35281
+ });
34575
35282
  app.use((err, _req, res, next) => {
34576
35283
  if (sendJsonBodyParserError(res, err)) return;
34577
35284
  next(err);
@@ -45605,7 +46312,10 @@ var LiveTaskService = class {
45605
46312
  cwd: located.summary.workspaceCwd,
45606
46313
  createdAt: epochSeconds(located.summary.createdAt),
45607
46314
  updatedAt: epochSeconds(
45608
- located.summary.updatedAt ?? located.persisted?.conversation.lastUpdated
46315
+ laterActivityTimestamp(
46316
+ located.summary.updatedAt,
46317
+ located.persisted?.conversation.lastUpdated
46318
+ )
45609
46319
  )
45610
46320
  },
45611
46321
  page: {
@@ -45744,7 +46454,10 @@ var LiveTaskService = class {
45744
46454
  ),
45745
46455
  eventId: task.runtime.bridge.getSessionLastEventId(target.threadId)
45746
46456
  } : {},
45747
- updatedAt: task.summary.updatedAt ?? task.persisted?.conversation.lastUpdated
46457
+ updatedAt: laterActivityTimestamp(
46458
+ task.summary.updatedAt,
46459
+ task.persisted?.conversation.lastUpdated
46460
+ )
45748
46461
  });
45749
46462
  const { reset: cursorReset } = decodeCursor(
45750
46463
  target.afterCursor,
@@ -45758,7 +46471,10 @@ var LiveTaskService = class {
45758
46471
  const completedAt = latestTurnRecords.at(-1)?.timestamp ?? task.persisted?.conversation.lastUpdated;
45759
46472
  const failed = task.summary.hasTurnError === true;
45760
46473
  const revision = task.summary.clientCount > 0 ? task.runtime.bridge.getSessionLastEventId(target.threadId) : epochSeconds(
45761
- task.summary.updatedAt ?? task.persisted?.conversation.lastUpdated ?? task.summary.createdAt
46474
+ laterActivityTimestamp(
46475
+ task.summary.updatedAt,
46476
+ task.persisted?.conversation.lastUpdated
46477
+ ) ?? task.summary.createdAt
45762
46478
  );
45763
46479
  return {
45764
46480
  schemaVersion: 1,
@@ -45910,7 +46626,7 @@ var LiveTaskService = class {
45910
46626
  const service = createWorkspaceRuntimeSessionService(task.runtime);
45911
46627
  const metadata = task.runtime.provenance === "live-conversation" ? await readLoadableLiveConversationMetadata(
45912
46628
  task.summary.sessionId,
45913
- (sessionId) => service.readCreationMetadata(sessionId)
46629
+ service
45914
46630
  ) : await service.readCreationMetadata(task.summary.sessionId);
45915
46631
  if (metadata === void 0) {
45916
46632
  throw new SessionNotFoundError(task.summary.sessionId);
@@ -46882,6 +47598,10 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
46882
47598
  }) : void 0;
46883
47599
  const defaultSessionOwnerIndex = !injectedWorkspaceRegistry ? createWorkspaceSessionOwnerIndex() : void 0;
46884
47600
  const bridge = injectedWorkspaceRegistry?.primary.bridge ?? deps.bridge ?? createAcpSessionBridge({
47601
+ sessionAttachmentsRoot: path18.join(
47602
+ new Storage(boundWorkspace).getProjectTempDir(),
47603
+ "attachments"
47604
+ ),
46885
47605
  maxSessions: opts.maxSessions,
46886
47606
  ...totalSessionAdmission ? { freshSessionAdmission: totalSessionAdmission.admit } : {},
46887
47607
  ...defaultSessionOwnerIndex ? {
@@ -47411,6 +48131,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
47411
48131
  healthRoutes.register(app);
47412
48132
  }
47413
48133
  installAccessLogMiddleware(app, daemonLog);
48134
+ app.use(daemonInboundTraceIdCaptureMiddleware);
47414
48135
  const webShellDir = opts.serveWebShell !== false ? deps.webShellDir : void 0;
47415
48136
  const webShellFrameAncestors = opts.allowOrigins && opts.allowOrigins.length > 0 ? [...parseAllowOriginPatterns(opts.allowOrigins).origins].filter(
47416
48137
  (o) => o.startsWith("chrome-extension://") || o.startsWith("moz-extension://")