@qwen-code/qwen-code 0.22.2-preview.1 → 0.22.2

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 (379) hide show
  1. package/bundled/goal-draft/SKILL.md +109 -0
  2. package/bundled/qc-helper/docs/configuration/settings.md +10 -10
  3. package/bundled/qc-helper/docs/features/_meta.ts +1 -0
  4. package/bundled/qc-helper/docs/features/commands.md +2 -1
  5. package/bundled/qc-helper/docs/features/goals.md +58 -0
  6. package/bundled/qc-helper/docs/features/headless.md +13 -11
  7. package/bundled/qc-helper/docs/features/status-line.md +3 -3
  8. package/chunks/MaxSizedBox-X5FZSNAJ.js +112 -0
  9. package/chunks/{StandaloneSessionPicker-5D2L22SF.js → StandaloneSessionPicker-AVLI6VJP.js} +76 -76
  10. package/chunks/{acpAgent-4DCKLA32.js → acpAgent-MXEAN54C.js} +969 -255
  11. package/chunks/{agent-B4AFZL6H.js → agent-PJIPDWHB.js} +41 -41
  12. package/chunks/agent-headless-B4JVD7UK.js +87 -0
  13. package/chunks/{anthropicContentGenerator-U76GTVB6.js → anthropicContentGenerator-HGMBACVE.js} +7 -7
  14. package/chunks/{artifact-tool-XDJCZZCF.js → artifact-tool-5YT4QF7Y.js} +2 -2
  15. package/chunks/{askUserQuestion-ZXXERLEV.js → askUserQuestion-4SWJY65V.js} +2 -2
  16. package/chunks/bridge-FKZTVIS3.js +121 -0
  17. package/chunks/{channel-management-service-HXXS3HOZ.js → channel-management-service-X4AZ6IXX.js} +1 -1
  18. package/chunks/channel-settings-store-4UFCLBBG.js +117 -0
  19. package/chunks/{channel-worker-group-EVDC2P4K.js → channel-worker-group-27HMGD5S.js} +7 -6
  20. package/chunks/{channel-worker-manager-IJJZHGEI.js → channel-worker-manager-QEGX646Z.js} +9 -7
  21. package/chunks/{channel-worker-supervisor-YSKB5GVB.js → channel-worker-supervisor-UEW2WWCC.js} +5 -4
  22. package/chunks/{chunk-7QGEJI7M.js → chunk-23RFD54N.js} +1 -1
  23. package/chunks/{chunk-QR4AHMGQ.js → chunk-2K6ORIHJ.js} +13 -13
  24. package/chunks/{chunk-3D6PDLNJ.js → chunk-2NYCN6F2.js} +11 -11
  25. package/chunks/chunk-2TNL5KPM.js +49 -0
  26. package/chunks/{chunk-ZEADBZLO.js → chunk-3AFMQUTI.js} +3 -3
  27. package/chunks/{chunk-JSY43GMI.js → chunk-3DXFGHAJ.js} +185 -174
  28. package/chunks/{chunk-T45CL2NT.js → chunk-3FDFA4MZ.js} +3 -3
  29. package/chunks/{chunk-WBT3STGU.js → chunk-3I6UTTDX.js} +1 -1
  30. package/chunks/{chunk-FVDQ5E67.js → chunk-3JGZSIDA.js} +3 -3
  31. package/chunks/{chunk-J3CBIEDS.js → chunk-3SGB2UHX.js} +15 -10
  32. package/chunks/{chunk-77TOMRBG.js → chunk-43GGFFLY.js} +3 -3
  33. package/chunks/{chunk-ZJG323IA.js → chunk-43UYNAWX.js} +6 -4
  34. package/chunks/{chunk-NEZZHGEI.js → chunk-4CDSK5AZ.js} +6 -6
  35. package/chunks/chunk-4CMJKUND.js +95 -0
  36. package/chunks/{chunk-EB4VDXNI.js → chunk-4FTKQNWJ.js} +1 -1
  37. package/chunks/{chunk-PAJGKZAA.js → chunk-4HV6HH33.js} +10 -8
  38. package/chunks/{chunk-BQBUZDDH.js → chunk-4J657AJR.js} +3 -3
  39. package/chunks/{chunk-XMSMTU6H.js → chunk-4JWNNLPT.js} +4 -4
  40. package/chunks/{chunk-ALTQLFEG.js → chunk-4MQEPP3Y.js} +9 -84
  41. package/chunks/{chunk-3JKUX4PB.js → chunk-5O72BNDD.js} +8 -8
  42. package/chunks/{chunk-IKN3IUJP.js → chunk-5XBFCMWD.js} +2 -2
  43. package/chunks/{chunk-2YDYDDE2.js → chunk-66KDY3LV.js} +3 -3
  44. package/chunks/{chunk-VOEMVOM4.js → chunk-6CGL7E7G.js} +2 -2
  45. package/chunks/{chunk-SLEWBQWM.js → chunk-6DIGWMGT.js} +2 -2
  46. package/chunks/{chunk-SKNVVYIJ.js → chunk-6IUNAPLR.js} +3 -3
  47. package/chunks/{chunk-BHTJAO36.js → chunk-6LFJEACX.js} +4 -4
  48. package/chunks/{chunk-AP7WZONS.js → chunk-6LFTG244.js} +8 -8
  49. package/chunks/{chunk-PVBT5QPD.js → chunk-6PJOTWAN.js} +1 -1
  50. package/chunks/{chunk-5CMWFBML.js → chunk-77RG5SFQ.js} +1 -1
  51. package/chunks/{chunk-SDVF6A42.js → chunk-7DJCPZE3.js} +3 -3
  52. package/chunks/{chunk-ELY4QVIB.js → chunk-7EQQR46F.js} +1 -1
  53. package/chunks/{chunk-H3HZ4AWW.js → chunk-7UYV53BC.js} +1 -1
  54. package/chunks/{chunk-FCSWZAS3.js → chunk-A7YP63XN.js} +4 -4
  55. package/chunks/{chunk-E4I5MVBR.js → chunk-ABS25QER.js} +1 -1
  56. package/chunks/{chunk-WZ3QKPMQ.js → chunk-AGR5UROZ.js} +5 -5
  57. package/chunks/{chunk-5T4LWWNX.js → chunk-B7CDU2SL.js} +2 -2
  58. package/chunks/{chunk-HPECDZ6X.js → chunk-BAJKAAOY.js} +68 -64
  59. package/chunks/{chunk-WXDZZFH3.js → chunk-BBWV7ONL.js} +3 -3
  60. package/chunks/{chunk-4TPAG3O7.js → chunk-BFPESSTR.js} +1 -1
  61. package/chunks/{chunk-DID6IRGC.js → chunk-BNMF3K5X.js} +20 -19
  62. package/chunks/{chunk-IPQA4SR5.js → chunk-BWORX6FA.js} +1 -1
  63. package/chunks/{chunk-BKDAF7ES.js → chunk-BXDAPVQU.js} +2 -2
  64. package/chunks/{chunk-IOGKXPL3.js → chunk-C6K43ZDE.js} +4 -4
  65. package/chunks/{chunk-7OBH4AM2.js → chunk-CAJTKR6W.js} +5 -5
  66. package/chunks/{chunk-SUE2ZMUH.js → chunk-CCBZDVUA.js} +30 -25
  67. package/chunks/{chunk-U45D46O5.js → chunk-CMHFCLBU.js} +1 -1
  68. package/chunks/{chunk-AWFZDYSD.js → chunk-CPGJJJLU.js} +1 -1
  69. package/chunks/{chunk-LRKMQPMD.js → chunk-CQH5KTKC.js} +1 -1
  70. package/chunks/{chunk-3WBMPR3S.js → chunk-CSMI4FP5.js} +1 -1
  71. package/chunks/{chunk-JECO75XD.js → chunk-D5LUXLUH.js} +2 -2
  72. package/chunks/{chunk-UWICO5KN.js → chunk-DZWPESIF.js} +3 -3
  73. package/chunks/{chunk-I6DY753S.js → chunk-EFUM7RVY.js} +2 -2
  74. package/chunks/{chunk-3UZCLCXR.js → chunk-EKSCLBBF.js} +3 -3
  75. package/chunks/{chunk-LJP2BBMK.js → chunk-EOGELB3H.js} +4 -4
  76. package/chunks/{chunk-624NHDGB.js → chunk-ERFDKH32.js} +11 -0
  77. package/chunks/{chunk-GTUZ3R6I.js → chunk-F5SZP77N.js} +310 -78
  78. package/chunks/{chunk-SQPOJ4ZI.js → chunk-F6FV3C5K.js} +12 -7
  79. package/chunks/{chunk-TDQBVEPK.js → chunk-F7TNAPZ4.js} +9 -7
  80. package/chunks/{chunk-F7M6ZFGU.js → chunk-FBSSIAAQ.js} +6 -6
  81. package/chunks/{chunk-2FN2HNTI.js → chunk-FDY5RMGH.js} +2 -2
  82. package/chunks/{chunk-PTQF7WRA.js → chunk-FY76G3G5.js} +5 -5
  83. package/chunks/{chunk-X3XGCJ32.js → chunk-G34IR3D6.js} +9 -9
  84. package/chunks/{chunk-ZWKGZB2K.js → chunk-H2WDGQ6D.js} +3 -3
  85. package/chunks/chunk-H72BQNM3.js +645 -0
  86. package/chunks/{chunk-ILPXSKGQ.js → chunk-HVEYF6VT.js} +2 -2
  87. package/chunks/{chunk-5JCZ3UKB.js → chunk-HVQ3B7FF.js} +2 -2
  88. package/chunks/{chunk-VBF4KZRQ.js → chunk-IJKTMLBE.js} +1 -1
  89. package/chunks/{chunk-R7G7GKOX.js → chunk-IK5BW3CS.js} +2 -2
  90. package/chunks/{chunk-UCQOSV6A.js → chunk-IOPCFOTF.js} +3 -3
  91. package/chunks/{chunk-O3BUXIPM.js → chunk-IZIVM7LZ.js} +3 -3
  92. package/chunks/{chunk-I6VVOZDK.js → chunk-J2OSJFP3.js} +2 -2
  93. package/chunks/{chunk-AYVIGUUK.js → chunk-JB4JIVTJ.js} +1 -1
  94. package/chunks/{chunk-76WGY6LW.js → chunk-JCQD3INC.js} +3 -3
  95. package/chunks/{chunk-XUX6O2ZT.js → chunk-JHS74YAB.js} +4 -1
  96. package/chunks/{chunk-KPF2K55D.js → chunk-JSC3H3TD.js} +27 -4
  97. package/chunks/{chunk-CZFQ62RM.js → chunk-JSHHYW6T.js} +4 -4
  98. package/chunks/{chunk-MCKJTBZN.js → chunk-JU4EEXC7.js} +2 -2
  99. package/chunks/{chunk-T6OODF2U.js → chunk-JWALNCLT.js} +1 -1
  100. package/chunks/{chunk-CDUN63IN.js → chunk-K2NQPH5D.js} +3 -3
  101. package/chunks/{chunk-7UJTY5V3.js → chunk-KEKZFOL6.js} +1 -1
  102. package/chunks/{chunk-5URK47RN.js → chunk-KUX5D6DK.js} +1197 -336
  103. package/chunks/{chunk-OF2DPXUS.js → chunk-L2M46FP5.js} +116 -21
  104. package/chunks/{chunk-6US7BF3G.js → chunk-L6BZRIUL.js} +2 -2
  105. package/chunks/{chunk-TR7G7XFQ.js → chunk-L6YT5H34.js} +4 -4
  106. package/chunks/{chunk-W2WRNJKX.js → chunk-LDP5OD6N.js} +5 -5
  107. package/chunks/{chunk-OLS3MAXQ.js → chunk-LXIBMVRN.js} +7 -7
  108. package/chunks/{chunk-GNMJNDZE.js → chunk-M6FOJXW3.js} +1 -1
  109. package/chunks/{chunk-J5352S3S.js → chunk-MIIVI25Q.js} +3 -3
  110. package/chunks/{chunk-K3LPAED5.js → chunk-MQM5PJML.js} +24 -4
  111. package/chunks/{chunk-27ONXAFY.js → chunk-NIFYWDYN.js} +1 -1
  112. package/chunks/{chunk-IJVDHPKD.js → chunk-NU7RKEZR.js} +2 -2
  113. package/chunks/{chunk-LWLEPXKK.js → chunk-O2UN57NX.js} +2 -2
  114. package/chunks/{chunk-5SM2AK65.js → chunk-OIP7C4FE.js} +5 -5
  115. package/chunks/{chunk-UCSV2IZW.js → chunk-OIVXBW3W.js} +3 -3
  116. package/chunks/{chunk-TOF4UZHH.js → chunk-P2SU6ZTI.js} +3 -3
  117. package/chunks/{chunk-JLU3FPQR.js → chunk-P5GGM4KS.js} +5 -5
  118. package/chunks/{chunk-ZKAZP2ZG.js → chunk-PDMJ3KGS.js} +2 -2
  119. package/chunks/{chunk-RRKNX553.js → chunk-PDQGMSZK.js} +1 -1
  120. package/chunks/{chunk-KQYW2GB5.js → chunk-PFCQ62V4.js} +5 -5
  121. package/chunks/{chunk-JLGFGPZJ.js → chunk-PKAYJDB3.js} +2 -2
  122. package/chunks/{chunk-GTUKW3I6.js → chunk-PPKZ7JOE.js} +1 -1
  123. package/chunks/{chunk-HABT2Z7R.js → chunk-Q26AYA62.js} +4 -4
  124. package/chunks/{chunk-WEGXPP5E.js → chunk-QFCDF5PL.js} +1 -1
  125. package/chunks/{chunk-R3T33BG5.js → chunk-QP4C6WCE.js} +3 -3
  126. package/chunks/{chunk-Z6L3C4VF.js → chunk-R4PMVSR5.js} +27 -25
  127. package/chunks/{chunk-AKQA3WCH.js → chunk-RIEFGNTP.js} +579 -3419
  128. package/chunks/{chunk-ATLGYSYH.js → chunk-RJC5EIKY.js} +4 -4
  129. package/chunks/chunk-RKFGE7JH.js +93 -0
  130. package/chunks/{chunk-CPPYZHBN.js → chunk-RU7BK6B3.js} +1 -1
  131. package/chunks/{chunk-VYWCFWI5.js → chunk-RUGNCYNO.js} +11 -633
  132. package/chunks/{chunk-ZLTEQYNC.js → chunk-SFPGAQUL.js} +2 -2
  133. package/chunks/{chunk-TMGAS5TO.js → chunk-SJ3ZUWFK.js} +26 -4
  134. package/chunks/{chunk-DEYPMJPD.js → chunk-SMPR7SPO.js} +1 -1
  135. package/chunks/{chunk-7CWEZQ6T.js → chunk-STUJ7IMZ.js} +0 -77
  136. package/chunks/{chunk-BPMVPWBT.js → chunk-T32W2JHI.js} +6 -6
  137. package/chunks/chunk-T3WXYEZ4.js +304 -0
  138. package/chunks/{chunk-XIRDDFRS.js → chunk-TGWAQ5RB.js} +695 -294
  139. package/chunks/{chunk-EC5BONC3.js → chunk-TPI7O7HR.js} +1 -1
  140. package/chunks/{chunk-OI2DR6QB.js → chunk-TRZTNIQ6.js} +2 -2
  141. package/chunks/{chunk-T2CRBIDJ.js → chunk-TTX2JUE6.js} +1 -1
  142. package/chunks/{chunk-2NNTE2ED.js → chunk-UHQFIS7N.js} +15 -0
  143. package/chunks/{chunk-KOJ6MHD5.js → chunk-UTLCH2FK.js} +1 -1
  144. package/chunks/{chunk-7DPKPBOQ.js → chunk-V2NDP3I4.js} +2 -2
  145. package/chunks/{chunk-ZGWDHSUM.js → chunk-V4QXXQJ2.js} +3 -3
  146. package/chunks/{chunk-XR7OIAQF.js → chunk-V5J4J5TP.js} +2 -2
  147. package/chunks/{chunk-X2UOOG5V.js → chunk-VQUGEVGR.js} +1 -1
  148. package/chunks/{chunk-XJS54K4A.js → chunk-VTHREBQM.js} +2 -2
  149. package/chunks/{chunk-V3GINY6K.js → chunk-VVW4ZNFY.js} +3 -3
  150. package/chunks/{chunk-66GIFJ63.js → chunk-W5MJJ2V7.js} +1 -1
  151. package/chunks/{chunk-FPH6TXD3.js → chunk-WAOIHTJS.js} +1 -1
  152. package/chunks/{chunk-FN5C6C7G.js → chunk-WKK5BQNP.js} +151 -60
  153. package/chunks/chunk-XDFHY4R3.js +1584 -0
  154. package/chunks/{chunk-L436XFLJ.js → chunk-XDLEZ5HX.js} +1 -1
  155. package/chunks/{chunk-VL4YX3FH.js → chunk-XF63PKEN.js} +1 -1
  156. package/chunks/{chunk-3FSBMAYD.js → chunk-XQFT3QUF.js} +1 -1
  157. package/chunks/{chunk-2MHGD7EE.js → chunk-XRSOI3DL.js} +1 -1
  158. package/chunks/{chunk-FJWICLG7.js → chunk-Y3QL45LS.js} +1 -1
  159. package/chunks/{chunk-TFV4RXPU.js → chunk-Y6LSMB6J.js} +1 -1
  160. package/chunks/{chunk-2SERYG4T.js → chunk-YTDVNSUQ.js} +1 -1
  161. package/chunks/{chunk-AA7VBRBG.js → chunk-Z7FLBQPR.js} +7 -7
  162. package/chunks/{chunk-4K44OMLI.js → chunk-Z7TGYN5F.js} +3 -3
  163. package/chunks/{chunk-FJAITR4L.js → chunk-ZFKOCECU.js} +2 -2
  164. package/chunks/chunk-ZGXYO7DY.js +3416 -0
  165. package/chunks/{chunk-OT4YKUUV.js → chunk-ZU4UDIWX.js} +2 -2
  166. package/chunks/config-utils-BBOCOGZW.js +113 -0
  167. package/chunks/contextCommand-EET67MQ2.js +108 -0
  168. package/chunks/{core-runtime-CEJRHCRF.js → core-runtime-677KFX6Q.js} +53 -53
  169. package/chunks/{create-sub-session-RVHSWVAP.js → create-sub-session-23ITIELI.js} +3 -3
  170. package/chunks/{create-sub-session-DFZVIG56.js → create-sub-session-JKZAYZX7.js} +160 -79
  171. package/chunks/{cron-create-IJGVR5R2.js → cron-create-KJ4IY6PP.js} +57 -10
  172. package/chunks/{cron-delete-4N5BI6GL.js → cron-delete-MBLQCAYY.js} +4 -4
  173. package/chunks/{cron-list-2CATIPUX.js → cron-list-DWH2PQ47.js} +4 -4
  174. package/chunks/{daemon-NAYK4XXU.js → daemon-MJQUO7RA.js} +28 -1
  175. package/chunks/{daemon-git-worktree-guard-L6ZUFKF7.js → daemon-git-worktree-guard-6MVAAZZZ.js} +53 -53
  176. package/chunks/daemon-status-provider-RFKZOK3S.js +119 -0
  177. package/chunks/daemon-trust-policy-DRZPFB4Q.js +114 -0
  178. package/chunks/{daemon-trust-policy-monitor-2G3EKQEU.js → daemon-trust-policy-monitor-B5U6TQX5.js} +59 -59
  179. package/chunks/deferred-core-runtime-BBVIOP24.js +116 -0
  180. package/chunks/{display-image-6KHQNEAE.js → display-image-BE7I6ZB6.js} +5 -5
  181. package/chunks/{dist-FVJZSIO4.js → dist-ILDBUWDB.js} +71 -19
  182. package/chunks/{dist-6H6RZ5H6.js → dist-QODVOVWI.js} +58 -35
  183. package/chunks/earlyInputCapture-2JOMMNQ4.js +109 -0
  184. package/chunks/{edit-ZERGX3RV.js → edit-BSV6YRVW.js} +42 -42
  185. package/chunks/{en-6MDBWMTG.js → en-YLXBXM4Z.js} +2 -1
  186. package/chunks/{enter-worktree-UOZ6ZTP7.js → enter-worktree-MQXFFPKM.js} +7 -7
  187. package/chunks/{enterPlanMode-W2RP3P5B.js → enterPlanMode-PKNF35FE.js} +41 -41
  188. package/chunks/{environment-ZBJ23YVR.js → environment-MOZMPUHR.js} +55 -55
  189. package/chunks/errors-DMPQVYJL.js +115 -0
  190. package/chunks/{exit-worktree-G2QATUCV.js → exit-worktree-L344UY7K.js} +7 -7
  191. package/chunks/{exitPlanMode-VFJ5R5DD.js → exitPlanMode-UE4FGCY4.js} +41 -41
  192. package/chunks/{fast-path-4MWBCEUF.js → fast-path-773PV7PU.js} +5 -5
  193. package/chunks/{gemini-X5GQHQYF.js → gemini-IP4FJAP5.js} +101 -100
  194. package/chunks/{geminiContentGenerator-UDSWXZXL.js → geminiContentGenerator-PUNEBWJW.js} +8 -8
  195. package/chunks/{glob-DKTNG32L.js → glob-CZHOWUEA.js} +41 -41
  196. package/chunks/{goal-tools-CNVXMSZD.js → goal-tools-YZQJXTGH.js} +9 -8
  197. package/chunks/{grep-3NLSS32D.js → grep-5GPICQBU.js} +6 -6
  198. package/chunks/handleAutoUpdate-SGXKTQM6.js +111 -0
  199. package/chunks/{i18n-KX7FEKJJ.js → i18n-B42HKHKH.js} +54 -54
  200. package/chunks/{image-gen-63NN2H5N.js → image-gen-HAYOEQ4O.js} +9 -9
  201. package/chunks/initializer-FB66WYR3.js +115 -0
  202. package/chunks/installationInfo-Y7AULNMX.js +109 -0
  203. package/chunks/{keychain-token-storage-3MGFRYGM.js → keychain-token-storage-37XPR34V.js} +2 -2
  204. package/chunks/list-2HWGSVRA.js +118 -0
  205. package/chunks/{list-agents-EXRSHIDJ.js → list-agents-DI3YFTDT.js} +2 -2
  206. package/chunks/loadedSettingsAdapter-7Y7IEI6T.js +112 -0
  207. package/chunks/{loggingContentGenerator-73C7TKDK.js → loggingContentGenerator-2GGZNGLG.js} +35 -22
  208. package/chunks/{loop-wakeup-XBPB2BRO.js → loop-wakeup-XJFONSQ7.js} +5 -5
  209. package/chunks/{ls-WFONAND2.js → ls-3VAT2J7A.js} +4 -4
  210. package/chunks/{lsp-DUKPDUXN.js → lsp-5W7IRUBH.js} +2 -2
  211. package/chunks/{managed-npm-update-H2KOLQZU.js → managed-npm-update-5TEV2E3J.js} +54 -54
  212. package/chunks/mcp-QGG5NMJJ.js +112 -0
  213. package/chunks/{monitor-TGCMNJJH.js → monitor-FI7PY36Z.js} +41 -41
  214. package/chunks/nonInteractiveCli-4LO2TL72.js +186 -0
  215. package/chunks/{notebook-edit-YEUNZYDX.js → notebook-edit-TPGMGBST.js} +42 -42
  216. package/chunks/{openaiContentGenerator-J7LD4VSL.js → openaiContentGenerator-SUCYANUZ.js} +24 -24
  217. package/chunks/pidfile-JMF2CLMY.js +113 -0
  218. package/chunks/{processUtils-ZHFC7CSL.js → processUtils-IQZBYWSB.js} +2 -2
  219. package/chunks/prompt-terminal-ledger-DCZO6S7C.js +107 -0
  220. package/chunks/{qwenContentGenerator-YEWWK3JQ.js → qwenContentGenerator-J4TXFGJT.js} +46 -46
  221. package/chunks/{qwenOAuth2-JIYAWXTW.js → qwenOAuth2-RF33DNZW.js} +8 -8
  222. package/chunks/{read-file-ZQI3WPVK.js → read-file-QE2B5FTX.js} +12 -12
  223. package/chunks/{read-mcp-resource-7A7NFSFL.js → read-mcp-resource-XD257PGJ.js} +2 -2
  224. package/chunks/{record-artifact-CPJ4IJSD.js → record-artifact-RZGZBENU.js} +4 -4
  225. package/chunks/{report-findings-VFM5DENC.js → report-findings-Q3SYKKW5.js} +5 -5
  226. package/chunks/{request-shutdown-6IW46GD7.js → request-shutdown-BCLA3JV2.js} +7 -7
  227. package/chunks/resumeHistoryUtils-CZ4JRDVW.js +120 -0
  228. package/chunks/{ripGrep-46N4FLOS.js → ripGrep-R6B6HWPX.js} +17 -17
  229. package/chunks/{run-qwen-serve-WHWU7NZ6.js → run-qwen-serve-TPHZMSXJ.js} +148 -319
  230. package/chunks/{runtime-E7BSPWQP.js → runtime-TTIGSBM4.js} +62 -62
  231. package/chunks/scheduled-tasks-QB4ZVUQS.js +129 -0
  232. package/chunks/{scheduler-TJPATFOM.js → scheduler-YRUG22M7.js} +55 -55
  233. package/chunks/{sdk-exporters-http-XXSKBD2C.js → sdk-exporters-http-KCJ4ZFG7.js} +2 -2
  234. package/chunks/{sdk-impl-VPNBLV7I.js → sdk-impl-HLSEDAEP.js} +4 -4
  235. package/chunks/{send-message-OXZK6USO.js → send-message-Y5I6NYAM.js} +7 -7
  236. package/chunks/serve-MXXCDAQN.js +120 -0
  237. package/chunks/{server-AXCN7QBJ.js → server-DFUSSSHI.js} +19760 -19444
  238. package/chunks/{session-HO4US3AG.js → session-3TEHNENZ.js} +100 -99
  239. package/chunks/{settings-B2PFJJN4.js → settings-VOZYKLTT.js} +58 -58
  240. package/chunks/{shell-7XMSANI3.js → shell-6RTKZVMI.js} +41 -41
  241. package/chunks/{skill-NL3VH562.js → skill-FEOKFX26.js} +18 -18
  242. package/chunks/{skill-settings-SKMN5YXC.js → skill-settings-VA4XVYVL.js} +58 -58
  243. package/chunks/spawnChannel-F6WVP723.js +114 -0
  244. package/chunks/{standalone-update-XOCWGXAH.js → standalone-update-RGILUQVK.js} +55 -55
  245. package/chunks/{startInteractiveUI-G2XKSCQ7.js → startInteractiveUI-WHJPFOGH.js} +2757 -2223
  246. package/chunks/{syntheticOutput-5AJ444QT.js → syntheticOutput-ML43GEFN.js} +3 -3
  247. package/chunks/{task-create-TY7P6UHG.js → task-create-TMSV7RD5.js} +11 -11
  248. package/chunks/{task-list-BELMPA75.js → task-list-W55RBFRX.js} +5 -5
  249. package/chunks/{task-stop-U3S3KZG2.js → task-stop-CXEH5L2D.js} +2 -2
  250. package/chunks/{task-update-O4IGDPCK.js → task-update-N536I4GQ.js} +11 -11
  251. package/chunks/{team-create-IYBUOORE.js → team-create-QYSWCYCL.js} +41 -41
  252. package/chunks/{team-delete-YWFXX77L.js → team-delete-FJRFX33M.js} +5 -5
  253. package/chunks/{team-plan-approval-YKU57LBM.js → team-plan-approval-P7DAD644.js} +41 -41
  254. package/chunks/{terminal-image-renderer-NREKYTAD.js → terminal-image-renderer-SMQE46UJ.js} +55 -55
  255. package/chunks/theme-manager-RFO5WWFF.js +104 -0
  256. package/chunks/{todoWrite-435EO2CS.js → todoWrite-WDJNQEMW.js} +43 -25
  257. package/chunks/{tool-search-4Q3KASIQ.js → tool-search-F2EMIAPV.js} +17 -17
  258. package/chunks/total-session-admission-HTVTP4BS.js +116 -0
  259. package/chunks/{trustedFolders-OILZCHRD.js → trustedFolders-7OCNMUQE.js} +54 -54
  260. package/chunks/{update-relaunch-4DC2KKFS.js → update-relaunch-4GF3OXMB.js} +5 -5
  261. package/chunks/{updateCheck-AK4COHNK.js → updateCheck-7QBDXZRT.js} +56 -56
  262. package/chunks/useAutoAcceptIndicator-UI4SNL2O.js +122 -0
  263. package/chunks/{validateNonInterActiveAuth-YAE4YPO3.js → validateNonInterActiveAuth-BPPA563H.js} +96 -95
  264. package/chunks/{version-QFP7OGWX.js → version-ANP4TS6O.js} +1 -1
  265. package/chunks/{web-fetch-6T23IK6Q.js → web-fetch-QJADSAH3.js} +16 -16
  266. package/chunks/{web-search-WBWTCZK2.js → web-search-7TTQKEKM.js} +9 -9
  267. package/chunks/{workflow-FMAA3D4R.js → workflow-5XN6XSOT.js} +105 -60
  268. package/chunks/workspace-providers-status-PDFZWL5Q.js +116 -0
  269. package/chunks/{workspace-registration-store-CMMX7EPX.js → workspace-registration-store-XKVW2YVH.js} +1 -1
  270. package/chunks/{workspace-registry-WJLZPRTG.js → workspace-registry-23R7XRB5.js} +61 -59
  271. package/chunks/workspace-service-MUYO2QIC.js +131 -0
  272. package/chunks/workspace-skills-status-IKECTOOQ.js +115 -0
  273. package/chunks/{workspace-trust-reconciler-PJDQUTJL.js → workspace-trust-reconciler-KLGOB53D.js} +67 -65
  274. package/chunks/write-file-GGRBB5TZ.js +90 -0
  275. package/chunks/{zh-TW-MV4FWFB6.js → zh-TW-RPTMRTHG.js} +2 -1
  276. package/chunks/{zh-X3WGU6SI.js → zh-UNY63FR3.js} +2 -1
  277. package/chunks/{zoom-image-WVYVFRXF.js → zoom-image-6ASG6J4C.js} +12 -12
  278. package/cli.js +14 -14
  279. package/locales/en.js +2 -0
  280. package/locales/zh-TW.js +2 -0
  281. package/locales/zh.js +2 -0
  282. package/package.json +3 -3
  283. package/web-shell/assets/{abnfDiagram-VCTEODGH-d-8xa8uz.js → abnfDiagram-VCTEODGH-uS-vtfs3.js} +1 -1
  284. package/web-shell/assets/{arc-BhB7CrGK.js → arc-BSTnk5pu.js} +1 -1
  285. package/web-shell/assets/{architectureDiagram-5GKGNRK7-BDCd_IcJ.js → architectureDiagram-5GKGNRK7-DCMyiqzy.js} +1 -1
  286. package/web-shell/assets/{blockDiagram-NRAW4CY4-C-AHu6mi.js → blockDiagram-NRAW4CY4-C7_gt0r1.js} +1 -1
  287. package/web-shell/assets/{c4Diagram-UCG6FXSJ-CFjQt0vl.js → c4Diagram-UCG6FXSJ-BeQg2L8B.js} +1 -1
  288. package/web-shell/assets/channel-CENAhErJ.js +1 -0
  289. package/web-shell/assets/{chunk-2Q5K7J3B-DRjwqaDq.js → chunk-2Q5K7J3B-DnV9bKBe.js} +1 -1
  290. package/web-shell/assets/{chunk-5VM5RSS4-eHM9noJE.js → chunk-5VM5RSS4-rT1GAcT7.js} +1 -1
  291. package/web-shell/assets/{chunk-F27PBJKO-CcSWUYn1.js → chunk-F27PBJKO-BcgSxqGA.js} +1 -1
  292. package/web-shell/assets/{chunk-G27WJ6UU-DNr-RF5S.js → chunk-G27WJ6UU-Bw1ZhyZq.js} +1 -1
  293. package/web-shell/assets/{chunk-JWPE2WC7-rVJHoNF8.js → chunk-JWPE2WC7-D4iDw-96.js} +1 -1
  294. package/web-shell/assets/{chunk-LCL6LL3I-B2aX0Gzy.js → chunk-LCL6LL3I-D3MB3GTZ.js} +1 -1
  295. package/web-shell/assets/{chunk-POPQ4Y6H-DVp07n32.js → chunk-POPQ4Y6H-Cep2ndrS.js} +1 -1
  296. package/web-shell/assets/{chunk-SVP7TREG-C6QB_KUr.js → chunk-SVP7TREG-BuahMHJc.js} +1 -1
  297. package/web-shell/assets/{chunk-XXDRQBXY-CLVxDNCy.js → chunk-XXDRQBXY-BdujIvJY.js} +1 -1
  298. package/web-shell/assets/classDiagram-DTDB5LWJ-CM6FArGH.js +1 -0
  299. package/web-shell/assets/classDiagram-v2-JRS7N3AN-CM6FArGH.js +1 -0
  300. package/web-shell/assets/{cose-bilkent-JH36ORCC-B_aKX3A3.js → cose-bilkent-JH36ORCC-CGLLUbF8.js} +1 -1
  301. package/web-shell/assets/{cynefin-OW5HDTMX-BBw2pPUa.js → cynefin-OW5HDTMX-D6kDsRSh.js} +1 -1
  302. package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-WWPiBTwk.js → cynefinDiagram-5FMLGOSQ-CCy78qZx.js} +1 -1
  303. package/web-shell/assets/{dagre-3AP2YEHR-CPtIdka-.js → dagre-3AP2YEHR-D5gJuJsf.js} +1 -1
  304. package/web-shell/assets/{diagram-S7CK7UJ4-Dj5og1Xi.js → diagram-S7CK7UJ4-ZwEZ5W__.js} +1 -1
  305. package/web-shell/assets/{diagram-UQ7AKVKN-CC_x70YC.js → diagram-UQ7AKVKN-B036APjv.js} +1 -1
  306. package/web-shell/assets/{diagram-VSXAHHWV-rXMfsO4n.js → diagram-VSXAHHWV-BfDJ57Fq.js} +1 -1
  307. package/web-shell/assets/{diagram-VX7I27RA-DEmLYQbh.js → diagram-VX7I27RA-Wha0p5rT.js} +1 -1
  308. package/web-shell/assets/{diagram-Z3DM3KII-B0ys6Vxx.js → diagram-Z3DM3KII-L20bz2K1.js} +1 -1
  309. package/web-shell/assets/{ebnfDiagram-PWID7BFC-Bq6y6lKH.js → ebnfDiagram-PWID7BFC-D1ZM0Cp7.js} +1 -1
  310. package/web-shell/assets/{erDiagram-SSCWMZ5O-l69JeBZ4.js → erDiagram-SSCWMZ5O-CMtA19v8.js} +1 -1
  311. package/web-shell/assets/{flowDiagram-A5DVABFB-Cm-EzGY4.js → flowDiagram-A5DVABFB-D96m326S.js} +1 -1
  312. package/web-shell/assets/{ganttDiagram-EL5Y4UJY-BRS9ZOp7.js → ganttDiagram-EL5Y4UJY-BuHiYG2o.js} +1 -1
  313. package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-DAMRKgLk.js → gitGraphDiagram-WWUBYQGX-Ck3NmkSw.js} +1 -1
  314. package/web-shell/assets/index-8hXIpvo4.js +1865 -0
  315. package/web-shell/assets/{index-Bncx8E8M.js → index-CBGz4Qjl.js} +1 -1
  316. package/web-shell/assets/{index-C-XlQn24.css → index-DclEv91i.css} +1 -1
  317. package/web-shell/assets/{infoDiagram-RXCK75RN-DasffaZp.js → infoDiagram-RXCK75RN-B6DAOyXe.js} +1 -1
  318. package/web-shell/assets/{ishikawaDiagram-5VMMS53U-CmRUt3C-.js → ishikawaDiagram-5VMMS53U-Bpg-joFo.js} +1 -1
  319. package/web-shell/assets/{journeyDiagram-EYS64GPL-DzhE_c1Z.js → journeyDiagram-EYS64GPL-BclrHzGa.js} +1 -1
  320. package/web-shell/assets/{kanban-definition-3QL26DDD-BH5b6nn3.js → kanban-definition-3QL26DDD-5gJzNTYG.js} +1 -1
  321. package/web-shell/assets/{layout-BxoLK-LY.js → layout-CEz_1L8z.js} +1 -1
  322. package/web-shell/assets/{linear-CqDPvVI7.js → linear-CBjTq9Hc.js} +1 -1
  323. package/web-shell/assets/{mermaid.core-DBoN4plo.js → mermaid.core-Dzhbxx_I.js} +6 -6
  324. package/web-shell/assets/{mindmap-definition-FBJOCRG2-DJJtXPEM.js → mindmap-definition-FBJOCRG2-DQdVqlBF.js} +1 -1
  325. package/web-shell/assets/{pegDiagram-XKGWAZYB-DmgPXP5l.js → pegDiagram-XKGWAZYB-D1JZlYXL.js} +1 -1
  326. package/web-shell/assets/{pieDiagram-E7YTZNPT-1ezjzcI5.js → pieDiagram-E7YTZNPT-BmkpYL0w.js} +1 -1
  327. package/web-shell/assets/{quadrantDiagram-AXDQQJYC-ChKARz3k.js → quadrantDiagram-AXDQQJYC-DRvD6co5.js} +1 -1
  328. package/web-shell/assets/{railroadDiagram-O6MQD6OU-k7mNB_QT.js → railroadDiagram-O6MQD6OU-CEdjDuoo.js} +1 -1
  329. package/web-shell/assets/{requirementDiagram-EFPCY7ZU-B0XFsii0.js → requirementDiagram-EFPCY7ZU-BCHG-ie8.js} +1 -1
  330. package/web-shell/assets/{sankeyDiagram-P5KCCOFB-repJ2Ukk.js → sankeyDiagram-P5KCCOFB-C9cZMnye.js} +1 -1
  331. package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-D0gUSKGu.js → sequenceDiagram-WJ2MYXX4-DYHRV4zL.js} +1 -1
  332. package/web-shell/assets/{sizeCapture-X5ZJPWSS-CE463F74.js → sizeCapture-X5ZJPWSS-DlK21aye.js} +1 -1
  333. package/web-shell/assets/{stateDiagram-HBIQ2CUA-003zYtJa.js → stateDiagram-HBIQ2CUA-BrmZssvk.js} +1 -1
  334. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-B2Q7XDaE.js +1 -0
  335. package/web-shell/assets/{swimlanes-XN3QIQJK-DBj8MFpu.js → swimlanes-XN3QIQJK-D9xfcayR.js} +1 -1
  336. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-DpZPOSbX.js +8 -0
  337. package/web-shell/assets/{timeline-definition-24CTP7MA-D2aCh4a9.js → timeline-definition-24CTP7MA-D4gdDL_d.js} +1 -1
  338. package/web-shell/assets/{vennDiagram-4TSXK5OY-BHMfWBpl.js → vennDiagram-4TSXK5OY-DdhIExjI.js} +1 -1
  339. package/web-shell/assets/{wardleyDiagram-VM6X3IG4-RdHAj66j.js → wardleyDiagram-VM6X3IG4-C9RS_Zof.js} +1 -1
  340. package/web-shell/assets/{xychartDiagram-S5SC5T6Z-BgJWOvq0.js → xychartDiagram-S5SC5T6Z-orRgmxWk.js} +1 -1
  341. package/web-shell/index.html +2 -2
  342. package/chunks/MaxSizedBox-BFVLZP2E.js +0 -112
  343. package/chunks/agent-headless-UCBCS4V4.js +0 -87
  344. package/chunks/bridge-FRNYLYY7.js +0 -119
  345. package/chunks/channel-settings-store-IV4KDL7N.js +0 -117
  346. package/chunks/chunk-JS73NNWF.js +0 -30
  347. package/chunks/chunk-VGHZT6JR.js +0 -51
  348. package/chunks/config-utils-PMX4QZ5Y.js +0 -113
  349. package/chunks/contextCommand-NZRLVAFC.js +0 -108
  350. package/chunks/daemon-status-provider-FTTYZEKN.js +0 -118
  351. package/chunks/daemon-trust-policy-WMGFPA3Z.js +0 -114
  352. package/chunks/deferred-core-runtime-BUFEFYNA.js +0 -116
  353. package/chunks/earlyInputCapture-ROPLMXA7.js +0 -109
  354. package/chunks/errors-U5KNAADB.js +0 -115
  355. package/chunks/handleAutoUpdate-W4BUYFT7.js +0 -111
  356. package/chunks/initializer-SNVVLS7Y.js +0 -115
  357. package/chunks/installationInfo-D4XGQNHJ.js +0 -109
  358. package/chunks/list-WYECMLXZ.js +0 -118
  359. package/chunks/loadedSettingsAdapter-5WZBXBCR.js +0 -112
  360. package/chunks/mcp-CBWAROY3.js +0 -112
  361. package/chunks/nonInteractiveCli-O232UUV7.js +0 -185
  362. package/chunks/pidfile-MSPQ255Y.js +0 -113
  363. package/chunks/prompt-terminal-ledger-YPGMNDXT.js +0 -107
  364. package/chunks/resumeHistoryUtils-35D4KAVT.js +0 -120
  365. package/chunks/serve-WQ54UIYG.js +0 -120
  366. package/chunks/spawnChannel-NE43EEO3.js +0 -113
  367. package/chunks/theme-manager-IJS6OICX.js +0 -104
  368. package/chunks/total-session-admission-L5RPEFZ2.js +0 -114
  369. package/chunks/useAutoAcceptIndicator-O2N2Q6KG.js +0 -122
  370. package/chunks/workspace-providers-status-OCFEWIPQ.js +0 -116
  371. package/chunks/workspace-service-5ZOBMMIB.js +0 -131
  372. package/chunks/workspace-skills-status-B6NJZD4B.js +0 -115
  373. package/chunks/write-file-B2RNX6SU.js +0 -90
  374. package/web-shell/assets/channel-CU-Zyv0r.js +0 -1
  375. package/web-shell/assets/classDiagram-DTDB5LWJ-C0J2_LKs.js +0 -1
  376. package/web-shell/assets/classDiagram-v2-JRS7N3AN-C0J2_LKs.js +0 -1
  377. package/web-shell/assets/index-gdvMN4J1.js +0 -1860
  378. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-2uACDdJN.js +0 -1
  379. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-C4JJkavU.js +0 -8
@@ -1,5 +1,8 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
+ import {
4
+ recomputeMcpGating
5
+ } from "./chunk-P5GGM4KS.js";
3
6
  import {
4
7
  classifyApiError,
5
8
  fireSessionDeleteHook
@@ -14,7 +17,7 @@ import {
14
17
  normalizePartList,
15
18
  parseExtensionRef,
16
19
  parseMcpServerRef
17
- } from "./chunk-5SM2AK65.js";
20
+ } from "./chunk-OIP7C4FE.js";
18
21
  import {
19
22
  getAvailableCommands,
20
23
  getSlashCommandFirstToken,
@@ -23,14 +26,7 @@ import {
23
26
  isSlashCommand,
24
27
  recordDaemonSessionModel,
25
28
  restoreSessionModelThenAuthenticate
26
- } from "./chunk-GTUZ3R6I.js";
27
- import {
28
- collectContextData,
29
- formatContextUsageText
30
- } from "./chunk-WZ3QKPMQ.js";
31
- import {
32
- recomputeMcpGating
33
- } from "./chunk-JLU3FPQR.js";
29
+ } from "./chunk-F5SZP77N.js";
34
30
  import {
35
31
  SessionIdConflictError,
36
32
  appEvents,
@@ -38,41 +34,45 @@ import {
38
34
  cleanupReviewWorktreeLeases,
39
35
  loadCliConfig,
40
36
  normalizeDisabledToolList
41
- } from "./chunk-HPECDZ6X.js";
37
+ } from "./chunk-BAJKAAOY.js";
38
+ import "./chunk-NYX53SV4.js";
39
+ import {
40
+ collectContextData,
41
+ formatContextUsageText
42
+ } from "./chunk-AGR5UROZ.js";
42
43
  import {
43
44
  getCommandSubcommandNames
44
- } from "./chunk-VBF4KZRQ.js";
45
+ } from "./chunk-IJKTMLBE.js";
45
46
  import {
46
47
  getEffectiveSupportedModes
47
- } from "./chunk-CDUN63IN.js";
48
- import "./chunk-2FN2HNTI.js";
48
+ } from "./chunk-K2NQPH5D.js";
49
+ import "./chunk-FDY5RMGH.js";
49
50
  import "./chunk-4WGODMVR.js";
50
51
  import "./chunk-3SH53ANB.js";
51
- import "./chunk-NYX53SV4.js";
52
52
  import {
53
53
  isGoalStatusKind
54
54
  } from "./chunk-EKTCKZV5.js";
55
- import "./chunk-R3T33BG5.js";
56
- import "./chunk-WEGXPP5E.js";
55
+ import "./chunk-QP4C6WCE.js";
56
+ import "./chunk-YAF2MQZ6.js";
57
+ import "./chunk-QFCDF5PL.js";
57
58
  import {
58
59
  startNonInteractiveOpenAILogHousekeeping
59
- } from "./chunk-CZFQ62RM.js";
60
+ } from "./chunk-JSHHYW6T.js";
60
61
  import "./chunk-KW7NOTN6.js";
62
+ import "./chunk-C6K43ZDE.js";
63
+ import "./chunk-6H67XLET.js";
61
64
  import {
62
65
  beginAcpBootstrapConfigProfiling,
63
66
  buildAndFreezeAcpStartupProfile,
64
67
  endAcpBootstrapConfigProfiling,
65
68
  markAcpStartup
66
69
  } from "./chunk-5JTIYALA.js";
67
- import "./chunk-FCSWZAS3.js";
68
- import "./chunk-TR7G7XFQ.js";
69
- import "./chunk-3WBMPR3S.js";
70
- import "./chunk-YAF2MQZ6.js";
70
+ import "./chunk-A7YP63XN.js";
71
+ import "./chunk-L6YT5H34.js";
72
+ import "./chunk-CSMI4FP5.js";
71
73
  import {
72
74
  computeCpuPercent
73
75
  } from "./chunk-LBOVL47Y.js";
74
- import "./chunk-IOGKXPL3.js";
75
- import "./chunk-6H67XLET.js";
76
76
  import {
77
77
  GENERATION_MAX_PROMPT_BYTES,
78
78
  GENERATION_TIMEOUT_MS,
@@ -87,7 +87,6 @@ import {
87
87
  formatWorkspaceMemoryForgetSummary,
88
88
  isCompatibleLiveSessionSource,
89
89
  isValidServerName,
90
- normalizeChannelDeliveryText,
91
90
  projectAcpToolResultUpdate,
92
91
  redactMcpServerSecrets,
93
92
  replayTranscriptRecordPage,
@@ -95,7 +94,7 @@ import {
95
94
  shouldSuppressRememberErrorDetails,
96
95
  workspaceMemoryFailureCode,
97
96
  workspaceMemoryFailureDiagnostics
98
- } from "./chunk-ALTQLFEG.js";
97
+ } from "./chunk-4MQEPP3Y.js";
99
98
  import {
100
99
  BaseEmitter,
101
100
  HistoryReplayer,
@@ -106,48 +105,54 @@ import {
106
105
  hasFullSessionContext,
107
106
  observeAcpToolResultProjection,
108
107
  observeAcpToolResultWire
109
- } from "./chunk-J3CBIEDS.js";
110
- import "./chunk-4TPAG3O7.js";
108
+ } from "./chunk-3SGB2UHX.js";
109
+ import "./chunk-BFPESSTR.js";
111
110
  import "./chunk-E7REAOTN.js";
112
- import "./chunk-L436XFLJ.js";
111
+ import "./chunk-XDLEZ5HX.js";
113
112
  import "./chunk-2MIN6GRR.js";
114
113
  import "./chunk-QHTIBUWB.js";
115
114
  import "./chunk-TXASDT2M.js";
116
115
  import {
117
- buildToolWriteOriginMeta
118
- } from "./chunk-VGHZT6JR.js";
116
+ DAEMON_OWNED_STANDALONE_CREATION_KEY,
117
+ SESSION_SOURCE_META_KEY,
118
+ isReservedStandaloneSessionSourceType,
119
+ parseSessionSource
120
+ } from "./chunk-2TNL5KPM.js";
121
+ import {
122
+ buildToolWriteOriginMeta,
123
+ getConversationDirectoryName,
124
+ isSameConversationPath
125
+ } from "./chunk-T3WXYEZ4.js";
126
+ import "./chunk-UXEO7E3V.js";
127
+ import "./chunk-RXFQM6FQ.js";
128
+ import {
129
+ normalizeChannelDeliveryText
130
+ } from "./chunk-4CMJKUND.js";
119
131
  import {
120
132
  normalizeSessionIdForLookup,
121
133
  parseCallerSuppliedSessionId
122
134
  } from "./chunk-ZEZKIS2K.js";
123
- import "./chunk-RXFQM6FQ.js";
124
- import "./chunk-UXEO7E3V.js";
125
135
  import {
126
136
  PERMISSION_RULE_TYPES,
127
137
  PermissionRulesValidationError,
128
138
  buildPermissionSettings,
129
139
  normalizePermissionRules,
130
140
  readPermissionRuleSet
131
- } from "./chunk-7UJTY5V3.js";
141
+ } from "./chunk-KEKZFOL6.js";
132
142
  import {
133
143
  MAX_AUDIO_BYTES,
134
144
  sanitizeVoiceErrorMessage,
135
145
  transcribeVoiceAudio
136
- } from "./chunk-76WGY6LW.js";
146
+ } from "./chunk-JCQD3INC.js";
137
147
  import {
138
148
  readVoiceModel
139
- } from "./chunk-2MHGD7EE.js";
140
- import "./chunk-2SERYG4T.js";
141
- import "./chunk-JS73NNWF.js";
142
- import "./chunk-ATLGYSYH.js";
143
- import "./chunk-VOEMVOM4.js";
144
- import {
145
- SESSION_SOURCE_META_KEY,
146
- parseSessionSource
147
- } from "./chunk-AKQA3WCH.js";
149
+ } from "./chunk-XRSOI3DL.js";
150
+ import "./chunk-YTDVNSUQ.js";
151
+ import "./chunk-RJC5EIKY.js";
152
+ import "./chunk-6CGL7E7G.js";
153
+ import "./chunk-ZGXYO7DY.js";
148
154
  import "./chunk-7U5G6JXI.js";
149
155
  import "./chunk-WCCLLK7X.js";
150
- import "./chunk-OCPBI7J5.js";
151
156
  import {
152
157
  REASONING_EFFORT_DEFAULT,
153
158
  REASONING_EFFORT_NAMES,
@@ -164,26 +169,26 @@ import {
164
169
  parseAcpModelOption,
165
170
  resolveAcpModelOption,
166
171
  sanitizeProviderBaseUrl
167
- } from "./chunk-HABT2Z7R.js";
172
+ } from "./chunk-Q26AYA62.js";
168
173
  import {
169
174
  mapSkillConfigToStatus
170
175
  } from "./chunk-BGXZBI5B.js";
171
176
  import {
172
177
  resolveSkillSettings
173
178
  } from "./chunk-Z4X5MTRT.js";
174
- import "./chunk-F7M6ZFGU.js";
175
- import "./chunk-KQYW2GB5.js";
179
+ import "./chunk-FBSSIAAQ.js";
180
+ import "./chunk-PFCQ62V4.js";
176
181
  import "./chunk-57OAHC2Y.js";
177
- import "./chunk-5JCZ3UKB.js";
182
+ import "./chunk-HVQ3B7FF.js";
178
183
  import "./chunk-7JPW6IYH.js";
179
- import "./chunk-IKN3IUJP.js";
184
+ import "./chunk-5XBFCMWD.js";
180
185
  import "./chunk-V6WHFGST.js";
181
186
  import {
182
187
  createLoadedSettingsAdapter
183
- } from "./chunk-AWFZDYSD.js";
188
+ } from "./chunk-CPGJJJLU.js";
184
189
  import {
185
190
  ndJsonStream
186
- } from "./chunk-VYWCFWI5.js";
191
+ } from "./chunk-H72BQNM3.js";
187
192
  import {
188
193
  ACP_PREFLIGHT_KINDS,
189
194
  IDLE_HOOK_EVENTS,
@@ -191,7 +196,7 @@ import {
191
196
  SERVE_STATUS_EXT_METHODS,
192
197
  STATUS_SCHEMA_VERSION,
193
198
  mapDomainErrorToErrorKind
194
- } from "./chunk-XUX6O2ZT.js";
199
+ } from "./chunk-JHS74YAB.js";
195
200
  import "./chunk-MZS7GEC7.js";
196
201
  import {
197
202
  ACTIVE_WORK_CLOSE_IF_UNHELD_PARAM,
@@ -232,15 +237,15 @@ import {
232
237
  import {
233
238
  NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE,
234
239
  isNotCurrentlyGeneratingCancelError
235
- } from "./chunk-624NHDGB.js";
240
+ } from "./chunk-ERFDKH32.js";
236
241
  import "./chunk-6PLDPT2C.js";
237
242
  import "./chunk-FYJ7W2PI.js";
238
- import "./chunk-7CWEZQ6T.js";
243
+ import "./chunk-STUJ7IMZ.js";
239
244
  import "./chunk-JVPFTDBK.js";
240
- import "./chunk-GYTKQYDB.js";
241
245
  import "./chunk-ALMR3E6Q.js";
246
+ import "./chunk-GYTKQYDB.js";
247
+ import "./chunk-RKFGE7JH.js";
242
248
  import "./chunk-UDG5EZJI.js";
243
- import "./chunk-M5GB774H.js";
244
249
  import {
245
250
  EXTERNAL_TOOL_GUARD_READY_META_KEY,
246
251
  EXTERNAL_TOOL_GUARD_REQUIRED_VALUE,
@@ -250,7 +255,8 @@ import {
250
255
  SHELL_EXECUTING_TOOL_NAMES,
251
256
  isValidExternalToolGuardDenialReason
252
257
  } from "./chunk-3VUENPWF.js";
253
- import "./chunk-ELY4QVIB.js";
258
+ import "./chunk-M5GB774H.js";
259
+ import "./chunk-7EQQR46F.js";
254
260
  import {
255
261
  ACP_EVENT_LOOP_STALL_RESTART_MS,
256
262
  CHANNEL_PROMPT_META_KEY
@@ -263,7 +269,7 @@ import {
263
269
  import {
264
270
  assembleMcpServers,
265
271
  loadMcpApprovals
266
- } from "./chunk-3JKUX4PB.js";
272
+ } from "./chunk-5O72BNDD.js";
267
273
  import {
268
274
  getOutputLanguageFilePath,
269
275
  getPersistScopeForModelSelection,
@@ -272,9 +278,9 @@ import {
272
278
  resolveOutputLanguageOrPreserveAuto,
273
279
  updateOutputLanguageFile,
274
280
  writeOutputLanguageAndRegisterPath
275
- } from "./chunk-TDQBVEPK.js";
281
+ } from "./chunk-F7TNAPZ4.js";
276
282
  import "./chunk-RKUWKYED.js";
277
- import "./chunk-KPF2K55D.js";
283
+ import "./chunk-JSC3H3TD.js";
278
284
  import "./chunk-GOXKNSDZ.js";
279
285
  import {
280
286
  getSystemDefaultsPath,
@@ -283,7 +289,7 @@ import {
283
289
  import {
284
290
  getCurrentLanguage,
285
291
  setLanguageAsync
286
- } from "./chunk-W2WRNJKX.js";
292
+ } from "./chunk-LDP5OD6N.js";
287
293
  import {
288
294
  SUPPORTED_LANGUAGES
289
295
  } from "./chunk-5EJZE3FP.js";
@@ -291,19 +297,19 @@ import {
291
297
  findEnvFiles,
292
298
  preResolveHomeEnvOverrides,
293
299
  reloadEnvironment
294
- } from "./chunk-R7G7GKOX.js";
300
+ } from "./chunk-IK5BW3CS.js";
295
301
  import {
296
302
  ENV_ACP_REPEATED_TOOL_FAILURE_GUARD,
297
303
  QWEN_CODE_SERVE_ENV
298
304
  } from "./chunk-5PA6UEYA.js";
299
- import "./chunk-7DPKPBOQ.js";
300
- import "./chunk-H3HZ4AWW.js";
305
+ import "./chunk-V2NDP3I4.js";
306
+ import "./chunk-7UYV53BC.js";
301
307
  import "./chunk-W3N5XAZ6.js";
302
308
  import {
303
309
  isFolderTrustEnabled,
304
310
  isWorkspaceTrusted,
305
311
  loadTrustedFolders
306
- } from "./chunk-ZGWDHSUM.js";
312
+ } from "./chunk-V4QXXQJ2.js";
307
313
  import "./chunk-NPQ5ZKRP.js";
308
314
  import "./chunk-MR3PXB6E.js";
309
315
  import {
@@ -333,30 +339,30 @@ import {
333
339
  resolveBaseUrl,
334
340
  runManagedRememberByAgent,
335
341
  subagentGenerator
336
- } from "./chunk-5URK47RN.js";
337
- import "./chunk-JSY43GMI.js";
342
+ } from "./chunk-KUX5D6DK.js";
343
+ import "./chunk-3DXFGHAJ.js";
338
344
  import "./chunk-XFSFZCM5.js";
339
345
  import "./chunk-2EAZ43JQ.js";
340
346
  import "./chunk-NF5J2WFA.js";
341
347
  import {
342
348
  CreateSubSessionTool
343
- } from "./chunk-LRKMQPMD.js";
349
+ } from "./chunk-CQH5KTKC.js";
344
350
  import "./chunk-LJZSMWOH.js";
345
- import "./chunk-AP7WZONS.js";
346
- import "./chunk-JLGFGPZJ.js";
347
- import "./chunk-SKNVVYIJ.js";
351
+ import "./chunk-6LFTG244.js";
352
+ import "./chunk-PKAYJDB3.js";
353
+ import "./chunk-6IUNAPLR.js";
348
354
  import {
349
355
  restoreWorktreeContext
350
- } from "./chunk-UCSV2IZW.js";
351
- import "./chunk-NEZZHGEI.js";
352
- import "./chunk-3FSBMAYD.js";
353
- import "./chunk-XJS54K4A.js";
356
+ } from "./chunk-OIVXBW3W.js";
357
+ import "./chunk-4CDSK5AZ.js";
358
+ import "./chunk-XQFT3QUF.js";
359
+ import "./chunk-VTHREBQM.js";
354
360
  import "./chunk-ZPJWUGCS.js";
355
361
  import {
356
362
  clearCachedCredentialFile,
357
363
  qwenOAuth2Events
358
- } from "./chunk-ZWKGZB2K.js";
359
- import "./chunk-J5352S3S.js";
364
+ } from "./chunk-H2WDGQ6D.js";
365
+ import "./chunk-MIIVI25Q.js";
360
366
  import {
361
367
  APPROVAL_MODE_INFO,
362
368
  BranchPointInvalidError,
@@ -473,43 +479,43 @@ import {
473
479
  updateSetting,
474
480
  validatePlanModeShellApproval,
475
481
  validatePlanModeShellContext
476
- } from "./chunk-XIRDDFRS.js";
482
+ } from "./chunk-TGWAQ5RB.js";
477
483
  import "./chunk-GOFAQQZA.js";
478
484
  import "./chunk-5M6IDOMF.js";
479
485
  import "./chunk-TWPJO254.js";
480
486
  import {
481
487
  external_exports
482
488
  } from "./chunk-CQ35AJ4Z.js";
483
- import "./chunk-3UZCLCXR.js";
484
- import "./chunk-TOF4UZHH.js";
485
- import "./chunk-O3BUXIPM.js";
486
- import "./chunk-ZLTEQYNC.js";
489
+ import "./chunk-EKSCLBBF.js";
490
+ import "./chunk-P2SU6ZTI.js";
491
+ import "./chunk-IZIVM7LZ.js";
492
+ import "./chunk-SFPGAQUL.js";
487
493
  import {
488
494
  parsePositiveIntegerEnv
489
495
  } from "./chunk-6PVPNMXU.js";
490
496
  import {
491
497
  RUNTIME_SNAPSHOT_PREFIX
492
- } from "./chunk-AYVIGUUK.js";
498
+ } from "./chunk-JB4JIVTJ.js";
493
499
  import "./chunk-IRH27ZC2.js";
494
500
  import "./chunk-QHWCP53L.js";
495
- import "./chunk-JECO75XD.js";
501
+ import "./chunk-D5LUXLUH.js";
496
502
  import {
497
503
  promptIdContext,
498
504
  todoWorkChainContext
499
505
  } from "./chunk-O6GEWCJA.js";
500
506
  import "./chunk-T26EAKDL.js";
501
- import "./chunk-LJP2BBMK.js";
507
+ import "./chunk-EOGELB3H.js";
502
508
  import "./chunk-CPBF7KYF.js";
503
- import "./chunk-I6DY753S.js";
509
+ import "./chunk-EFUM7RVY.js";
504
510
  import {
505
511
  HookEventName,
506
512
  createHookOutput
507
- } from "./chunk-T2CRBIDJ.js";
508
- import "./chunk-77TOMRBG.js";
509
- import "./chunk-DEYPMJPD.js";
510
- import "./chunk-T6OODF2U.js";
511
- import "./chunk-27ONXAFY.js";
512
- import "./chunk-ZEADBZLO.js";
513
+ } from "./chunk-TTX2JUE6.js";
514
+ import "./chunk-43GGFFLY.js";
515
+ import "./chunk-SMPR7SPO.js";
516
+ import "./chunk-JWALNCLT.js";
517
+ import "./chunk-NIFYWDYN.js";
518
+ import "./chunk-3AFMQUTI.js";
513
519
  import {
514
520
  GoalConflictError,
515
521
  GoalInvalidTransitionError,
@@ -520,14 +526,14 @@ import {
520
526
  parseGoalSnapshotV2,
521
527
  parseGoalStateCause,
522
528
  wrapUserPromptSubmitContext
523
- } from "./chunk-FN5C6C7G.js";
529
+ } from "./chunk-WKK5BQNP.js";
524
530
  import {
525
531
  APPROVAL_MODES
526
- } from "./chunk-XR7OIAQF.js";
532
+ } from "./chunk-V5J4J5TP.js";
527
533
  import "./chunk-MLXTMF7H.js";
528
534
  import "./chunk-NAVJD2PQ.js";
529
- import "./chunk-FVDQ5E67.js";
530
- import "./chunk-V3GINY6K.js";
535
+ import "./chunk-3JGZSIDA.js";
536
+ import "./chunk-VVW4ZNFY.js";
531
537
  import "./chunk-QHMLYMMS.js";
532
538
  import {
533
539
  AgentOutputMessageCapture,
@@ -536,32 +542,32 @@ import {
536
542
  addToolCallResultAttributes,
537
543
  registerAcpEventLoopLagGauge,
538
544
  startEventLoopLagMonitor
539
- } from "./chunk-SDVF6A42.js";
545
+ } from "./chunk-7DJCPZE3.js";
540
546
  import "./chunk-P3QQPMQA.js";
541
547
  import {
542
548
  addDaemonRequestAttribute,
543
549
  extractDaemonTraceContext,
544
550
  withDaemonSpan
545
- } from "./chunk-ILPXSKGQ.js";
551
+ } from "./chunk-HVEYF6VT.js";
546
552
  import "./chunk-VNOVK4I7.js";
547
553
  import "./chunk-SAH4BD2J.js";
548
- import "./chunk-ZKAZP2ZG.js";
554
+ import "./chunk-PDMJ3KGS.js";
549
555
  import {
550
556
  runWithRuntimeContentGenerator
551
- } from "./chunk-U45D46O5.js";
557
+ } from "./chunk-CMHFCLBU.js";
552
558
  import "./chunk-S6LOFUVP.js";
553
559
  import {
554
560
  REASONING_EFFORT_TIERS,
555
561
  applyReasoningEffort
556
562
  } from "./chunk-2LD5U7Q3.js";
557
563
  import "./chunk-DJ2GSRLV.js";
558
- import "./chunk-I6VVOZDK.js";
564
+ import "./chunk-J2OSJFP3.js";
559
565
  import "./chunk-K2OJUPOE.js";
560
566
  import {
561
567
  getToolCallPreparations
562
568
  } from "./chunk-CFKIH3D3.js";
563
- import "./chunk-EB4VDXNI.js";
564
- import "./chunk-FJWICLG7.js";
569
+ import "./chunk-4FTKQNWJ.js";
570
+ import "./chunk-Y3QL45LS.js";
565
571
  import {
566
572
  ConversationFinishedEvent,
567
573
  DiscoveredMCPTool,
@@ -592,35 +598,35 @@ import {
592
598
  shouldRunVisionBridge,
593
599
  splitImageParts,
594
600
  uiTelemetryService
595
- } from "./chunk-OF2DPXUS.js";
601
+ } from "./chunk-L2M46FP5.js";
596
602
  import "./chunk-YRLW2MSX.js";
597
603
  import "./chunk-VGC4I5JJ.js";
598
604
  import {
599
605
  getAllGeminiMdFilenames,
600
606
  getSpecificMimeType
601
- } from "./chunk-WBT3STGU.js";
607
+ } from "./chunk-3I6UTTDX.js";
602
608
  import {
603
609
  getAutoMemoryRoot,
604
610
  getUserAutoMemoryRoot
605
- } from "./chunk-PVBT5QPD.js";
611
+ } from "./chunk-6PJOTWAN.js";
606
612
  import {
607
613
  runSideQuery
608
- } from "./chunk-IPQA4SR5.js";
614
+ } from "./chunk-BWORX6FA.js";
609
615
  import "./chunk-WZAD4ZNJ.js";
610
616
  import {
611
617
  DEFAULT_TOKEN_LIMIT,
612
618
  tokenLimit
613
619
  } from "./chunk-FPGTNKCP.js";
614
- import "./chunk-SLEWBQWM.js";
620
+ import "./chunk-6DIGWMGT.js";
615
621
  import {
616
622
  hasVertexProjectConfigured,
617
623
  preloadContentGenerator
618
- } from "./chunk-AA7VBRBG.js";
624
+ } from "./chunk-Z7FLBQPR.js";
619
625
  import "./chunk-XZA32HII.js";
620
- import "./chunk-7QGEJI7M.js";
626
+ import "./chunk-23RFD54N.js";
621
627
  import {
622
628
  AuthType
623
- } from "./chunk-GTUKW3I6.js";
629
+ } from "./chunk-PPKZ7JOE.js";
624
630
  import "./chunk-HHJLM3WQ.js";
625
631
  import {
626
632
  endToolExecutionSpan,
@@ -632,17 +638,17 @@ import {
632
638
  startToolExecutionSpan,
633
639
  startToolSpan,
634
640
  withInteractionSpan
635
- } from "./chunk-6US7BF3G.js";
641
+ } from "./chunk-L6BZRIUL.js";
636
642
  import "./chunk-74TONY4F.js";
637
- import "./chunk-VL4YX3FH.js";
643
+ import "./chunk-XF63PKEN.js";
638
644
  import {
639
645
  FORK_SUBAGENT_TYPE,
640
646
  getStartupContextLength,
641
647
  isSystemReminderContent
642
- } from "./chunk-7OBH4AM2.js";
643
- import "./chunk-OT4YKUUV.js";
648
+ } from "./chunk-CAJTKR6W.js";
649
+ import "./chunk-ZU4UDIWX.js";
644
650
  import "./chunk-AQ37AY7B.js";
645
- import "./chunk-RRKNX553.js";
651
+ import "./chunk-PDQGMSZK.js";
646
652
  import {
647
653
  BaseDeclarativeTool,
648
654
  BaseToolInvocation,
@@ -650,7 +656,7 @@ import {
650
656
  ToolNames,
651
657
  canonicalToolName,
652
658
  isShellProgressData
653
- } from "./chunk-KOJ6MHD5.js";
659
+ } from "./chunk-UTLCH2FK.js";
654
660
  import {
655
661
  Storage,
656
662
  createDebugLogger,
@@ -658,11 +664,11 @@ import {
658
664
  getErrorStatus,
659
665
  isSubpath,
660
666
  sessionIdContext
661
- } from "./chunk-2NNTE2ED.js";
662
- import "./chunk-66GIFJ63.js";
667
+ } from "./chunk-UHQFIS7N.js";
668
+ import "./chunk-W5MJJ2V7.js";
663
669
  import {
664
670
  runExitCleanup
665
- } from "./chunk-TFV4RXPU.js";
671
+ } from "./chunk-Y6LSMB6J.js";
666
672
  import {
667
673
  writeStderrLine,
668
674
  writeStderrLineSafe
@@ -1952,6 +1958,19 @@ var basicPermissionOptions = [
1952
1958
  kind: "reject_once"
1953
1959
  }
1954
1960
  ];
1961
+ function filterPermissionPersistenceOptions(options, policy) {
1962
+ if (!policy) return options;
1963
+ return options.filter((option) => {
1964
+ if (option.optionId === "proceed_always_project" /* ProceedAlwaysProject */ && !policy.allowProjectPersistence) {
1965
+ return false;
1966
+ }
1967
+ if (option.optionId === "proceed_always_user" /* ProceedAlwaysUser */ && !policy.allowUserPersistence) {
1968
+ return false;
1969
+ }
1970
+ return true;
1971
+ });
1972
+ }
1973
+ __name(filterPermissionPersistenceOptions, "filterPermissionPersistenceOptions");
1955
1974
  function supportsHideAlwaysAllow(confirmation) {
1956
1975
  return confirmation.type !== "ask_user_question";
1957
1976
  }
@@ -2087,7 +2106,7 @@ function resolvePermissionOutcome(response, offeredOptions) {
2087
2106
  return optionId;
2088
2107
  }
2089
2108
  __name(resolvePermissionOutcome, "resolvePermissionOutcome");
2090
- function toPermissionOptions(confirmation, forceHideAlwaysAllow = false) {
2109
+ function toPermissionOptions(confirmation, forceHideAlwaysAllow = false, persistencePolicy) {
2091
2110
  switch (confirmation.type) {
2092
2111
  case "edit":
2093
2112
  return filterAlwaysAllowOptions(
@@ -2106,56 +2125,65 @@ function toPermissionOptions(confirmation, forceHideAlwaysAllow = false) {
2106
2125
  const label = formatExecPermissionScopeLabel(confirmation);
2107
2126
  return filterAlwaysAllowOptions(
2108
2127
  confirmation,
2109
- [
2110
- {
2111
- optionId: "proceed_always_project" /* ProceedAlwaysProject */,
2112
- name: `Always Allow in project: ${label}`,
2113
- kind: "allow_always"
2114
- },
2115
- {
2116
- optionId: "proceed_always_user" /* ProceedAlwaysUser */,
2117
- name: `Always Allow for user: ${label}`,
2118
- kind: "allow_always"
2119
- },
2120
- ...basicPermissionOptions
2121
- ],
2128
+ filterPermissionPersistenceOptions(
2129
+ [
2130
+ {
2131
+ optionId: "proceed_always_project" /* ProceedAlwaysProject */,
2132
+ name: `Always Allow in project: ${label}`,
2133
+ kind: "allow_always"
2134
+ },
2135
+ {
2136
+ optionId: "proceed_always_user" /* ProceedAlwaysUser */,
2137
+ name: `Always Allow for user: ${label}`,
2138
+ kind: "allow_always"
2139
+ },
2140
+ ...basicPermissionOptions
2141
+ ],
2142
+ persistencePolicy
2143
+ ),
2122
2144
  forceHideAlwaysAllow
2123
2145
  );
2124
2146
  }
2125
2147
  case "mcp":
2126
2148
  return filterAlwaysAllowOptions(
2127
2149
  confirmation,
2128
- [
2129
- {
2130
- optionId: "proceed_always_project" /* ProceedAlwaysProject */,
2131
- name: `Always Allow in project: ${confirmation.toolName}`,
2132
- kind: "allow_always"
2133
- },
2134
- {
2135
- optionId: "proceed_always_user" /* ProceedAlwaysUser */,
2136
- name: `Always Allow for user: ${confirmation.toolName}`,
2137
- kind: "allow_always"
2138
- },
2139
- ...basicPermissionOptions
2140
- ],
2150
+ filterPermissionPersistenceOptions(
2151
+ [
2152
+ {
2153
+ optionId: "proceed_always_project" /* ProceedAlwaysProject */,
2154
+ name: `Always Allow in project: ${confirmation.toolName}`,
2155
+ kind: "allow_always"
2156
+ },
2157
+ {
2158
+ optionId: "proceed_always_user" /* ProceedAlwaysUser */,
2159
+ name: `Always Allow for user: ${confirmation.toolName}`,
2160
+ kind: "allow_always"
2161
+ },
2162
+ ...basicPermissionOptions
2163
+ ],
2164
+ persistencePolicy
2165
+ ),
2141
2166
  forceHideAlwaysAllow
2142
2167
  );
2143
2168
  case "info":
2144
2169
  return filterAlwaysAllowOptions(
2145
2170
  confirmation,
2146
- [
2147
- {
2148
- optionId: "proceed_always_project" /* ProceedAlwaysProject */,
2149
- name: "Always Allow in project",
2150
- kind: "allow_always"
2151
- },
2152
- {
2153
- optionId: "proceed_always_user" /* ProceedAlwaysUser */,
2154
- name: "Always Allow for user",
2155
- kind: "allow_always"
2156
- },
2157
- ...basicPermissionOptions
2158
- ],
2171
+ filterPermissionPersistenceOptions(
2172
+ [
2173
+ {
2174
+ optionId: "proceed_always_project" /* ProceedAlwaysProject */,
2175
+ name: "Always Allow in project",
2176
+ kind: "allow_always"
2177
+ },
2178
+ {
2179
+ optionId: "proceed_always_user" /* ProceedAlwaysUser */,
2180
+ name: "Always Allow for user",
2181
+ kind: "allow_always"
2182
+ },
2183
+ ...basicPermissionOptions
2184
+ ],
2185
+ persistencePolicy
2186
+ ),
2159
2187
  forceHideAlwaysAllow
2160
2188
  );
2161
2189
  case "plan":
@@ -2205,11 +2233,12 @@ __name(toPermissionOptions, "toPermissionOptions");
2205
2233
  // packages/cli/src/acp-integration/session/SubAgentTracker.ts
2206
2234
  var debugLogger3 = createDebugLogger("ACP_SUBAGENT_TRACKER");
2207
2235
  var SubAgentTracker = class {
2208
- constructor(ctx, client, parentToolCallId, subagentType, onPermissionCancel, permissionRequester = (params, signal) => requestPermissionWithAbort(this.client, params, signal)) {
2236
+ constructor(ctx, client, parentToolCallId, subagentType, onPermissionCancel, permissionRequester = (params, signal) => requestPermissionWithAbort(this.client, params, signal), permissionPersistencePolicy) {
2209
2237
  this.ctx = ctx;
2210
2238
  this.client = client;
2211
2239
  this.onPermissionCancel = onPermissionCancel;
2212
2240
  this.permissionRequester = permissionRequester;
2241
+ this.permissionPersistencePolicy = permissionPersistencePolicy;
2213
2242
  this.toolCallEmitter = new ToolCallEmitter(ctx);
2214
2243
  this.messageEmitter = new MessageEmitter(ctx);
2215
2244
  this.subagentMeta = { parentToolCallId, subagentType };
@@ -2325,7 +2354,11 @@ var SubAgentTracker = class {
2325
2354
  }, "onConfirm")
2326
2355
  };
2327
2356
  const { title, locations, kind } = this.toolCallEmitter.resolveToolMetadata(event.name, state?.args);
2328
- const permissionOptions = toPermissionOptions(fullConfirmationDetails);
2357
+ const permissionOptions = toPermissionOptions(
2358
+ fullConfirmationDetails,
2359
+ false,
2360
+ this.permissionPersistencePolicy
2361
+ );
2329
2362
  const offeredPermissionOptions = permissionOptions.map((option) => ({
2330
2363
  ...option
2331
2364
  }));
@@ -3248,6 +3281,18 @@ var LOOP_DETECTED_CONTEXT_MESSAGE = "System: this turn was terminated because th
3248
3281
  var LOOP_DETECTED_TURN_ERROR_MESSAGE = "Tool-call loop protection stopped this turn. The session is still available; send a more specific instruction to continue.";
3249
3282
  var TOOL_EXECUTION_CANCELLED_MESSAGE = "Tool execution was cancelled.";
3250
3283
  var TOOL_POST_EXECUTION_CANCELLED_MESSAGE = "The tool had already completed; its output was discarded.";
3284
+ function sameManagedConversationExpectation(left, right) {
3285
+ return left.canonicalSessionId === right.canonicalSessionId && left.root.canonicalPath === right.root.canonicalPath && left.root.device === right.root.device && left.root.inode === right.root.inode && left.child.name === right.child.name && left.child.canonicalPath === right.child.canonicalPath && left.child.device === right.child.device && left.child.inode === right.child.inode;
3286
+ }
3287
+ __name(sameManagedConversationExpectation, "sameManagedConversationExpectation");
3288
+ function managedConversationBindingError() {
3289
+ return new RequestError(
3290
+ -32004,
3291
+ "The standalone working directory is missing.",
3292
+ { errorKind: "working_directory_missing" }
3293
+ );
3294
+ }
3295
+ __name(managedConversationBindingError, "managedConversationBindingError");
3251
3296
  function createDaemonToolLoopState(repeatedToolFailureMode) {
3252
3297
  return {
3253
3298
  totalToolCalls: 0,
@@ -3814,22 +3859,55 @@ async function registerCreateSubSessionTool(config) {
3814
3859
  return;
3815
3860
  }
3816
3861
  const permissionManager = config.getPermissionManager();
3817
- if (permissionManager && !await permissionManager.isToolEnabled(ToolNames.CREATE_SUB_SESSION)) {
3862
+ const registrationStatus = permissionManager ? await permissionManager.getToolRegistrationStatus(
3863
+ ToolNames.CREATE_SUB_SESSION
3864
+ ) : "registered";
3865
+ if (registrationStatus === "disabled") {
3818
3866
  return;
3819
3867
  }
3820
3868
  const toolRegistry = config.getToolRegistry();
3869
+ if (registrationStatus === "deferred") {
3870
+ toolRegistry.registerPermissionDeferredFactory(
3871
+ ToolNames.CREATE_SUB_SESSION,
3872
+ async () => new CreateSubSessionTool(config)
3873
+ );
3874
+ await config.getGeminiClient().setTools();
3875
+ return;
3876
+ }
3821
3877
  toolRegistry.registerTool(new CreateSubSessionTool(config));
3822
3878
  toolRegistry.revealDeferredTool(ToolNames.CREATE_SUB_SESSION);
3823
3879
  toolRegistry.pinDeferredToolReveal(ToolNames.CREATE_SUB_SESSION);
3824
3880
  await config.getGeminiClient().setTools();
3825
3881
  }
3826
3882
  __name(registerCreateSubSessionTool, "registerCreateSubSessionTool");
3827
- async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.timeout(1e4), settings) {
3883
+ var STANDALONE_SLASH_COMMAND_POLICY = Object.freeze({
3884
+ allowSessionReset: false,
3885
+ allowWorkspaceSettingsWrite: false,
3886
+ persistModelSelection: false,
3887
+ blockedBuiltinCommandNames: Object.freeze([
3888
+ "cd",
3889
+ "clear",
3890
+ "directory",
3891
+ "diff",
3892
+ "dream",
3893
+ "export",
3894
+ "learn",
3895
+ "curator",
3896
+ "workflows"
3897
+ ])
3898
+ });
3899
+ var STANDALONE_PERMISSION_PERSISTENCE_POLICY = Object.freeze({
3900
+ allowProjectPersistence: false,
3901
+ allowUserPersistence: true
3902
+ });
3903
+ var STANDALONE_WORKTREE_ACTION_ERROR = "Standalone sessions cannot change or override their working directory.";
3904
+ async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.timeout(1e4), settings, executionPolicy) {
3828
3905
  const slashCommands = await getAvailableCommands(
3829
3906
  config,
3830
3907
  abortSignal,
3831
3908
  "acp",
3832
- settings
3909
+ settings,
3910
+ executionPolicy
3833
3911
  );
3834
3912
  const disabledSkillNames = config.getDisabledSkillNames();
3835
3913
  const inactiveSkillRefs = inactiveExtensionSkillRefs(config);
@@ -3923,6 +4001,11 @@ var Session = class {
3923
4001
  this.runExclusiveAutomaticHistoryMutation = runExclusiveAutomaticHistoryMutation;
3924
4002
  this.onActiveWorkChanged = onActiveWorkChanged;
3925
4003
  this.sessionId = id;
4004
+ this.requiresManagedConversationBinding = isReservedStandaloneSessionSourceType(
4005
+ this.config.getSessionSourceType?.()
4006
+ );
4007
+ this.requiresManagedConversationActivation = this.requiresManagedConversationBinding && this.config.isProvisionalWorkspace?.() === true;
4008
+ this.slashCommandPolicy = this.requiresManagedConversationBinding ? STANDALONE_SLASH_COMMAND_POLICY : void 0;
3926
4009
  this.runtimeBaseDir = config.storage.getRuntimeBaseDir();
3927
4010
  const todoStopGuardEnabled = this.settings.merged.experimental?.todoStopGuard === true && !this.config.getBareMode() && !this.config.isSafeMode();
3928
4011
  this.todoStopGuard = new DaemonTodoStopGuard(todoStopGuardEnabled);
@@ -3942,6 +4025,7 @@ var Session = class {
3942
4025
  this.#bindGoalRuntime();
3943
4026
  this.#registerBackgroundNotificationCallbacks();
3944
4027
  this.#registerSubSessionSpawner();
4028
+ this.#registerCurrentSessionScheduledTaskCreator();
3945
4029
  this.config.getWorkflowRunRegistry?.().setApprovalRequestCallback(
3946
4030
  (entry, approval, rawArgs, signal) => this.#requestWorkflowApproval(entry.runId, approval, rawArgs, signal)
3947
4031
  );
@@ -4066,6 +4150,11 @@ var Session = class {
4066
4150
  liveSpeakToUserTool;
4067
4151
  liveConversationActive;
4068
4152
  liveEndInstructionPending = false;
4153
+ requiresManagedConversationBinding;
4154
+ requiresManagedConversationActivation;
4155
+ slashCommandPolicy;
4156
+ managedConversationBinding;
4157
+ managedConversationActivation;
4069
4158
  // Message rewrite middleware (optional, installed after history replay)
4070
4159
  messageRewriter;
4071
4160
  /**
@@ -4122,6 +4211,7 @@ var Session = class {
4122
4211
  controller: new AbortController(),
4123
4212
  origin: "runtime",
4124
4213
  continuationContext: input.continuationContext,
4214
+ ...input.windDown ? { windDown: true } : {},
4125
4215
  ...input.verifierFeedback ? { verifierFeedback: input.verifierFeedback } : {},
4126
4216
  modelStarted: false
4127
4217
  });
@@ -4278,13 +4368,14 @@ var Session = class {
4278
4368
  return publication;
4279
4369
  }
4280
4370
  async #drainGoalQueue() {
4371
+ if (this.#isAutomaticWorkHeld()) return;
4281
4372
  if (this.goalQueue.length === 0) return;
4282
4373
  await this.runExclusiveAutomaticHistoryMutation(
4283
4374
  () => this.#drainGoalQueueExclusive()
4284
4375
  );
4285
4376
  }
4286
4377
  async #drainGoalQueueExclusive() {
4287
- if (this.disposed || this.closing || this.goalProcessing || this.pendingPrompt || this.pendingPromptCompletion || this.cronProcessing || this.cronAbortController || this.notificationProcessing || this.notificationAbortController) {
4378
+ if (this.disposed || this.closing || this.goalProcessing || this.pendingPrompt || this.pendingPromptCompletion || this.cronProcessing || this.cronAbortController || this.notificationProcessing || this.notificationAbortController || this.#isAutomaticWorkHeld()) {
4288
4379
  return;
4289
4380
  }
4290
4381
  const turn = this.goalQueue.shift();
@@ -4826,6 +4917,48 @@ var Session = class {
4826
4917
  };
4827
4918
  });
4828
4919
  }
4920
+ #registerCurrentSessionScheduledTaskCreator() {
4921
+ if (process.env[QWEN_CODE_SERVE_ENV] !== "1") {
4922
+ return;
4923
+ }
4924
+ this.config.setCurrentSessionScheduledTaskCreator(async (req) => {
4925
+ let resp;
4926
+ try {
4927
+ resp = await this.client.extMethod(
4928
+ SERVE_CONTROL_EXT_METHODS.createCurrentSessionScheduledTask,
4929
+ {
4930
+ callerSessionId: this.sessionId,
4931
+ promptId: getInvocationContext()?.promptId ?? req.promptId,
4932
+ cron: req.cron,
4933
+ prompt: req.prompt,
4934
+ recurring: req.recurring
4935
+ }
4936
+ );
4937
+ } catch (error) {
4938
+ const code = error && typeof error === "object" && "code" in error ? error.code : void 0;
4939
+ if (code === -32601) {
4940
+ throw new Error(
4941
+ "current_session_scheduling_unavailable: The daemon does not support current-session scheduling."
4942
+ );
4943
+ }
4944
+ const data = isRecord2(error) && isRecord2(error["data"]) ? error["data"] : void 0;
4945
+ const errorKind = data?.["errorKind"];
4946
+ if (typeof errorKind === "string") {
4947
+ const hint = data?.["hint"];
4948
+ throw new Error(
4949
+ `${errorKind}: ${typeof hint === "string" && hint.length > 0 ? hint : "Current-session scheduled task creation was rejected."}`
4950
+ );
4951
+ }
4952
+ throw error;
4953
+ }
4954
+ if (typeof resp["id"] !== "string" || resp["id"].length === 0 || typeof resp["cron"] !== "string" || resp["cron"].length === 0) {
4955
+ throw new Error(
4956
+ "cron_create: bridge returned an invalid scheduled-task result"
4957
+ );
4958
+ }
4959
+ return { id: resp["id"], cron: resp["cron"] };
4960
+ });
4961
+ }
4829
4962
  async enableLiveScreenContext() {
4830
4963
  const registry = this.config.getToolRegistry();
4831
4964
  const existing = registry.getTool(CAPTURE_SCREEN_CONTEXT_TOOL_NAME);
@@ -4984,6 +5117,7 @@ var Session = class {
4984
5117
  * mount.
4985
5118
  */
4986
5119
  startCronScheduler() {
5120
+ if (this.#isAutomaticWorkHeld()) return;
4987
5121
  this.#startCronSchedulerInRuntime().catch((error) => {
4988
5122
  debugLogger6.warn(
4989
5123
  `Cron scheduler startup failed [session ${this.sessionId}]: ${error}`
@@ -4993,6 +5127,113 @@ var Session = class {
4993
5127
  getConfig() {
4994
5128
  return this.config;
4995
5129
  }
5130
+ installPendingManagedConversationBinding(expectation, assertIdentity) {
5131
+ if (!this.requiresManagedConversationBinding || expectation.canonicalSessionId !== this.sessionId) {
5132
+ throw managedConversationBindingError();
5133
+ }
5134
+ if (this.managedConversationBinding && this.managedConversationBinding.state !== "released" && !sameManagedConversationExpectation(
5135
+ this.managedConversationBinding.expectation,
5136
+ expectation
5137
+ )) {
5138
+ throw managedConversationBindingError();
5139
+ }
5140
+ this.managedConversationBinding = {
5141
+ expectation,
5142
+ assertIdentity,
5143
+ state: "pending"
5144
+ };
5145
+ }
5146
+ installManagedConversationActivation(run, onRelease) {
5147
+ if (!this.requiresManagedConversationActivation || this.managedConversationActivation) {
5148
+ throw managedConversationBindingError();
5149
+ }
5150
+ this.managedConversationActivation = {
5151
+ run,
5152
+ ...onRelease ? { onRelease } : {},
5153
+ releaseScheduled: false,
5154
+ state: "pending"
5155
+ };
5156
+ }
5157
+ async activateManagedConversation() {
5158
+ if (!this.requiresManagedConversationActivation) return;
5159
+ const activation = this.managedConversationActivation;
5160
+ if (!activation) throw managedConversationBindingError();
5161
+ if (activation.state === "ready") return;
5162
+ if (activation.state === "poisoned") throw activation.error;
5163
+ if (activation.promise) return activation.promise;
5164
+ activation.state = "activating";
5165
+ const promise = activation.run().then(() => {
5166
+ activation.state = "ready";
5167
+ }).catch((error) => {
5168
+ activation.state = "poisoned";
5169
+ activation.error = error;
5170
+ throw error;
5171
+ });
5172
+ activation.promise = promise;
5173
+ return promise;
5174
+ }
5175
+ async commitManagedConversationBinding(expectation) {
5176
+ const binding = this.managedConversationBinding;
5177
+ if (!this.requiresManagedConversationBinding || !binding || !sameManagedConversationExpectation(binding.expectation, expectation)) {
5178
+ throw managedConversationBindingError();
5179
+ }
5180
+ if (binding.state === "committed" || binding.state === "released") return;
5181
+ if (!isSameConversationPath(
5182
+ this.config.getTargetDir(),
5183
+ binding.expectation.child.canonicalPath
5184
+ )) {
5185
+ throw managedConversationBindingError();
5186
+ }
5187
+ await binding.assertIdentity();
5188
+ await this.activateManagedConversation();
5189
+ await binding.assertIdentity();
5190
+ binding.state = "committed";
5191
+ }
5192
+ async releaseManagedConversationBinding(expectation) {
5193
+ const binding = this.managedConversationBinding;
5194
+ if (!this.requiresManagedConversationBinding || !binding || binding.state === "pending" || !sameManagedConversationExpectation(binding.expectation, expectation)) {
5195
+ throw managedConversationBindingError();
5196
+ }
5197
+ if (binding.state === "released") return;
5198
+ if (!isSameConversationPath(
5199
+ this.config.getTargetDir(),
5200
+ binding.expectation.child.canonicalPath
5201
+ )) {
5202
+ throw managedConversationBindingError();
5203
+ }
5204
+ await binding.assertIdentity();
5205
+ binding.state = "released";
5206
+ const activation = this.managedConversationActivation;
5207
+ if (activation && !activation.releaseScheduled) {
5208
+ activation.releaseScheduled = true;
5209
+ try {
5210
+ activation.onRelease?.();
5211
+ } catch (error) {
5212
+ debugLogger6.warn(
5213
+ `Managed conversation release callback failed [session ${this.sessionId}]: ${error}`
5214
+ );
5215
+ }
5216
+ }
5217
+ this.startCronScheduler();
5218
+ void this.sendAvailableCommandsUpdate();
5219
+ void this.#drainGoalQueue();
5220
+ void this.#drainCronQueue();
5221
+ void this.#drainNotificationQueue();
5222
+ }
5223
+ async assertManagedConversationBindingReady() {
5224
+ if (!this.requiresManagedConversationBinding) return;
5225
+ const binding = this.managedConversationBinding;
5226
+ if (binding?.state !== "released" || !isSameConversationPath(
5227
+ this.config.getTargetDir(),
5228
+ binding.expectation.child.canonicalPath
5229
+ )) {
5230
+ throw managedConversationBindingError();
5231
+ }
5232
+ await binding.assertIdentity();
5233
+ }
5234
+ #isAutomaticWorkHeld() {
5235
+ return this.requiresManagedConversationBinding && this.managedConversationBinding?.state !== "released";
5236
+ }
4996
5237
  shouldHintAskUserQuestionRestore() {
4997
5238
  if (this.config.getRestoreAskUserQuestion?.() !== true) return false;
4998
5239
  if (this.pendingPrompt && !this.pendingPrompt.signal.aborted) return false;
@@ -5010,6 +5251,9 @@ var Session = class {
5010
5251
  "Session history mutation is in progress"
5011
5252
  );
5012
5253
  }
5254
+ if (this.requiresManagedConversationBinding) {
5255
+ await this.assertManagedConversationBindingReady();
5256
+ }
5013
5257
  try {
5014
5258
  await this.config.assertCanStartTurn();
5015
5259
  } catch (error) {
@@ -5020,6 +5264,9 @@ var Session = class {
5020
5264
  }
5021
5265
  throw error;
5022
5266
  }
5267
+ if (this.requiresManagedConversationBinding) {
5268
+ await this.assertManagedConversationBindingReady();
5269
+ }
5023
5270
  if (this.closing) {
5024
5271
  throw RequestError.invalidParams(void 0, "Session is closing");
5025
5272
  }
@@ -5081,6 +5328,9 @@ var Session = class {
5081
5328
  }
5082
5329
  return holds;
5083
5330
  }
5331
+ hasStandaloneRelocationBlockers() {
5332
+ return this.collectActiveWorkHolds().length > 0 || this.config.getMonitorRegistry().getAll().some((monitor) => monitor.status === "running");
5333
+ }
5084
5334
  #activeWorkChanged() {
5085
5335
  this.onActiveWorkChanged?.();
5086
5336
  }
@@ -5236,6 +5486,7 @@ var Session = class {
5236
5486
  this.unsubscribeChatRecordingFailure?.();
5237
5487
  this.unsubscribeChatRecordingFailure = void 0;
5238
5488
  this.config.setSubSessionSpawner(void 0);
5489
+ this.config.setCurrentSessionScheduledTaskCreator(void 0);
5239
5490
  this.config.getWorkflowRunRegistry?.().setApprovalRequestCallback(void 0);
5240
5491
  this.workflowApprovalAbortController.abort(SESSION_DISPOSE_ABORT_REASON);
5241
5492
  }
@@ -5926,6 +6177,7 @@ var Session = class {
5926
6177
  return goalTurn ? goalTurnContext.run(goalTurn.permit, execute) : goalTurnContext.exit(execute);
5927
6178
  }
5928
6179
  async #executePromptInner(params, pendingSend, responseCapture, modelPrompt, rejectOnLoopDetected = false, goalTurn, channelTurn = false) {
6180
+ let managedMemoryRecallStarted = false;
5929
6181
  return Storage.runWithRuntimeBaseDir(
5930
6182
  this.runtimeBaseDir,
5931
6183
  this.config.getWorkingDir(),
@@ -6071,7 +6323,8 @@ var Session = class {
6071
6323
  // long-lived Session; without this the goal-state
6072
6324
  // subscription stays on the disposed instance.
6073
6325
  startNewSession: /* @__PURE__ */ __name(() => this.rebindGoalRuntimeForNewSession(), "startNewSession")
6074
- }
6326
+ },
6327
+ this.slashCommandPolicy
6075
6328
  );
6076
6329
  if (slashCommandName === "advisor" && pendingSend.signal.aborted && slashCommandResult.type === "message") {
6077
6330
  this.todoStopGuard.suspend();
@@ -6137,6 +6390,7 @@ var Session = class {
6137
6390
  const hooksEnabled = !this.config.getDisableAllHooks?.();
6138
6391
  const messageBus = this.config.getMessageBus?.();
6139
6392
  const isRuntimeContinuation = goalTurn?.origin === "runtime";
6393
+ const isFreshUserTurn = !isRetry && !isContinue && !isRestoreAskUserQuestion && !isRuntimeContinuation;
6140
6394
  if (!isContinue && !isRestoreAskUserQuestion && !isRuntimeContinuation && hooksEnabled && messageBus && this.config.hasHooksForEvent?.("UserPromptSubmit")) {
6141
6395
  const response = await messageBus.request(
6142
6396
  {
@@ -6165,6 +6419,10 @@ var Session = class {
6165
6419
  ];
6166
6420
  }
6167
6421
  }
6422
+ if (isFreshUserTurn) {
6423
+ managedMemoryRecallStarted = true;
6424
+ this.config.getGeminiClient().beginManagedAutoMemoryRecall(promptText, pendingSend.signal);
6425
+ }
6168
6426
  if (!continuesCurrentWorkChain && !this.todoStopGuard.enabled) {
6169
6427
  this.#resetTodoStopGuardBackgroundLineage();
6170
6428
  }
@@ -6190,6 +6448,12 @@ var Session = class {
6190
6448
  }
6191
6449
  }
6192
6450
  const systemReminders = await this.#buildInitialSystemReminders();
6451
+ if (isFreshUserTurn) {
6452
+ const memory = await this.config.getGeminiClient().consumeManagedAutoMemoryRecall("initial");
6453
+ if (memory?.prompt) {
6454
+ systemReminders.unshift({ text: memory.prompt });
6455
+ }
6456
+ }
6193
6457
  if (systemReminders.length > 0 && !isRestoreAskUserQuestion) {
6194
6458
  const alreadyHasReminder = isContinue && parts.some(
6195
6459
  (part) => isSystemReminderContent({ role: "user", parts: [part] })
@@ -6587,7 +6851,32 @@ ${this.pendingRecoveredAgentsNotice}
6587
6851
  getActiveInteractionSpan()
6588
6852
  );
6589
6853
  }
6590
- return result;
6854
+ if (isFreshUserTurn && result.stopReason === "end_turn" && !result.loopProtectionStopped && this.config.getManagedAutoMemoryEnabled()) {
6855
+ const memoryManager = this.config.getMemoryManager();
6856
+ const history = this.#getCurrentChat().getHistoryShallow();
6857
+ void memoryManager.scheduleExtract({
6858
+ projectRoot: this.config.getProjectRoot(),
6859
+ sessionId: this.config.getSessionId(),
6860
+ history,
6861
+ config: this.config
6862
+ }).catch((error) => {
6863
+ debugLogger6.warn(
6864
+ "Failed to schedule ACP managed auto-memory extraction.",
6865
+ error
6866
+ );
6867
+ });
6868
+ void memoryManager.scheduleDream({
6869
+ projectRoot: this.config.getProjectRoot(),
6870
+ sessionId: this.config.getSessionId(),
6871
+ config: this.config
6872
+ }).catch((error) => {
6873
+ debugLogger6.warn(
6874
+ "Failed to schedule ACP managed auto-memory dream.",
6875
+ error
6876
+ );
6877
+ });
6878
+ }
6879
+ return { stopReason: result.stopReason };
6591
6880
  } finally {
6592
6881
  logConversationFinishedEvent(
6593
6882
  this.config,
@@ -6606,7 +6895,11 @@ ${this.pendingRecoveredAgentsNotice}
6606
6895
  (result) => result.stopReason === "cancelled" ? "cancelled" : "ok"
6607
6896
  );
6608
6897
  }
6609
- );
6898
+ ).finally(() => {
6899
+ if (managedMemoryRecallStarted) {
6900
+ this.config.getGeminiClient().finishManagedAutoMemoryRecall();
6901
+ }
6902
+ });
6610
6903
  }
6611
6904
  async #handleStopHookLoop(pendingSend, promptId, hooksEnabled, messageBus, allowExternalHooks = true, modelOverride, responseCapture, rejectOnLoopDetected = false) {
6612
6905
  const stopHookBlockingCap = this.config.getStopHookBlockingCap();
@@ -6673,7 +6966,7 @@ ${this.pendingRecoveredAgentsNotice}
6673
6966
  }
6674
6967
  );
6675
6968
  if (continuation2.kind === "terminal") {
6676
- return { stopReason: continuation2.stopReason };
6969
+ return continuation2;
6677
6970
  }
6678
6971
  continue;
6679
6972
  }
@@ -6758,7 +7051,7 @@ ${this.pendingRecoveredAgentsNotice}
6758
7051
  }
6759
7052
  );
6760
7053
  if (continuation2.kind === "terminal") {
6761
- return { stopReason: continuation2.stopReason };
7054
+ return continuation2;
6762
7055
  }
6763
7056
  continue;
6764
7057
  }
@@ -6862,7 +7155,7 @@ ${this.pendingRecoveredAgentsNotice}
6862
7155
  stopHookReasons = stopHookReasons.slice(0, -1);
6863
7156
  }
6864
7157
  if (continuation.kind === "terminal") {
6865
- return { stopReason: continuation.stopReason };
7158
+ return continuation;
6866
7159
  }
6867
7160
  }
6868
7161
  }
@@ -7317,6 +7610,7 @@ ${this.pendingRecoveredAgentsNotice}
7317
7610
  // and background-notification turns keep the graceful end-turn
7318
7611
  // handling they had before loop stops became rejections.
7319
7612
  stopReason: options.rejectOnLoopDetected ? cancelledOrThrowLoopDetected(pendingSend.signal, toolLoopState) : getAbortAwareEndTurnStopReason(pendingSend.signal),
7613
+ loopProtectionStopped: true,
7320
7614
  ...supersededAutomaticContinuation ? { supersededAutomaticContinuation: true } : {}
7321
7615
  };
7322
7616
  }
@@ -7329,6 +7623,14 @@ ${this.pendingRecoveredAgentsNotice}
7329
7623
  options.rejectOnLoopDetected ?? false
7330
7624
  );
7331
7625
  nextMessage = nextAfterTools.message;
7626
+ if (nextAfterTools.stoppedByRepeatedToolFailure) {
7627
+ return {
7628
+ kind: "terminal",
7629
+ stopReason: options.rejectOnLoopDetected ? cancelledOrThrowLoopDetected(pendingSend.signal, toolLoopState) : getAbortAwareEndTurnStopReason(pendingSend.signal),
7630
+ loopProtectionStopped: true,
7631
+ ...supersededAutomaticContinuation ? { supersededAutomaticContinuation: true } : {}
7632
+ };
7633
+ }
7332
7634
  if (nextAfterTools.hadMidTurnUserInput) {
7333
7635
  nextGuardContinuation = void 0;
7334
7636
  continue;
@@ -7627,6 +7929,14 @@ ${this.pendingRecoveredAgentsNotice}
7627
7929
  );
7628
7930
  return { responseStream: null, stopReason: "cancelled" };
7629
7931
  }
7932
+ if (message[0]?.functionResponse) {
7933
+ const memory = await geminiClient.consumeManagedAutoMemoryRecall("tool_result");
7934
+ if (memory?.prompt) {
7935
+ message = insertAfterFunctionResponses(message, [
7936
+ { text: memory.prompt }
7937
+ ]);
7938
+ }
7939
+ }
7630
7940
  const chat = this.#getCurrentChat();
7631
7941
  const model = options.getModelOverride?.() ?? options.modelOverride ?? this.config.getModel();
7632
7942
  const request = {
@@ -8062,15 +8372,18 @@ ${this.pendingRecoveredAgentsNotice}
8062
8372
  */
8063
8373
  async #startCronSchedulerIfNeeded() {
8064
8374
  if (this.disposed) return;
8375
+ if (this.#isAutomaticWorkHeld()) return;
8065
8376
  if (!this.config.isCronEnabled()) return;
8066
8377
  if (this.cronDisabledByTokenLimit) return;
8067
8378
  const scheduler = this.config.getCronScheduler();
8068
- try {
8069
- await scheduler.enableDurable(this.sessionId);
8070
- } catch (err) {
8071
- debugLogger6.warn(
8072
- `Durable cron init failed \u2014 persistent tasks will not fire in this session: ${err}`
8073
- );
8379
+ if (!this.requiresManagedConversationBinding) {
8380
+ try {
8381
+ await scheduler.enableDurable(this.sessionId);
8382
+ } catch (err) {
8383
+ debugLogger6.warn(
8384
+ `Durable cron init failed \u2014 persistent tasks will not fire in this session: ${err}`
8385
+ );
8386
+ }
8074
8387
  }
8075
8388
  if (this.disposed) return;
8076
8389
  if (!scheduler.hasPendingWork) return;
@@ -8146,6 +8459,7 @@ ${this.pendingRecoveredAgentsNotice}
8146
8459
  async #drainCronQueue() {
8147
8460
  if (this.disposed) return;
8148
8461
  if (this.closing) return;
8462
+ if (this.#isAutomaticWorkHeld()) return;
8149
8463
  if (this.cronProcessing) return;
8150
8464
  if (this.pendingPrompt) return;
8151
8465
  if (this.goalProcessing) return;
@@ -8158,6 +8472,7 @@ ${this.pendingRecoveredAgentsNotice}
8158
8472
  }
8159
8473
  async #drainCronQueueExclusive() {
8160
8474
  if (this.disposed || this.closing || this.cronProcessing) return;
8475
+ if (this.#isAutomaticWorkHeld()) return;
8161
8476
  if (this.pendingPrompt || this.notificationProcessing) return;
8162
8477
  if (this.#deferAutomaticQueueDrainUntilTurnsSettle()) return;
8163
8478
  if (this.#nextCronQueueIndex() < 0) return;
@@ -8751,6 +9066,7 @@ ${this.pendingRecoveredAgentsNotice}
8751
9066
  async #drainNotificationQueue() {
8752
9067
  if (this.disposed) return;
8753
9068
  if (this.closing) return;
9069
+ if (this.#isAutomaticWorkHeld()) return;
8754
9070
  if (this.notificationProcessing) return;
8755
9071
  if (this.pendingPrompt || this.goalProcessing || this.cronProcessing || this.cronAbortController) {
8756
9072
  return;
@@ -8764,6 +9080,7 @@ ${this.pendingRecoveredAgentsNotice}
8764
9080
  }
8765
9081
  async #drainNotificationQueueExclusive() {
8766
9082
  if (this.disposed || this.closing || this.notificationProcessing) return;
9083
+ if (this.#isAutomaticWorkHeld()) return;
8767
9084
  if (this.pendingPrompt || this.cronProcessing || this.cronAbortController) {
8768
9085
  return;
8769
9086
  }
@@ -9183,12 +9500,17 @@ ${this.pendingRecoveredAgentsNotice}
9183
9500
  reloadSkillSettings() {
9184
9501
  this.settings.reloadScopeFromDisk("Workspace" /* Workspace */);
9185
9502
  }
9186
- async sendAvailableCommandsUpdateOrThrow() {
9187
- const { availableCommands, availableSkills, availableSkillDetails } = await buildAvailableCommandsSnapshot(
9503
+ buildAvailableCommandsSnapshot() {
9504
+ return buildAvailableCommandsSnapshot(
9188
9505
  this.config,
9189
9506
  void 0,
9190
- this.settings
9507
+ this.settings,
9508
+ this.slashCommandPolicy
9191
9509
  );
9510
+ }
9511
+ async sendAvailableCommandsUpdateOrThrow() {
9512
+ if (this.#isAutomaticWorkHeld()) return;
9513
+ const { availableCommands, availableSkills, availableSkillDetails } = await this.buildAvailableCommandsSnapshot();
9192
9514
  const update = {
9193
9515
  sessionUpdate: "available_commands_update",
9194
9516
  availableCommands,
@@ -9331,7 +9653,8 @@ ${this.pendingRecoveredAgentsNotice}
9331
9653
  }).catch((error) => {
9332
9654
  debugLogger6.debug("model-update extNotification failed", error);
9333
9655
  });
9334
- if (options.persistDefault ?? true) {
9656
+ const persistDefault = !this.requiresManagedConversationBinding && (options.persistDefault ?? true);
9657
+ if (persistDefault) {
9335
9658
  const persistScope = getPersistScopeForModelSelection(this.settings);
9336
9659
  this.settings.setValue(
9337
9660
  persistScope,
@@ -9946,11 +10269,6 @@ ${this.pendingRecoveredAgentsNotice}
9946
10269
  * branches in `GeminiClient.sendMessageStream` (`client.ts:848-878`) —
9947
10270
  * the ACP path bypasses that code, so without this helper plan mode is
9948
10271
  * silently inert and subagent/arena sessions lose context.
9949
- *
9950
- * Scope note: the `relevantAutoMemory` reminder is intentionally NOT
9951
- * included here. Managed auto-memory requires a prefetch pipeline that
9952
- * lives in `GeminiClient`, and porting it into the ACP path is tracked
9953
- * separately as part of the broader middleware-alignment work.
9954
10272
  */
9955
10273
  async #buildInitialSystemReminders() {
9956
10274
  const reminders = [];
@@ -10231,6 +10549,18 @@ ${this.pendingRecoveredAgentsNotice}
10231
10549
  const isAgentTool = tool.name === ToolNames.AGENT;
10232
10550
  const isExitPlanModeTool = tool.name === ToolNames.EXIT_PLAN_MODE;
10233
10551
  const isEnterPlanModeTool = tool.name === ToolNames.ENTER_PLAN_MODE;
10552
+ const requestsAgentWorkingDirectory = isAgentTool && (args["isolation"] === "worktree" || typeof args["working_dir"] === "string" && args["working_dir"].trim().length > 0);
10553
+ if (this.requiresManagedConversationBinding && (requestsAgentWorkingDirectory || tool.name === ToolNames.ENTER_WORKTREE || tool.name === ToolNames.EXIT_WORKTREE)) {
10554
+ return earlyErrorResponse(
10555
+ new Error(STANDALONE_WORKTREE_ACTION_ERROR),
10556
+ toolName,
10557
+ {
10558
+ status: "error",
10559
+ errorType: "execution_denied" /* EXECUTION_DENIED */,
10560
+ executionStatus: "not_started"
10561
+ }
10562
+ );
10563
+ }
10234
10564
  if (isAgentTool) {
10235
10565
  agentToolAbortController = new AbortController();
10236
10566
  activeToolAbortSignal = agentToolAbortController.signal;
@@ -10270,7 +10600,8 @@ ${this.pendingRecoveredAgentsNotice}
10270
10600
  agentToolAbortController?.abort(USER_CANCEL_ABORT_REASON);
10271
10601
  onStopAfterPermissionCancel?.();
10272
10602
  },
10273
- (params, signal) => this.#requestPermissionQueued(params, signal)
10603
+ (params, signal) => this.#requestPermissionQueued(params, signal),
10604
+ this.requiresManagedConversationBinding ? STANDALONE_PERMISSION_PERSISTENCE_POLICY : void 0
10274
10605
  );
10275
10606
  subAgentCleanupFunctions = subSubAgentTracker.setup(
10276
10607
  taskEventEmitter,
@@ -10688,7 +11019,8 @@ ${this.pendingRecoveredAgentsNotice}
10688
11019
  }
10689
11020
  const permissionOptions = toPermissionOptions(
10690
11021
  confirmationDetails,
10691
- pmForcedAsk
11022
+ pmForcedAsk,
11023
+ this.requiresManagedConversationBinding ? STANDALONE_PERMISSION_PERSISTENCE_POLICY : void 0
10692
11024
  );
10693
11025
  const offeredPermissionOptions = permissionOptions.map(
10694
11026
  (option) => ({ ...option })
@@ -10841,7 +11173,7 @@ ${this.pendingRecoveredAgentsNotice}
10841
11173
  const modeUpdateCancellation = cancelBeforeExecutionIfAborted(toolName);
10842
11174
  if (modeUpdateCancellation) return modeUpdateCancellation;
10843
11175
  }
10844
- if (outcome === "proceed_always" /* ProceedAlways */ || outcome === "proceed_always_project" /* ProceedAlwaysProject */ || outcome === "proceed_always_user" /* ProceedAlwaysUser */) {
11176
+ if (outcome === "proceed_always_project" /* ProceedAlwaysProject */ || outcome === "proceed_always_user" /* ProceedAlwaysUser */) {
10845
11177
  await persistPermissionOutcome(
10846
11178
  outcome,
10847
11179
  confirmationDetails,
@@ -11479,6 +11811,9 @@ ${this.pendingRecoveredAgentsNotice}
11479
11811
  executionStatus
11480
11812
  });
11481
11813
  } finally {
11814
+ if (terminalStatus && terminalStatus !== "cancelled") {
11815
+ this.config.getGeminiClient().recordCompletedToolCall(toolName, args);
11816
+ }
11482
11817
  if (terminalStatus === "cancelled") {
11483
11818
  endToolSpan(toolSpan, { success: false, cancelled: true });
11484
11819
  } else {
@@ -11551,6 +11886,13 @@ ${this.pendingRecoveredAgentsNotice}
11551
11886
  return null;
11552
11887
  }
11553
11888
  case "unsupported": {
11889
+ if (result.originalType === "unsupported_action") {
11890
+ throw new RequestError(
11891
+ -32004,
11892
+ "This action is not supported in this standalone session.",
11893
+ { errorKind: "unsupported_action" }
11894
+ );
11895
+ }
11554
11896
  const unsupportedError = `Slash command not supported in ACP integration: ${result.reason}`;
11555
11897
  throw new Error(unsupportedError);
11556
11898
  }
@@ -13706,7 +14048,8 @@ function getSessionSource(params) {
13706
14048
  }
13707
14049
  return {
13708
14050
  sourceType: value["sourceType"],
13709
- ...typeof value["sourceId"] === "string" ? { sourceId: value["sourceId"] } : {}
14051
+ ...typeof value["sourceId"] === "string" ? { sourceId: value["sourceId"] } : {},
14052
+ ...value[DAEMON_OWNED_STANDALONE_CREATION_KEY] === true ? { daemonOwnedStandaloneCreation: true } : {}
13710
14053
  };
13711
14054
  }
13712
14055
  __name(getSessionSource, "getSessionSource");
@@ -15152,6 +15495,100 @@ function isOwnerOnlyDirectory(stats) {
15152
15495
  return (stats.mode & 63) === 0;
15153
15496
  }
15154
15497
  __name(isOwnerOnlyDirectory, "isOwnerOnlyDirectory");
15498
+ function hasOnlyKeys(value, keys) {
15499
+ const actual = Object.keys(value).sort();
15500
+ const expected = [...keys].sort();
15501
+ return actual.length === expected.length && actual.every((key, index) => key === expected[index]);
15502
+ }
15503
+ __name(hasOnlyKeys, "hasOnlyKeys");
15504
+ function isManagedConversationPath(value) {
15505
+ return typeof value === "string" && value.length > 0 && !value.includes("\0") && path6.isAbsolute(value);
15506
+ }
15507
+ __name(isManagedConversationPath, "isManagedConversationPath");
15508
+ function isManagedConversationIdentityNumber(value) {
15509
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
15510
+ }
15511
+ __name(isManagedConversationIdentityNumber, "isManagedConversationIdentityNumber");
15512
+ function parseConversationDirectoryExpectation(value) {
15513
+ if (value === void 0) return void 0;
15514
+ if (!isObjectRecord(value) || !hasOnlyKeys(value, ["canonicalSessionId", "root", "child"])) {
15515
+ throw RequestError.invalidParams(
15516
+ void 0,
15517
+ "Invalid managed conversation directory expectation"
15518
+ );
15519
+ }
15520
+ const canonicalSessionId = value["canonicalSessionId"];
15521
+ const root = value["root"];
15522
+ const child = value["child"];
15523
+ const parsedSessionId = parseCallerSuppliedSessionId(canonicalSessionId);
15524
+ if (parsedSessionId.kind !== "valid" || parsedSessionId.sessionId !== canonicalSessionId || !isObjectRecord(root) || !hasOnlyKeys(root, ["canonicalPath", "device", "inode"]) || !isManagedConversationPath(root["canonicalPath"]) || !isManagedConversationIdentityNumber(root["device"]) || !isManagedConversationIdentityNumber(root["inode"]) || !isObjectRecord(child) || !hasOnlyKeys(child, ["name", "canonicalPath", "device", "inode"]) || typeof child["name"] !== "string" || child["name"] !== getConversationDirectoryName(canonicalSessionId) || !isManagedConversationPath(child["canonicalPath"]) || !isManagedConversationIdentityNumber(child["device"]) || !isManagedConversationIdentityNumber(child["inode"]) || !isSameConversationPath(
15525
+ path6.dirname(child["canonicalPath"]),
15526
+ root["canonicalPath"]
15527
+ ) || path6.basename(child["canonicalPath"]) !== child["name"]) {
15528
+ throw RequestError.invalidParams(
15529
+ void 0,
15530
+ "Invalid managed conversation directory expectation"
15531
+ );
15532
+ }
15533
+ return {
15534
+ canonicalSessionId,
15535
+ root: {
15536
+ canonicalPath: root["canonicalPath"],
15537
+ device: root["device"],
15538
+ inode: root["inode"]
15539
+ },
15540
+ child: {
15541
+ name: child["name"],
15542
+ canonicalPath: child["canonicalPath"],
15543
+ device: child["device"],
15544
+ inode: child["inode"]
15545
+ }
15546
+ };
15547
+ }
15548
+ __name(parseConversationDirectoryExpectation, "parseConversationDirectoryExpectation");
15549
+ function managedConversationDirectoryError(missing) {
15550
+ return new RequestError(
15551
+ -32004,
15552
+ missing ? "The standalone working directory is missing." : "The standalone working directory identity is compromised.",
15553
+ {
15554
+ errorKind: missing ? "working_directory_missing" : "working_directory_compromised"
15555
+ }
15556
+ );
15557
+ }
15558
+ __name(managedConversationDirectoryError, "managedConversationDirectoryError");
15559
+ async function assertManagedConversationDirectoryIdentity(expectation) {
15560
+ let rootBefore;
15561
+ let canonicalRoot;
15562
+ let rootAfter;
15563
+ try {
15564
+ rootBefore = await fs3.lstat(expectation.root.canonicalPath);
15565
+ canonicalRoot = await fs3.realpath(expectation.root.canonicalPath);
15566
+ rootAfter = await fs3.lstat(canonicalRoot);
15567
+ } catch (error) {
15568
+ throw managedConversationDirectoryError(
15569
+ error.code === "ENOENT"
15570
+ );
15571
+ }
15572
+ if (!isOwnerOnlyDirectory(rootBefore) || !isOwnerOnlyDirectory(rootAfter) || !isSameConversationPath(canonicalRoot, expectation.root.canonicalPath) || rootBefore.dev !== expectation.root.device || rootBefore.ino !== expectation.root.inode || rootAfter.dev !== expectation.root.device || rootAfter.ino !== expectation.root.inode) {
15573
+ throw managedConversationDirectoryError(false);
15574
+ }
15575
+ let childBefore;
15576
+ let canonicalChild;
15577
+ let childAfter;
15578
+ try {
15579
+ childBefore = await fs3.lstat(expectation.child.canonicalPath);
15580
+ canonicalChild = await fs3.realpath(expectation.child.canonicalPath);
15581
+ childAfter = await fs3.lstat(canonicalChild);
15582
+ } catch (error) {
15583
+ throw managedConversationDirectoryError(
15584
+ error.code === "ENOENT"
15585
+ );
15586
+ }
15587
+ if (!isOwnerOnlyDirectory(childBefore) || !isOwnerOnlyDirectory(childAfter) || !isSameConversationPath(canonicalChild, expectation.child.canonicalPath) || childBefore.dev !== expectation.child.device || childBefore.ino !== expectation.child.inode || childAfter.dev !== expectation.child.device || childAfter.ino !== expectation.child.inode) {
15588
+ throw managedConversationDirectoryError(false);
15589
+ }
15590
+ }
15591
+ __name(assertManagedConversationDirectoryIdentity, "assertManagedConversationDirectoryIdentity");
15155
15592
  var QwenAgent = class {
15156
15593
  constructor(config, settings, argv, connection, expectedPrivateParentCapability, sessionWriterLeaseEnabledAtStartup = false, managedToolInvocationGuard, externalToolGuardProviderAttached = false) {
15157
15594
  this.config = config;
@@ -16046,7 +16483,7 @@ var QwenAgent = class {
16046
16483
  }
16047
16484
  this.clientCapabilities = args.clientCapabilities;
16048
16485
  const authMethods = buildAuthMethods();
16049
- const version = "0.22.2-preview.1";
16486
+ const version = "0.22.2";
16050
16487
  const response = {
16051
16488
  protocolVersion: PROTOCOL_VERSION,
16052
16489
  agentInfo: {
@@ -16183,6 +16620,15 @@ var QwenAgent = class {
16183
16620
  const releaseStartingSessionId = requestedSessionId ? this.reserveStartingSessionId(requestedSessionId) : void 0;
16184
16621
  try {
16185
16622
  const sessionSource = getSessionSource(params);
16623
+ const provisionalStandalone = isReservedStandaloneSessionSourceType(
16624
+ sessionSource?.sourceType
16625
+ );
16626
+ if (sessionSource && isReservedStandaloneSessionSourceType(sessionSource.sourceType) && (sessionSource.daemonOwnedStandaloneCreation !== true || !this.isTrustedManagedParent())) {
16627
+ throw RequestError.invalidParams(
16628
+ void 0,
16629
+ "`standalone` is reserved for daemon-owned session creation"
16630
+ );
16631
+ }
16186
16632
  const parentContext = extractDaemonTraceContext(params);
16187
16633
  return await withDaemonSpan(
16188
16634
  "qwen-code.daemon.session_start",
@@ -16208,14 +16654,21 @@ var QwenAgent = class {
16208
16654
  );
16209
16655
  let session;
16210
16656
  try {
16211
- await profiler.time("auth", () => this.ensureAuthenticated(config));
16212
- profiler.timeSync(
16213
- "file_system_setup",
16214
- () => this.setupFileSystem(config)
16215
- );
16657
+ if (!provisionalStandalone) {
16658
+ await profiler.time(
16659
+ "auth",
16660
+ () => this.ensureAuthenticated(config)
16661
+ );
16662
+ profiler.timeSync(
16663
+ "file_system_setup",
16664
+ () => this.setupFileSystem(config)
16665
+ );
16666
+ }
16216
16667
  session = await profiler.time(
16217
16668
  "session_register",
16218
- () => this.createAndStoreSession(config, settings)
16669
+ () => this.createAndStoreSession(config, settings, void 0, {
16670
+ deferWorkspaceActivation: provisionalStandalone
16671
+ })
16219
16672
  );
16220
16673
  } catch (error) {
16221
16674
  return this.cleanupAfterRequestFailure(error, async () => {
@@ -16259,6 +16712,15 @@ var QwenAgent = class {
16259
16712
  async loadSessionWithProfiler(params, initialSessionId, profiler) {
16260
16713
  let sessionId = initialSessionId;
16261
16714
  const sessionSource = getSessionSource(params);
16715
+ const provisionalStandalone = isReservedStandaloneSessionSourceType(
16716
+ sessionSource?.sourceType
16717
+ );
16718
+ if (provisionalStandalone && (sessionSource?.daemonOwnedStandaloneCreation !== true || !this.isTrustedManagedParent())) {
16719
+ throw RequestError.invalidParams(
16720
+ void 0,
16721
+ "`standalone` is reserved for daemon-owned session restore"
16722
+ );
16723
+ }
16262
16724
  const restoreOptions = loadRestoreOptions(params);
16263
16725
  const suppressRestoreAskUserQuestion = params._meta?.[DAEMON_SUPPRESS_RESTORE_ASK_USER_QUESTION_META_KEY] === true;
16264
16726
  const withRestoreHint = /* @__PURE__ */ __name((session, response) => suppressRestoreAskUserQuestion ? response : this.withAskUserQuestionRestoreHint(session, response), "withRestoreHint");
@@ -16421,21 +16883,37 @@ var QwenAgent = class {
16421
16883
  } : {}
16422
16884
  })), "buildResponse");
16423
16885
  try {
16424
- await profiler.time(
16425
- "restore_session_model",
16426
- () => restoreSessionModelThenAuthenticate(
16427
- config,
16428
- projection,
16429
- () => profiler.time("auth", () => this.ensureAuthenticated(config))
16430
- )
16431
- );
16432
- profiler.timeSync(
16433
- "file_system_setup",
16434
- () => this.setupFileSystem(config)
16435
- );
16886
+ if (!provisionalStandalone) {
16887
+ await profiler.time(
16888
+ "restore_session_model",
16889
+ () => restoreSessionModelThenAuthenticate(
16890
+ config,
16891
+ projection,
16892
+ () => profiler.time("auth", () => this.ensureAuthenticated(config))
16893
+ )
16894
+ );
16895
+ profiler.timeSync(
16896
+ "file_system_setup",
16897
+ () => this.setupFileSystem(config)
16898
+ );
16899
+ }
16436
16900
  await profiler.time(
16437
16901
  "session_register",
16438
16902
  () => this.createAndStoreSession(config, settings, void 0, {
16903
+ deferWorkspaceActivation: provisionalStandalone,
16904
+ ...provisionalStandalone ? {
16905
+ beforeDeferredWorkspaceActivation: /* @__PURE__ */ __name(() => profiler.time(
16906
+ "restore_session_model",
16907
+ () => restoreSessionModelThenAuthenticate(
16908
+ config,
16909
+ projection,
16910
+ () => profiler.time(
16911
+ "auth",
16912
+ () => this.ensureAuthenticated(config)
16913
+ )
16914
+ )
16915
+ ), "beforeDeferredWorkspaceActivation")
16916
+ } : {},
16439
16917
  enableLiveScreenContext: isCompatibleLiveSessionSource(
16440
16918
  sessionSource ?? {}
16441
16919
  ),
@@ -16581,7 +17059,9 @@ var QwenAgent = class {
16581
17059
  }
16582
17060
  }
16583
17061
  await profiler.time("post_replay_services", async () => {
16584
- await this.#restoreWorktreeOnResume(config, createdSession);
17062
+ if (!provisionalStandalone) {
17063
+ await this.#restoreWorktreeOnResume(config, createdSession);
17064
+ }
16585
17065
  await this.#restoreBackgroundAgentsOnResume(
16586
17066
  config,
16587
17067
  createdSession
@@ -16630,6 +17110,15 @@ var QwenAgent = class {
16630
17110
  async resumeSessionWithProfiler(params, initialSessionId, profiler) {
16631
17111
  let sessionId = initialSessionId;
16632
17112
  const sessionSource = getSessionSource(params);
17113
+ const provisionalStandalone = isReservedStandaloneSessionSourceType(
17114
+ sessionSource?.sourceType
17115
+ );
17116
+ if (provisionalStandalone && (sessionSource?.daemonOwnedStandaloneCreation !== true || !this.isTrustedManagedParent())) {
17117
+ throw RequestError.invalidParams(
17118
+ void 0,
17119
+ "`standalone` is reserved for daemon-owned session restore"
17120
+ );
17121
+ }
16633
17122
  const suppressRestoreAskUserQuestion = params._meta?.[DAEMON_SUPPRESS_RESTORE_ASK_USER_QUESTION_META_KEY] === true;
16634
17123
  const withRestoreHint = /* @__PURE__ */ __name((session, response) => suppressRestoreAskUserQuestion ? response : this.withAskUserQuestionRestoreHint(session, response), "withRestoreHint");
16635
17124
  const liveSession = this.sessions.get(sessionId);
@@ -16700,21 +17189,37 @@ var QwenAgent = class {
16700
17189
  const projection = config.consumeSessionRestoreProjection?.();
16701
17190
  let response;
16702
17191
  try {
16703
- await profiler.time(
16704
- "restore_session_model",
16705
- () => restoreSessionModelThenAuthenticate(
16706
- config,
16707
- projection,
16708
- () => profiler.time("auth", () => this.ensureAuthenticated(config))
16709
- )
16710
- );
16711
- profiler.timeSync(
16712
- "file_system_setup",
16713
- () => this.setupFileSystem(config)
16714
- );
17192
+ if (!provisionalStandalone) {
17193
+ await profiler.time(
17194
+ "restore_session_model",
17195
+ () => restoreSessionModelThenAuthenticate(
17196
+ config,
17197
+ projection,
17198
+ () => profiler.time("auth", () => this.ensureAuthenticated(config))
17199
+ )
17200
+ );
17201
+ profiler.timeSync(
17202
+ "file_system_setup",
17203
+ () => this.setupFileSystem(config)
17204
+ );
17205
+ }
16715
17206
  await profiler.time(
16716
17207
  "session_register",
16717
17208
  () => this.createAndStoreSession(config, settings, void 0, {
17209
+ deferWorkspaceActivation: provisionalStandalone,
17210
+ ...provisionalStandalone ? {
17211
+ beforeDeferredWorkspaceActivation: /* @__PURE__ */ __name(() => profiler.time(
17212
+ "restore_session_model",
17213
+ () => restoreSessionModelThenAuthenticate(
17214
+ config,
17215
+ projection,
17216
+ () => profiler.time(
17217
+ "auth",
17218
+ () => this.ensureAuthenticated(config)
17219
+ )
17220
+ )
17221
+ ), "beforeDeferredWorkspaceActivation")
17222
+ } : {},
16718
17223
  enableLiveScreenContext: isCompatibleLiveSessionSource(
16719
17224
  sessionSource ?? {}
16720
17225
  ),
@@ -16738,7 +17243,9 @@ var QwenAgent = class {
16738
17243
  }, "primeSession"),
16739
17244
  beforeStartPostReplayServices: /* @__PURE__ */ __name(async (createdSession) => {
16740
17245
  await profiler.time("post_replay_services", async () => {
16741
- await this.#restoreWorktreeOnResume(config, createdSession);
17246
+ if (!provisionalStandalone) {
17247
+ await this.#restoreWorktreeOnResume(config, createdSession);
17248
+ }
16742
17249
  await this.#restoreBackgroundAgentsOnResume(
16743
17250
  config,
16744
17251
  createdSession
@@ -18299,7 +18806,7 @@ var QwenAgent = class {
18299
18806
  }
18300
18807
  async buildSessionSupportedCommandsStatus(sessionId) {
18301
18808
  const session = this.sessionOrThrow(sessionId);
18302
- const { availableCommands, availableSkills } = await buildAvailableCommandsSnapshot(session.getConfig());
18809
+ const { availableCommands, availableSkills } = await session.buildAvailableCommandsSnapshot();
18303
18810
  return {
18304
18811
  v: STATUS_SCHEMA_VERSION,
18305
18812
  sessionId,
@@ -18344,12 +18851,26 @@ var QwenAgent = class {
18344
18851
  const now = Date.now();
18345
18852
  const createdAt = session.getCreatedAt();
18346
18853
  const models = {};
18347
- for (const [name, m] of Object.entries(metrics.models)) {
18854
+ for (const [name, rawMetrics] of Object.entries(metrics.models)) {
18855
+ const m = metrics.statsModels?.[name] ?? rawMetrics;
18348
18856
  models[name] = {
18349
18857
  api: { ...m.api },
18350
18858
  tokens: { ...m.tokens }
18351
18859
  };
18352
18860
  }
18861
+ const sources = [];
18862
+ for (const [id, source] of Object.entries(metrics.sourceMetrics ?? {})) {
18863
+ const meta = metrics.sourceMeta?.[id];
18864
+ sources.push({
18865
+ id,
18866
+ type: meta?.type ?? "",
18867
+ name: meta?.name ?? id,
18868
+ tokens: { ...source.tokens }
18869
+ });
18870
+ }
18871
+ sources.sort(
18872
+ (a, b) => b.tokens.total - a.tokens.total || a.id.localeCompare(b.id)
18873
+ );
18353
18874
  const byName = {};
18354
18875
  for (const [name, t] of Object.entries(metrics.tools.byName)) {
18355
18876
  byName[name] = {
@@ -18392,6 +18913,7 @@ var QwenAgent = class {
18392
18913
  durationMs: now - createdAt,
18393
18914
  promptCount: session.getTurnCount(),
18394
18915
  models,
18916
+ sources,
18395
18917
  tools: {
18396
18918
  totalCalls: metrics.tools.totalCalls,
18397
18919
  totalSuccess: metrics.tools.totalSuccess,
@@ -20067,6 +20589,17 @@ var QwenAgent = class {
20067
20589
  "error" in source ? source.error : "Invalid or missing sourceType"
20068
20590
  );
20069
20591
  }
20592
+ if (isReservedStandaloneSessionSourceType(source.sourceType)) {
20593
+ const standaloneSession = this.sessionOrThrow(sessionId);
20594
+ if (params[DAEMON_OWNED_STANDALONE_CREATION_KEY] !== true || this.privateParentState !== "trusted" || !isReservedStandaloneSessionSourceType(
20595
+ standaloneSession.getConfig().getSessionSourceType()
20596
+ )) {
20597
+ throw RequestError.invalidParams(
20598
+ void 0,
20599
+ "`standalone` is reserved for daemon-owned session creation"
20600
+ );
20601
+ }
20602
+ }
20070
20603
  const session = this.sessionOrThrow(sessionId);
20071
20604
  if (isCompatibleLiveSessionSource(source)) {
20072
20605
  await session.enableLiveScreenContext();
@@ -20263,9 +20796,41 @@ var QwenAgent = class {
20263
20796
  "Invalid managed relocation capability"
20264
20797
  );
20265
20798
  }
20799
+ const conversationDirectoryExpectation = parseConversationDirectoryExpectation(
20800
+ params["conversationDirectoryExpectation"]
20801
+ );
20802
+ if (conversationDirectoryExpectation !== void 0 && managedRelocation !== "live-conversation") {
20803
+ throw RequestError.invalidParams(
20804
+ void 0,
20805
+ "Managed conversation directory expectation requires managed relocation"
20806
+ );
20807
+ }
20266
20808
  const allowedRoots = params["allowedRoots"];
20267
20809
  const session = this.sessionOrThrow(sessionId);
20268
20810
  const config = session.getConfig();
20811
+ const standalone = isReservedStandaloneSessionSourceType(
20812
+ config.getSessionSourceType()
20813
+ );
20814
+ if (standalone && (managedRelocation !== "live-conversation" || conversationDirectoryExpectation === void 0)) {
20815
+ throw RequestError.invalidParams(
20816
+ void 0,
20817
+ "Standalone relocation requires an exact managed directory expectation"
20818
+ );
20819
+ }
20820
+ if (conversationDirectoryExpectation !== void 0) {
20821
+ if (this.privateParentState !== "trusted" || conversationDirectoryExpectation.canonicalSessionId !== normalizeSessionIdForLookup(sessionId) || !Array.isArray(allowedRoots) || allowedRoots.length !== 1 || typeof allowedRoots[0] !== "string" || !isSameConversationPath(
20822
+ allowedRoots[0],
20823
+ conversationDirectoryExpectation.root.canonicalPath
20824
+ ) || !isSameConversationPath(
20825
+ targetPath,
20826
+ conversationDirectoryExpectation.child.canonicalPath
20827
+ )) {
20828
+ throw managedConversationDirectoryError(false);
20829
+ }
20830
+ await assertManagedConversationDirectoryIdentity(
20831
+ conversationDirectoryExpectation
20832
+ );
20833
+ }
20269
20834
  if (config.isRestrictiveSandbox()) {
20270
20835
  throw new RequestError(-32003, "Restrictive sandbox mode active", {
20271
20836
  errorKind: "restrictive_sandbox"
@@ -20275,18 +20840,34 @@ var QwenAgent = class {
20275
20840
  try {
20276
20841
  stats = await fs3.stat(targetPath);
20277
20842
  } catch {
20843
+ if (conversationDirectoryExpectation !== void 0) {
20844
+ throw managedConversationDirectoryError(true);
20845
+ }
20278
20846
  throw new RequestError(-32002, `Directory not found: ${targetPath}`, {
20279
20847
  errorKind: "directory_not_found",
20280
20848
  path: targetPath
20281
20849
  });
20282
20850
  }
20283
20851
  if (!stats.isDirectory()) {
20852
+ if (conversationDirectoryExpectation !== void 0) {
20853
+ throw managedConversationDirectoryError(false);
20854
+ }
20284
20855
  throw new RequestError(-32002, `Not a directory: ${targetPath}`, {
20285
20856
  errorKind: "directory_not_found",
20286
20857
  path: targetPath
20287
20858
  });
20288
20859
  }
20289
- const canonicalPath = await fs3.realpath(targetPath);
20860
+ let canonicalPath;
20861
+ try {
20862
+ canonicalPath = await fs3.realpath(targetPath);
20863
+ } catch (error) {
20864
+ if (conversationDirectoryExpectation !== void 0) {
20865
+ throw managedConversationDirectoryError(
20866
+ error.code === "ENOENT"
20867
+ );
20868
+ }
20869
+ throw error;
20870
+ }
20290
20871
  let containmentRoots = allowedRoots;
20291
20872
  let managedTrustAllowed = false;
20292
20873
  if (managedRelocation === "live-conversation") {
@@ -20311,13 +20892,22 @@ var QwenAgent = class {
20311
20892
  canonicalRoot = await fs3.realpath(rootPath);
20312
20893
  rootAfter = await fs3.lstat(canonicalRoot);
20313
20894
  } catch {
20895
+ if (conversationDirectoryExpectation !== void 0) {
20896
+ throw managedConversationDirectoryError(false);
20897
+ }
20314
20898
  throw new RequestError(
20315
20899
  -32004,
20316
20900
  "Live managed relocation requires an owner-only allowed root",
20317
20901
  { errorKind: "containment_violation", path: rootPath }
20318
20902
  );
20319
20903
  }
20320
- if (!isOwnerOnlyDirectory(rootBefore) || !isOwnerOnlyDirectory(rootAfter) || rootBefore.dev !== rootAfter.dev || rootBefore.ino !== rootAfter.ino) {
20904
+ if (!isOwnerOnlyDirectory(rootBefore) || !isOwnerOnlyDirectory(rootAfter) || rootBefore.dev !== rootAfter.dev || rootBefore.ino !== rootAfter.ino || conversationDirectoryExpectation !== void 0 && (!isSameConversationPath(
20905
+ canonicalRoot,
20906
+ conversationDirectoryExpectation.root.canonicalPath
20907
+ ) || rootAfter.dev !== conversationDirectoryExpectation.root.device || rootAfter.ino !== conversationDirectoryExpectation.root.inode)) {
20908
+ if (conversationDirectoryExpectation !== void 0) {
20909
+ throw managedConversationDirectoryError(false);
20910
+ }
20321
20911
  throw new RequestError(
20322
20912
  -32004,
20323
20913
  "Live managed relocation requires an owner-only allowed root",
@@ -20329,7 +20919,12 @@ var QwenAgent = class {
20329
20919
  try {
20330
20920
  targetBefore = await fs3.lstat(targetPath);
20331
20921
  targetAfter = await fs3.lstat(canonicalPath);
20332
- } catch {
20922
+ } catch (error) {
20923
+ if (conversationDirectoryExpectation !== void 0) {
20924
+ throw managedConversationDirectoryError(
20925
+ error.code === "ENOENT"
20926
+ );
20927
+ }
20333
20928
  throw new RequestError(
20334
20929
  -32004,
20335
20930
  "Live managed relocation requires an owner-only direct child",
@@ -20337,7 +20932,13 @@ var QwenAgent = class {
20337
20932
  );
20338
20933
  }
20339
20934
  const relativeTarget = path6.relative(canonicalRoot, canonicalPath);
20340
- if (!isOwnerOnlyDirectory(targetBefore) || !isOwnerOnlyDirectory(targetAfter) || targetBefore.dev !== targetAfter.dev || targetBefore.ino !== targetAfter.ino || relativeTarget.length === 0 || relativeTarget.startsWith("..") || path6.isAbsolute(relativeTarget) || relativeTarget.includes(path6.sep)) {
20935
+ if (!isOwnerOnlyDirectory(targetBefore) || !isOwnerOnlyDirectory(targetAfter) || targetBefore.dev !== targetAfter.dev || targetBefore.ino !== targetAfter.ino || conversationDirectoryExpectation !== void 0 && (!isSameConversationPath(
20936
+ canonicalPath,
20937
+ conversationDirectoryExpectation.child.canonicalPath
20938
+ ) || targetAfter.dev !== conversationDirectoryExpectation.child.device || targetAfter.ino !== conversationDirectoryExpectation.child.inode) || relativeTarget.length === 0 || relativeTarget.startsWith("..") || path6.isAbsolute(relativeTarget) || relativeTarget.includes(path6.sep)) {
20939
+ if (conversationDirectoryExpectation !== void 0) {
20940
+ throw managedConversationDirectoryError(false);
20941
+ }
20341
20942
  throw new RequestError(
20342
20943
  -32004,
20343
20944
  "Live managed relocation requires an owner-only direct child",
@@ -20348,13 +20949,19 @@ var QwenAgent = class {
20348
20949
  try {
20349
20950
  rootFinal = await fs3.lstat(canonicalRoot);
20350
20951
  } catch {
20952
+ if (conversationDirectoryExpectation !== void 0) {
20953
+ throw managedConversationDirectoryError(false);
20954
+ }
20351
20955
  throw new RequestError(
20352
20956
  -32004,
20353
20957
  "Live managed relocation allowed root changed during validation",
20354
20958
  { errorKind: "containment_violation", path: canonicalRoot }
20355
20959
  );
20356
20960
  }
20357
- if (!isOwnerOnlyDirectory(rootFinal) || rootFinal.dev !== rootAfter.dev || rootFinal.ino !== rootAfter.ino) {
20961
+ if (!isOwnerOnlyDirectory(rootFinal) || rootFinal.dev !== rootAfter.dev || rootFinal.ino !== rootAfter.ino || conversationDirectoryExpectation !== void 0 && (rootFinal.dev !== conversationDirectoryExpectation.root.device || rootFinal.ino !== conversationDirectoryExpectation.root.inode)) {
20962
+ if (conversationDirectoryExpectation !== void 0) {
20963
+ throw managedConversationDirectoryError(false);
20964
+ }
20358
20965
  throw new RequestError(
20359
20966
  -32004,
20360
20967
  "Live managed relocation allowed root changed during validation",
@@ -20371,6 +20978,9 @@ var QwenAgent = class {
20371
20978
  return !rel.startsWith("..") && !path6.isAbsolute(rel);
20372
20979
  });
20373
20980
  if (!contained) {
20981
+ if (conversationDirectoryExpectation !== void 0) {
20982
+ throw managedConversationDirectoryError(false);
20983
+ }
20374
20984
  throw new RequestError(
20375
20985
  -32004,
20376
20986
  `Path outside allowed roots: ${canonicalPath}`,
@@ -20404,7 +21014,7 @@ var QwenAgent = class {
20404
21014
  );
20405
21015
  try {
20406
21016
  const settledPreviousCwd = config.getTargetDir();
20407
- if (canonicalPath === settledPreviousCwd) {
21017
+ if (canonicalPath === settledPreviousCwd && conversationDirectoryExpectation === void 0) {
20408
21018
  return {
20409
21019
  previousCwd: settledPreviousCwd,
20410
21020
  newCwd: canonicalPath,
@@ -20420,12 +21030,30 @@ var QwenAgent = class {
20420
21030
  SESSION_DRAIN_TIMEOUT_MS,
20421
21031
  "close"
20422
21032
  );
21033
+ if (conversationDirectoryExpectation !== void 0 && session.hasStandaloneRelocationBlockers()) {
21034
+ throw new RequestError(
21035
+ -32602,
21036
+ "Cannot relocate while standalone background work is active",
21037
+ { errorKind: "session_busy" }
21038
+ );
21039
+ }
20423
21040
  const warnings = [];
20424
21041
  const relocation = await config.relocateWorkingDirectory(
20425
21042
  canonicalPath,
20426
21043
  canonicalPath,
20427
21044
  { skipProcessChdir: true, skipArtifactMigration: true }
20428
21045
  );
21046
+ if (conversationDirectoryExpectation !== void 0) {
21047
+ await assertManagedConversationDirectoryIdentity(
21048
+ conversationDirectoryExpectation
21049
+ );
21050
+ session.installPendingManagedConversationBinding(
21051
+ conversationDirectoryExpectation,
21052
+ () => assertManagedConversationDirectoryIdentity(
21053
+ conversationDirectoryExpectation
21054
+ )
21055
+ );
21056
+ }
20429
21057
  if (relocation.memoryRefreshError) {
20430
21058
  warnings.push(
20431
21059
  `Memory refresh failed: ${relocation.memoryRefreshError instanceof Error ? relocation.memoryRefreshError.message : String(relocation.memoryRefreshError)}`
@@ -20455,6 +21083,41 @@ var QwenAgent = class {
20455
21083
  releaseGate();
20456
21084
  }
20457
21085
  }
21086
+ case SERVE_CONTROL_EXT_METHODS.sessionManagedConversationBindingCommit:
21087
+ case SERVE_CONTROL_EXT_METHODS.sessionManagedConversationBindingRelease: {
21088
+ const sessionId = params["sessionId"];
21089
+ if (typeof sessionId !== "string" || sessionId.length === 0) {
21090
+ throw RequestError.invalidParams(
21091
+ void 0,
21092
+ "Invalid or missing sessionId"
21093
+ );
21094
+ }
21095
+ if (this.privateParentState !== "trusted") {
21096
+ throw RequestError.invalidParams(
21097
+ void 0,
21098
+ "Managed conversation binding requires a trusted private ACP parent"
21099
+ );
21100
+ }
21101
+ const expectation = parseConversationDirectoryExpectation(
21102
+ params["conversationDirectoryExpectation"]
21103
+ );
21104
+ if (expectation === void 0 || expectation.canonicalSessionId !== normalizeSessionIdForLookup(sessionId)) {
21105
+ throw managedConversationDirectoryError(false);
21106
+ }
21107
+ const session = this.sessionOrThrow(sessionId);
21108
+ if (!isReservedStandaloneSessionSourceType(
21109
+ session.getConfig().getSessionSourceType()
21110
+ )) {
21111
+ throw managedConversationDirectoryError(false);
21112
+ }
21113
+ await assertManagedConversationDirectoryIdentity(expectation);
21114
+ if (method === SERVE_CONTROL_EXT_METHODS.sessionManagedConversationBindingCommit) {
21115
+ await session.commitManagedConversationBinding(expectation);
21116
+ return { sessionId, committed: true };
21117
+ }
21118
+ await session.releaseManagedConversationBinding(expectation);
21119
+ return { sessionId, released: true };
21120
+ }
20458
21121
  case SERVE_CONTROL_EXT_METHODS.sessionApprovalMode: {
20459
21122
  const sessionId = params["sessionId"];
20460
21123
  const mode = params["mode"];
@@ -22178,6 +22841,9 @@ ${outputText}
22178
22841
  }
22179
22842
  }
22180
22843
  async newSessionConfigInRuntimeContext(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording, restoreOptions) {
22844
+ const provisionalWorkspace = isReservedStandaloneSessionSourceType(
22845
+ sessionSource?.sourceType
22846
+ );
22181
22847
  const sessionMcpServers = {};
22182
22848
  for (const server of mcpServers) {
22183
22849
  const stdioServer = toStdioServer(server);
@@ -22239,6 +22905,7 @@ ${outputText}
22239
22905
  const sessionArg = resume === true ? { resume: sessionId, sessionId: void 0 } : { sessionId, resume: void 0 };
22240
22906
  const argvForSession = {
22241
22907
  ...this.argv,
22908
+ ...provisionalWorkspace ? { experimentalLsp: false } : {},
22242
22909
  // Docker sandbox relaunch injects a fixed --sandbox-session-id into
22243
22910
  // the ACP process argv. Without clearing it, every newSession()
22244
22911
  // inherits the same ID and the second session collides with the
@@ -22275,7 +22942,8 @@ ${outputText}
22275
22942
  // not process.exit(1) the shared ACP child and every session on its
22276
22943
  // channel. newSessionConfig maps the throw to a RequestError.
22277
22944
  true,
22278
- this.managedToolInvocationGuard || restoreOptions ? {
22945
+ this.managedToolInvocationGuard || restoreOptions || provisionalWorkspace ? {
22946
+ ...provisionalWorkspace ? { provisionalWorkspace: true } : {},
22279
22947
  ...this.managedToolInvocationGuard ? { toolInvocationGuard: this.managedToolInvocationGuard } : {},
22280
22948
  ...restoreOptions && sessionId ? {
22281
22949
  sessionRestore: {
@@ -22354,8 +23022,12 @@ ${outputText}
22354
23022
  () => this.cleanupUnstoredConfig(config)
22355
23023
  );
22356
23024
  }
22357
- startNonInteractiveOpenAILogHousekeeping(config, settings);
22358
- void this.surfaceMcpFailuresWhenReady(config);
23025
+ if (!provisionalWorkspace) {
23026
+ startNonInteractiveOpenAILogHousekeeping(config, settings);
23027
+ }
23028
+ if (!provisionalWorkspace) {
23029
+ void this.surfaceMcpFailuresWhenReady(config);
23030
+ }
22359
23031
  return config;
22360
23032
  }
22361
23033
  async surfaceMcpFailuresWhenReady(config) {
@@ -22413,7 +23085,7 @@ ${outputText}
22413
23085
  const sessionId = normalizeSessionIdForLookup(config.getSessionId());
22414
23086
  const geminiClient = config.getGeminiClient();
22415
23087
  const needsInitialize = !geminiClient.isInitialized();
22416
- if (needsInitialize) {
23088
+ if (needsInitialize && options.deferWorkspaceActivation !== true) {
22417
23089
  await geminiClient.initialize();
22418
23090
  }
22419
23091
  this.assertManagedSessionAdmission();
@@ -22442,11 +23114,59 @@ ${outputText}
22442
23114
  (operation) => this.runExclusiveHistoryMutation(sessionId, operation),
22443
23115
  () => this.activeWorkReporter?.notifyChanged()
22444
23116
  );
23117
+ const replaySessionHistory = /* @__PURE__ */ __name(async () => {
23118
+ if (options.replayHistory === false || !sessionData?.conversation.messages) {
23119
+ return;
23120
+ }
23121
+ await session.replayHistory(
23122
+ sessionData.conversation.messages,
23123
+ sessionData.historyGaps
23124
+ );
23125
+ try {
23126
+ await session.publishRecoveredGoalState(
23127
+ sessionData.conversation.messages
23128
+ );
23129
+ } catch (error) {
23130
+ debugLogger9.debug(
23131
+ `Failed to publish recovered Goal state: ${error instanceof Error ? error.message : String(error)}`
23132
+ );
23133
+ }
23134
+ }, "replaySessionHistory");
23135
+ if (options.deferWorkspaceActivation === true) {
23136
+ session.installManagedConversationActivation(
23137
+ async () => {
23138
+ this.assertManagedSessionAdmission();
23139
+ if (options.beforeDeferredWorkspaceActivation) {
23140
+ await options.beforeDeferredWorkspaceActivation();
23141
+ } else {
23142
+ await this.ensureAuthenticated(config);
23143
+ }
23144
+ this.assertManagedSessionAdmission();
23145
+ await config.activateProvisionalWorkspace();
23146
+ this.assertManagedSessionAdmission();
23147
+ this.setupFileSystem(config);
23148
+ config.hydrateSessionRestoreFileHistory?.();
23149
+ if (sessionData?.fileHistorySnapshots?.length) {
23150
+ config.getFileHistoryService().restoreFromSnapshots(sessionData.fileHistorySnapshots);
23151
+ }
23152
+ await replaySessionHistory();
23153
+ await options.beforeStartPostReplayServices?.(session);
23154
+ session.installRewriter();
23155
+ config.finalizeSessionRestore?.();
23156
+ startNonInteractiveOpenAILogHousekeeping(config, settings);
23157
+ },
23158
+ () => {
23159
+ void this.surfaceMcpFailuresWhenReady(config);
23160
+ }
23161
+ );
23162
+ }
22445
23163
  let published = false;
22446
23164
  try {
22447
23165
  await registerCreateSubSessionTool(config);
22448
23166
  options.primeSession?.(session);
22449
- config.hydrateSessionRestoreFileHistory?.();
23167
+ if (options.deferWorkspaceActivation !== true) {
23168
+ config.hydrateSessionRestoreFileHistory?.();
23169
+ }
22450
23170
  this.sessions.set(sessionId, session);
22451
23171
  published = true;
22452
23172
  this.activeWorkReporter?.notifyChanged();
@@ -22454,30 +23174,24 @@ ${outputText}
22454
23174
  if (options.enableLiveScreenContext) {
22455
23175
  await session.enableLiveScreenContext();
22456
23176
  }
22457
- if (sessionData?.fileHistorySnapshots?.length) {
23177
+ if (options.deferWorkspaceActivation !== true && sessionData?.fileHistorySnapshots?.length) {
22458
23178
  config.getFileHistoryService().restoreFromSnapshots(sessionData.fileHistorySnapshots);
22459
23179
  }
22460
23180
  if (sessionData?.conversation.messages) {
22461
23181
  config.getChatRecordingService()?.rebuildTurnBoundaries(sessionData.conversation.messages);
22462
23182
  }
22463
- if (options.replayHistory !== false && sessionData?.conversation.messages) {
22464
- await session.replayHistory(
22465
- sessionData.conversation.messages,
22466
- sessionData.historyGaps
22467
- );
22468
- try {
22469
- await session.publishRecoveredGoalState(
22470
- sessionData.conversation.messages
22471
- );
22472
- } catch (error) {
22473
- debugLogger9.debug(
22474
- `Failed to publish recovered Goal state: ${error instanceof Error ? error.message : String(error)}`
22475
- );
22476
- }
23183
+ if (options.deferWorkspaceActivation !== true) {
23184
+ await replaySessionHistory();
23185
+ }
23186
+ if (options.deferWorkspaceActivation !== true) {
23187
+ await options.beforeStartPostReplayServices?.(session);
23188
+ }
23189
+ if (options.deferWorkspaceActivation !== true) {
23190
+ session.installRewriter();
23191
+ }
23192
+ if (options.deferWorkspaceActivation !== true) {
23193
+ config.finalizeSessionRestore?.();
22477
23194
  }
22478
- await options.beforeStartPostReplayServices?.(session);
22479
- session.installRewriter();
22480
- config.finalizeSessionRestore?.();
22481
23195
  session.startCronScheduler();
22482
23196
  setTimeout(() => {
22483
23197
  void session.sendAvailableCommandsUpdate();