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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (453) hide show
  1. package/bundled/new-app/SKILL.md +1 -1
  2. package/bundled/qc-helper/docs/configuration/auth.md +84 -12
  3. package/bundled/qc-helper/docs/configuration/settings.md +76 -74
  4. package/bundled/qc-helper/docs/features/arena.md +15 -20
  5. package/bundled/qc-helper/docs/features/channels/overview.md +7 -2
  6. package/bundled/qc-helper/docs/features/code-review.md +22 -19
  7. package/bundled/qc-helper/docs/features/commands.md +51 -10
  8. package/bundled/qc-helper/docs/features/followup-suggestions.md +1 -1
  9. package/bundled/qc-helper/docs/features/goals.md +8 -0
  10. package/bundled/qc-helper/docs/features/headless.md +2 -2
  11. package/bundled/qc-helper/docs/features/hooks.md +19 -19
  12. package/bundled/qc-helper/docs/features/output-styles.md +35 -2
  13. package/bundled/qc-helper/docs/qwen-serve.md +67 -52
  14. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +3 -1
  15. package/bundled/qc-helper/docs/support/troubleshooting.md +3 -3
  16. package/bundled/review/SKILL.md +45 -41
  17. package/bundled/review/references/aone.md +1 -1
  18. package/bundled/review/references/posting.md +1 -1
  19. package/bundled/workflow-creator/SKILL.md +48 -0
  20. package/bundled/zvec-grep-install/SKILL.md +57 -0
  21. package/chunks/MaxSizedBox-5ARLO5PR.js +116 -0
  22. package/chunks/{StandaloneSessionPicker-QUMO4LLQ.js → StandaloneSessionPicker-T6B322CB.js} +87 -82
  23. package/chunks/{acp-startup-profiler-M4X5F3VK.js → acp-startup-profiler-6ULXXQMS.js} +2 -2
  24. package/chunks/{acpAgent-2GTFCIEP.js → acpAgent-WTDEY5KD.js} +1041 -364
  25. package/chunks/{agent-XKF5SZWU.js → agent-NXPUXEVZ.js} +46 -43
  26. package/chunks/agent-headless-QQZTWOKO.js +88 -0
  27. package/chunks/{anthropicContentGenerator-L76MR5OR.js → anthropicContentGenerator-6XDHXIII.js} +16 -9
  28. package/chunks/{artifact-tool-MYCL2QCS.js → artifact-tool-DFVVJXL2.js} +3 -3
  29. package/chunks/askUserQuestion-GF7VQ44M.js +14 -0
  30. package/chunks/bridge-OHY5OGOZ.js +123 -0
  31. package/chunks/{ca-BNU7YNDE.js → ca-KC2AISNS.js} +1 -0
  32. package/chunks/{channel-management-service-4MTCEGJB.js → channel-management-service-ZDDG3G5S.js} +4 -4
  33. package/chunks/channel-settings-store-7BJAS2SU.js +126 -0
  34. package/chunks/{channel-worker-group-47F4ISUZ.js → channel-worker-group-2ISMRENV.js} +6 -6
  35. package/chunks/{channel-worker-manager-I5Y44GYR.js → channel-worker-manager-VSRPVPRH.js} +6 -6
  36. package/chunks/{channel-worker-supervisor-6VCLUXFE.js → channel-worker-supervisor-SRJBK72Z.js} +4 -4
  37. package/chunks/{chunk-5RTTI4GE.js → chunk-2RYWGYB3.js} +4 -3
  38. package/chunks/{chunk-FUO5V5KI.js → chunk-2UWQX4FP.js} +2 -2
  39. package/chunks/{chunk-L26ONV2Y.js → chunk-2WGJG2KW.js} +9 -8
  40. package/chunks/{chunk-JHN7UIDW.js → chunk-2XRE4KE4.js} +1 -1
  41. package/chunks/chunk-32CM56LO.js +20 -0
  42. package/chunks/{chunk-SI7WDR3U.js → chunk-32YDNYXP.js} +129 -14
  43. package/chunks/{chunk-ZHO2CW6D.js → chunk-3CZ2BQV6.js} +1 -1
  44. package/chunks/{chunk-FD5SJOWT.js → chunk-3K456UJF.js} +9 -4
  45. package/chunks/{chunk-5M6IDOMF.js → chunk-3K65MUKD.js} +105 -0
  46. package/chunks/chunk-3UMWOKJC.js +78 -0
  47. package/chunks/{chunk-UM2FFKXN.js → chunk-43JNQAHO.js} +3 -3
  48. package/chunks/{chunk-KM3XVTMO.js → chunk-43NOB5NM.js} +112 -12
  49. package/chunks/{chunk-G5PBOQWI.js → chunk-47BZVBTE.js} +3 -3
  50. package/chunks/{chunk-32LU3APX.js → chunk-4F2QRVW6.js} +1 -1
  51. package/chunks/{chunk-KMU3ZHH4.js → chunk-4HC4DYKN.js} +2 -2
  52. package/chunks/{chunk-22UH7VTP.js → chunk-4HOEU2OR.js} +1 -1
  53. package/chunks/{chunk-NXKOVOM5.js → chunk-4IQKBLTQ.js} +15 -9
  54. package/chunks/{chunk-M4KFODIP.js → chunk-4JAGXZR3.js} +1 -1
  55. package/chunks/{chunk-PDAKFU7M.js → chunk-4LIPOIXS.js} +1 -1
  56. package/chunks/{chunk-LEPCWS5A.js → chunk-4MCY33Y2.js} +3 -3
  57. package/chunks/{chunk-U6D2PPMN.js → chunk-4VUVBN3Y.js} +1 -1
  58. package/chunks/{chunk-37JFWFCD.js → chunk-4VZCORNT.js} +1 -1
  59. package/chunks/{daemon-RKDGBFLK.js → chunk-537SQ2AI.js} +2216 -1721
  60. package/chunks/{chunk-VNAYZAFX.js → chunk-54TF2ZIQ.js} +4 -4
  61. package/chunks/{chunk-OKTNXDVO.js → chunk-565U2ANU.js} +1 -1
  62. package/chunks/chunk-5ETULJLP.js +74 -0
  63. package/chunks/{chunk-ADYN7P2Y.js → chunk-5JLQWQK6.js} +8 -6
  64. package/chunks/{chunk-BFY33IB4.js → chunk-5MTARK4Y.js} +7 -7
  65. package/chunks/{chunk-BJXCYUGM.js → chunk-5YY5MZT6.js} +1 -1
  66. package/chunks/{chunk-4PSDSCW3.js → chunk-64MQTIX7.js} +3 -3
  67. package/chunks/{chunk-54C6PIGT.js → chunk-6UIACMGH.js} +3 -3
  68. package/chunks/{chunk-ALUYNJPM.js → chunk-7BZS4ZDV.js} +1362 -1140
  69. package/chunks/{chunk-LB3WQQJK.js → chunk-7OCIQNKX.js} +2 -2
  70. package/chunks/{chunk-QKDNS6FU.js → chunk-7VEYUF3N.js} +13 -2
  71. package/chunks/{chunk-AZJLY2XZ.js → chunk-AHBLRVD5.js} +5 -5
  72. package/chunks/{chunk-VWTSRH6C.js → chunk-AQ5NAGWI.js} +89 -17
  73. package/chunks/{chunk-MOF6VZN2.js → chunk-AXPOOQAW.js} +2 -2
  74. package/chunks/{chunk-CVX63TFJ.js → chunk-B44JBZBB.js} +3 -3
  75. package/chunks/{chunk-AI35S34R.js → chunk-B54PFQS5.js} +3 -3
  76. package/chunks/{chunk-373DQUVA.js → chunk-BF3RUIVP.js} +5 -4
  77. package/chunks/{chunk-RJUVTJEZ.js → chunk-BKNY7PDI.js} +1 -1
  78. package/chunks/{chunk-UKYXYWI2.js → chunk-BUQN5LTI.js} +2 -2
  79. package/chunks/{chunk-O5CD7T4T.js → chunk-BW4333PP.js} +0 -95
  80. package/chunks/{chunk-UPFRILIL.js → chunk-CWNC7M73.js} +2 -2
  81. package/chunks/{chunk-3L724BJ5.js → chunk-CZACBHAW.js} +6 -6
  82. package/chunks/{chunk-EBDGRBZX.js → chunk-D4CU6DKR.js} +6 -6
  83. package/chunks/{chunk-G7HBEEX7.js → chunk-D6PIMKY3.js} +9 -9
  84. package/chunks/{chunk-ENYUKMFK.js → chunk-DJXSOEFB.js} +1 -1
  85. package/chunks/{chunk-C2VWOXHS.js → chunk-DNPHKA72.js} +8 -8
  86. package/chunks/{chunk-UUASLXHW.js → chunk-E4L5BM2B.js} +5 -5
  87. package/chunks/{chunk-HT5S5TRQ.js → chunk-EDIDYZBT.js} +4 -11
  88. package/chunks/{chunk-5H5S4UY5.js → chunk-EFT7OMDN.js} +1 -1
  89. package/chunks/{chunk-GB4UKWY5.js → chunk-EJNYBDYC.js} +2 -2
  90. package/chunks/{chunk-NQ4L2CMD.js → chunk-ER273QE6.js} +53 -9
  91. package/chunks/{chunk-RKW36UWC.js → chunk-EWNKP4V4.js} +1 -1
  92. package/chunks/{chunk-UJ4DUYIH.js → chunk-F53KKZUD.js} +2 -2
  93. package/chunks/{chunk-EFTPIZIC.js → chunk-FDOGGKAA.js} +21 -0
  94. package/chunks/{chunk-AQ37AY7B.js → chunk-FKJM6JKY.js} +5 -0
  95. package/chunks/{chunk-KEVYJSI4.js → chunk-G34YLYCS.js} +13 -13
  96. package/chunks/{chunk-P6UIF2OW.js → chunk-GCFZ2LAX.js} +195 -10
  97. package/chunks/{chunk-VGHZT6JR.js → chunk-GELRJXE2.js} +1 -1
  98. package/chunks/{chunk-ZDFQGHZH.js → chunk-GMNLYQOS.js} +1 -1
  99. package/chunks/{chunk-KOGW3YWJ.js → chunk-GVVCLL2P.js} +12 -12
  100. package/chunks/{chunk-OSSTATJF.js → chunk-GXZHYPHZ.js} +428 -30
  101. package/chunks/{chunk-IPATA3T2.js → chunk-GZWW2QWR.js} +2 -2
  102. package/chunks/{chunk-C4TIXFDZ.js → chunk-H3UDNQLO.js} +6 -4
  103. package/chunks/chunk-HD7O6WLV.js +18 -0
  104. package/chunks/{chunk-4UANMABT.js → chunk-HFTB354P.js} +259 -49
  105. package/chunks/{chunk-LOBDDFYK.js → chunk-HJ34U5J4.js} +5 -5
  106. package/chunks/{chunk-M4LBBSVP.js → chunk-HY3DXYZK.js} +2 -2
  107. package/chunks/{chunk-4F7GQGXB.js → chunk-I72PHOKL.js} +1451 -415
  108. package/chunks/{chunk-YPWZTR7F.js → chunk-IFD3BTEA.js} +3 -3
  109. package/chunks/{chunk-EWRW2WQC.js → chunk-IKLFS6SC.js} +5 -5
  110. package/chunks/{chunk-VPSIC437.js → chunk-IQN2CCIE.js} +66 -6
  111. package/chunks/{chunk-F7NF2IOE.js → chunk-IXSGOSEG.js} +7 -7
  112. package/chunks/{chunk-ODZF64DM.js → chunk-IZ2U57NY.js} +1 -1
  113. package/chunks/{chunk-4BGDFKQE.js → chunk-J3O5I5ZD.js} +24 -7
  114. package/chunks/{chunk-DYTW3QVG.js → chunk-J6MB5ZHZ.js} +1 -1
  115. package/chunks/{chunk-HJBHMANB.js → chunk-JBTZUFR4.js} +11 -8
  116. package/chunks/{chunk-SRF4KTAG.js → chunk-JLWFGYXU.js} +4 -4
  117. package/chunks/{chunk-SX2QIMJV.js → chunk-JOPC3FND.js} +5 -5
  118. package/chunks/chunk-JPEAQJNS.js +2142 -0
  119. package/chunks/{chunk-ZTPGUFQV.js → chunk-JRYL3T2O.js} +24 -5
  120. package/chunks/{chunk-GXUTFQXK.js → chunk-KE3Q4JMY.js} +4 -4
  121. package/chunks/{chunk-LKODFJRD.js → chunk-KFFCDLKV.js} +1 -1
  122. package/chunks/{chunk-4M24B5J5.js → chunk-KJJPJYHI.js} +79 -30
  123. package/chunks/chunk-KK2GZGBK.js +21080 -0
  124. package/chunks/{chunk-64QH2UC6.js → chunk-KPXRFTT7.js} +12 -1
  125. package/chunks/{chunk-JZWOCUZ3.js → chunk-L4R7BCVV.js} +1 -1
  126. package/chunks/{chunk-IG4W5SJR.js → chunk-LDS57224.js} +3 -3
  127. package/chunks/{chunk-UAKRDON5.js → chunk-LK7S2D6V.js} +4 -4
  128. package/chunks/{chunk-4HVH57J3.js → chunk-LMJQSPWB.js} +21 -6
  129. package/chunks/{chunk-ANVG3BVV.js → chunk-LNYV4GXX.js} +13 -3
  130. package/chunks/{chunk-RM4WT2XB.js → chunk-LPBQODMR.js} +4 -4
  131. package/chunks/{chunk-XEAAO654.js → chunk-M3JGHRMQ.js} +1 -1
  132. package/chunks/{chunk-AMDSOFFV.js → chunk-MATEIJZF.js} +1 -0
  133. package/chunks/{chunk-LHBNR6EU.js → chunk-MNEYUNOE.js} +2 -2
  134. package/chunks/{chunk-I4NRYS6A.js → chunk-MUZCSTOO.js} +11 -11
  135. package/chunks/{chunk-I5N4EAS6.js → chunk-MWHY26G3.js} +1 -1
  136. package/chunks/{chunk-7XL4WRXM.js → chunk-N6VQ37ZZ.js} +2 -2
  137. package/chunks/{chunk-AHYTURFB.js → chunk-N7EYO2E7.js} +1 -1
  138. package/chunks/{chunk-LU77UT4D.js → chunk-N7VURC4O.js} +24 -26
  139. package/chunks/{chunk-DSX7KQPM.js → chunk-NAKALAL4.js} +227 -29
  140. package/chunks/{chunk-QQD2GART.js → chunk-NGX4NUNP.js} +3 -3
  141. package/chunks/{chunk-2M3EWQNG.js → chunk-NUQFUXOG.js} +17 -1
  142. package/chunks/{chunk-E4JNFXNI.js → chunk-NXWYCSPL.js} +3 -3
  143. package/chunks/{chunk-6A2D4QSO.js → chunk-O2GG7H4C.js} +4 -4
  144. package/chunks/{chunk-ZKFTS3OV.js → chunk-O45WBTNS.js} +6 -6
  145. package/chunks/{chunk-KGV55H53.js → chunk-OECNP26L.js} +1 -1
  146. package/chunks/{chunk-S6H3ELPG.js → chunk-P4RUUG64.js} +1 -1
  147. package/chunks/{chunk-GH2S4GD5.js → chunk-P5LDR7FI.js} +21 -68
  148. package/chunks/{chunk-RN3YGDCA.js → chunk-P6LATTDG.js} +4 -4
  149. package/chunks/{chunk-WP4AX3XD.js → chunk-PTFFWTTO.js} +3 -3
  150. package/chunks/{chunk-DTVQSSNM.js → chunk-PZUOHCWI.js} +3 -3
  151. package/chunks/{chunk-VYIUNFEA.js → chunk-PZV2FASB.js} +3 -3
  152. package/chunks/{chunk-XLXAZLDR.js → chunk-Q2SAQTEJ.js} +1 -1
  153. package/chunks/{chunk-47RYEQW5.js → chunk-QMFOYPGV.js} +2 -2
  154. package/chunks/{chunk-SULZPKTA.js → chunk-QSC5YOEC.js} +3 -3
  155. package/chunks/{chunk-F33GFWPR.js → chunk-QWZOOIR3.js} +58 -18
  156. package/chunks/{chunk-H43PSPYS.js → chunk-R355CUNQ.js} +4 -4
  157. package/chunks/{chunk-DQCKVAF5.js → chunk-RDKXZ2LS.js} +3 -3
  158. package/chunks/{chunk-7JMGTOH7.js → chunk-RPBMP6BN.js} +21 -1
  159. package/chunks/{chunk-5Q5RC2WE.js → chunk-RVNS7NWN.js} +2 -2
  160. package/chunks/{chunk-7RB56BRJ.js → chunk-SAZS4IWW.js} +6 -4
  161. package/chunks/{chunk-5EIOJGCR.js → chunk-SFMCYMVF.js} +4 -4
  162. package/chunks/{chunk-TMKTOTMQ.js → chunk-SN5FV4FY.js} +5 -5
  163. package/chunks/{chunk-QJGYU5PG.js → chunk-TDP7UULF.js} +1 -1
  164. package/chunks/{chunk-EIJT2PQ6.js → chunk-TIGXX4PA.js} +2 -2
  165. package/chunks/{chunk-PCRBLMIN.js → chunk-TMWB67LS.js} +21 -3
  166. package/chunks/{chunk-JUARRUMA.js → chunk-UEZOXZNI.js} +1358 -646
  167. package/chunks/{chunk-KFN2IZYR.js → chunk-UKADFFL2.js} +3 -3
  168. package/chunks/{chunk-TJYRTS4S.js → chunk-UKKYOIVT.js} +2 -2
  169. package/chunks/{chunk-EVFDRBUM.js → chunk-URSCX7S7.js} +12 -7
  170. package/chunks/{chunk-U4DJ5XB3.js → chunk-VDXYYVCD.js} +269 -70
  171. package/chunks/{chunk-4LIFGNI4.js → chunk-VEFRT7NX.js} +1 -1
  172. package/chunks/chunk-VFFQAOPR.js +18 -0
  173. package/chunks/{chunk-3AKCBZVW.js → chunk-VU7O7CGQ.js} +3 -3
  174. package/chunks/{chunk-RAFQIHN2.js → chunk-VUSSAGKI.js} +76 -5
  175. package/chunks/{chunk-TQHPVKO6.js → chunk-VY6UVU7G.js} +6 -6
  176. package/chunks/{chunk-S2T7H5MI.js → chunk-W4LL5RZO.js} +1 -1
  177. package/chunks/{chunk-ZGCKTAL5.js → chunk-WEXA2DNG.js} +2 -0
  178. package/chunks/{chunk-NVVJTUSL.js → chunk-WR3SH3EY.js} +136 -85
  179. package/chunks/{chunk-JR42V4UY.js → chunk-WTW36TJ3.js} +1 -1
  180. package/chunks/{chunk-TSZSGQ3N.js → chunk-WXC6OAWD.js} +1 -1
  181. package/chunks/{chunk-ZVP4PWBU.js → chunk-X35VIWWJ.js} +1 -1
  182. package/chunks/{chunk-KHP66DFN.js → chunk-XFFRI3WM.js} +1 -1
  183. package/chunks/{chunk-EIY7SUPZ.js → chunk-XHGGYCTA.js} +1 -1
  184. package/chunks/{chunk-BA4WJC4L.js → chunk-XOVVCGZX.js} +1 -1
  185. package/chunks/{chunk-VBWD6C27.js → chunk-XUSOYE2I.js} +1 -1
  186. package/chunks/{chunk-NUHOLAQ6.js → chunk-XWJFDJZK.js} +1 -1
  187. package/chunks/{chunk-65HWLGA7.js → chunk-XY3USGFE.js} +3 -3
  188. package/chunks/{chunk-STCVJXQB.js → chunk-Y3ZKI4RQ.js} +56 -26
  189. package/chunks/{chunk-QAK5475D.js → chunk-Y53DG2HA.js} +1 -1
  190. package/chunks/{chunk-3JQZVCBI.js → chunk-YCDL2SAS.js} +2 -2
  191. package/chunks/{chunk-NSUKQ4DN.js → chunk-YHDGABDC.js} +3 -3
  192. package/chunks/{chunk-FRICLXCZ.js → chunk-Z6WZPXQH.js} +3 -3
  193. package/chunks/{chunk-EAHOJF6V.js → chunk-ZAFYHRVY.js} +12 -0
  194. package/chunks/{chunk-MP6YZ4RK.js → chunk-ZAZ3NFL6.js} +852 -309
  195. package/chunks/{chunk-7TBU7PU2.js → chunk-ZSTCM3MX.js} +1 -1
  196. package/chunks/{chunk-NRL5CUZT.js → chunk-ZTAVGFKA.js} +1 -1
  197. package/chunks/config-utils-QXDOTXEQ.js +119 -0
  198. package/chunks/contextCommand-RN4KARWC.js +112 -0
  199. package/chunks/{core-runtime-B4UKKIAQ.js → core-runtime-NAZCOKHB.js} +63 -58
  200. package/chunks/{create-sub-session-NJ24B4US.js → create-sub-session-BCSM4WKB.js} +61 -56
  201. package/chunks/{create-sub-session-LUPWEUHR.js → create-sub-session-BQ3SE4TX.js} +3 -3
  202. package/chunks/{cron-create-CRSPET3H.js → cron-create-D6HQ7I7I.js} +4 -4
  203. package/chunks/{cron-delete-DB77SZTU.js → cron-delete-KK3D2SQV.js} +4 -4
  204. package/chunks/{cron-list-U2JNYWV6.js → cron-list-VBF3IZMF.js} +4 -4
  205. package/chunks/daemon-LCUELM6E.js +191 -0
  206. package/chunks/{daemon-git-worktree-guard-O2HPOBAB.js → daemon-git-worktree-guard-3K5CAU36.js} +62 -57
  207. package/chunks/daemon-status-provider-4X3ZZQTZ.js +122 -0
  208. package/chunks/daemon-trust-policy-R45CFUJA.js +118 -0
  209. package/chunks/{daemon-trust-policy-monitor-JL7F4Y4Q.js → daemon-trust-policy-monitor-DSSFCO3K.js} +69 -64
  210. package/chunks/{de-T4BLOKEC.js → de-UU2YTO37.js} +1 -0
  211. package/chunks/deferred-core-runtime-UO2M6WYI.js +120 -0
  212. package/chunks/{display-image-73C7XNRK.js → display-image-EVVTBVYE.js} +6 -6
  213. package/chunks/{dist-EDHQIBYD.js → dist-3T5MDUHP.js} +62 -20
  214. package/chunks/{dist-ZCJLKQSP.js → dist-AFH3BMZZ.js} +18 -10
  215. package/chunks/{dist-LXFYIJNG.js → dist-MK5PPBRF.js} +40 -9
  216. package/chunks/{dist-GT64AAUR.js → dist-PH5RSTEA.js} +56 -20
  217. package/chunks/{dist-62OZ7QXB.js → dist-QUU7TVE3.js} +35 -12
  218. package/chunks/{dist-JVXT4VUJ.js → dist-R5Y34V6T.js} +11 -2
  219. package/chunks/{dist-L6URO6CK.js → dist-SB2XRXZA.js} +5 -1
  220. package/chunks/{dist-QAF5DO3Y.js → dist-SIHF5MU2.js} +326 -131
  221. package/chunks/{dist-PDGNRVPY.js → dist-UVHW2U56.js} +20 -1
  222. package/chunks/earlyInputCapture-BXP7V2P3.js +22 -0
  223. package/chunks/{edit-SUGXY63Y.js → edit-VNBCTRWP.js} +48 -44
  224. package/chunks/{en-2RATMNX7.js → en-JMR535HP.js} +3 -1
  225. package/chunks/{enter-worktree-B6USKSIK.js → enter-worktree-CEVK7MQ2.js} +7 -7
  226. package/chunks/{enterPlanMode-MDX4RVVL.js → enterPlanMode-4KMZMUIA.js} +48 -45
  227. package/chunks/environment-S2HYQDON.js +135 -0
  228. package/chunks/errors-DAAN5TL7.js +119 -0
  229. package/chunks/{exit-worktree-DLQ73SJH.js → exit-worktree-D3YE6MUN.js} +7 -7
  230. package/chunks/exitPlanMode-HR36HG3D.js +86 -0
  231. package/chunks/{fast-path-Y73R42LV.js → fast-path-4IWSW3UV.js} +3 -3
  232. package/chunks/{fast-path-settings-MFUR3IWK.js → fast-path-settings-ISEJPRYE.js} +6 -4
  233. package/chunks/{fr-BGHGYX6A.js → fr-HKNWVXRJ.js} +1 -0
  234. package/chunks/{glob-DMGH7EZN.js → glob-IZYB2XH2.js} +46 -43
  235. package/chunks/{goal-tools-3RF3PXCL.js → goal-tools-VGUPKQDJ.js} +46 -43
  236. package/chunks/{grep-AJVLCVXC.js → grep-OUVLNXG7.js} +9 -8
  237. package/chunks/handleAutoUpdate-D56FMDTW.js +115 -0
  238. package/chunks/i18n-BKE5WO6T.js +130 -0
  239. package/chunks/{image-gen-VOIDOHOB.js → image-gen-SHVQ3XID.js} +8 -8
  240. package/chunks/initializer-MS4SGEHF.js +119 -0
  241. package/chunks/installationInfo-542MGC4S.js +113 -0
  242. package/chunks/{ja-G3FTD5XE.js → ja-GJS5RZGU.js} +1 -0
  243. package/chunks/{keychain-token-storage-REZVMJA6.js → keychain-token-storage-NQ5XWIPX.js} +2 -2
  244. package/chunks/list-H6XTKUWL.js +122 -0
  245. package/chunks/{list-agents-SBMONIUK.js → list-agents-ULYBGJXC.js} +6 -6
  246. package/chunks/{llm-K26SUDVK.js → llm-3NUC4EJY.js} +132 -113
  247. package/chunks/{llm-content-generator-TT6EAUD4.js → llm-content-generator-R4NL3OQN.js} +40 -13
  248. package/chunks/loadedSettingsAdapter-3XLKYDVT.js +116 -0
  249. package/chunks/{loggingContentGenerator-EYQBA4M4.js → loggingContentGenerator-ZYSWVNEO.js} +55 -52
  250. package/chunks/{loop-wakeup-QA6SHCZT.js → loop-wakeup-B27BEYRL.js} +5 -5
  251. package/chunks/{lowlight-J2OZNPCA.js → lowlight-BTE423KL.js} +3 -6
  252. package/chunks/{ls-HEJNCEYO.js → ls-3IIMMVKF.js} +5 -4
  253. package/chunks/{lsp-WOQKNZP6.js → lsp-VJAT7XKS.js} +2 -2
  254. package/chunks/{managed-npm-update-HIJTODQT.js → managed-npm-update-L2I53ZAI.js} +62 -57
  255. package/chunks/mcp-4PIXQASW.js +116 -0
  256. package/chunks/{monitor-DKNZQAB2.js → monitor-O2YQTOZZ.js} +50 -46
  257. package/chunks/{node-UETAYMMO.js → node-ISQAFKIS.js} +2 -2
  258. package/chunks/nonInteractiveCli-LV7CDBA2.js +198 -0
  259. package/chunks/{notebook-edit-MGHTRL2D.js → notebook-edit-4RE2ALH4.js} +48 -44
  260. package/chunks/{openaiContentGenerator-ZJIEQ3ZJ.js → openaiContentGenerator-7ND7K5CP.js} +30 -25
  261. package/chunks/pidfile-UFTLQ7NP.js +117 -0
  262. package/chunks/{processUtils-UY3SAJJZ.js → processUtils-3XBB4FYV.js} +2 -2
  263. package/chunks/prompt-terminal-ledger-2QASOGMM.js +111 -0
  264. package/chunks/{pt-D73IFYT7.js → pt-FXMYXEUV.js} +1 -0
  265. package/chunks/{qwenContentGenerator-VI4KATRY.js → qwenContentGenerator-AELTUTH6.js} +52 -49
  266. package/chunks/{qwenOAuth2-7AOCKSOQ.js → qwenOAuth2-BS5D2LYV.js} +7 -7
  267. package/chunks/{read-file-P7F4P7LV.js → read-file-PDWHZPHX.js} +13 -11
  268. package/chunks/{read-mcp-resource-GLAGB6R7.js → read-mcp-resource-YXJZ75UB.js} +2 -2
  269. package/chunks/{record-artifact-SWVR7NSU.js → record-artifact-WJDOV6XU.js} +4 -4
  270. package/chunks/{report-findings-AL5YW3KI.js → report-findings-Q4UACKWR.js} +5 -5
  271. package/chunks/{request-shutdown-5YK4IZ54.js → request-shutdown-2YZ3E3GH.js} +8 -8
  272. package/chunks/resumeHistoryUtils-QRXZEEBA.js +124 -0
  273. package/chunks/ripGrep-KSOOLE6H.js +39 -0
  274. package/chunks/{ru-QMISLKRH.js → ru-RMHURE5U.js} +1 -0
  275. package/chunks/{run-qwen-serve-OGTEEUR2.js → run-qwen-serve-RTAREPT6.js} +84 -70
  276. package/chunks/runtime-ESFSCJRZ.js +154 -0
  277. package/chunks/scheduled-tasks-6ZHRNBH6.js +133 -0
  278. package/chunks/{scheduler-73YXGUGW.js → scheduler-DQI6KV7T.js} +63 -58
  279. package/chunks/{sdk-exporters-http-3JO5TJNU.js → sdk-exporters-http-7R2ARBPV.js} +2 -2
  280. package/chunks/{sdk-impl-HZAUUTHJ.js → sdk-impl-YOLO7LV4.js} +4 -4
  281. package/chunks/{send-message-JC7NJTY6.js → send-message-PQCVSVMN.js} +24 -24
  282. package/chunks/serve-FY7ZEW52.js +124 -0
  283. package/chunks/{server-AOYZVVOM.js → server-KNDY6K5F.js} +1594 -273
  284. package/chunks/{session-UAWFNFGI.js → session-MCEPXAZP.js} +113 -105
  285. package/chunks/session-attachments-root-OLNAE6GF.js +109 -0
  286. package/chunks/{session-pr-refresh-CT2INROL.js → session-pr-refresh-HKJHQQQK.js} +67 -62
  287. package/chunks/{settings-BHRGDASJ.js → settings-VXO4WBMK.js} +68 -63
  288. package/chunks/shell-U263OTES.js +96 -0
  289. package/chunks/{skill-ZGBKNCHQ.js → skill-SDODGBKL.js} +19 -17
  290. package/chunks/skill-settings-YEIA22QJ.js +124 -0
  291. package/chunks/spawnChannel-4WJZVFPP.js +117 -0
  292. package/chunks/standalone-update-ZWVQUO64.js +124 -0
  293. package/chunks/{start-opentui-ui-FZ4USOU7.js → start-opentui-ui-BFYCJQRZ.js} +1199 -190
  294. package/chunks/{startInteractiveUI-E2WQJUOA.js → startInteractiveUI-JYAFCMHL.js} +2977 -2319
  295. package/chunks/{syntheticOutput-HJNZSEHN.js → syntheticOutput-AUAJBNXR.js} +3 -3
  296. package/chunks/{task-create-6RSD54S5.js → task-create-LD5ISM3E.js} +12 -12
  297. package/chunks/{task-list-IQSACPOM.js → task-list-YISJ4RJA.js} +5 -5
  298. package/chunks/{task-stop-HE2LRQNW.js → task-stop-65ZOVATJ.js} +2 -2
  299. package/chunks/{task-update-XAJ2NYOA.js → task-update-AAN4ZVEY.js} +15 -15
  300. package/chunks/{team-create-SOKMYSQU.js → team-create-KU7MABNO.js} +47 -44
  301. package/chunks/{team-delete-NGNNKGMG.js → team-delete-XFRRTJTT.js} +5 -5
  302. package/chunks/{team-plan-approval-U7ZWXYAY.js → team-plan-approval-DPB377A3.js} +46 -43
  303. package/chunks/terminal-image-renderer-WGWRENOF.js +124 -0
  304. package/chunks/theme-manager-GBUFULSO.js +108 -0
  305. package/chunks/{todoWrite-5UTVUXHA.js → todoWrite-G7NT4IFP.js} +5 -5
  306. package/chunks/{tool-search-IAI2RVWT.js → tool-search-6YUXHBPT.js} +19 -17
  307. package/chunks/total-session-admission-54R2JQ5L.js +118 -0
  308. package/chunks/trustedFolders-KAJIDJTH.js +128 -0
  309. package/chunks/{update-relaunch-5RWKZAL3.js → update-relaunch-XM4IWBFD.js} +5 -5
  310. package/chunks/updateCheck-W6UZFURI.js +124 -0
  311. package/chunks/useAutoAcceptIndicator-LAWYHY3U.js +126 -0
  312. package/chunks/{validateNonInterActiveAuth-QPFEKATS.js → validateNonInterActiveAuth-7WCKHRN2.js} +109 -101
  313. package/chunks/{version-JKNG7YDH.js → version-3ZU43RJ6.js} +1 -1
  314. package/chunks/{web-fetch-X3AHIIHW.js → web-fetch-QHI2SQL4.js} +16 -14
  315. package/chunks/{web-search-K2FMOGS5.js → web-search-3KZZKWNY.js} +9 -8
  316. package/chunks/{workflow-TOLPAK5G.js → workflow-HRW7Y2X4.js} +330 -1667
  317. package/chunks/workspace-providers-status-KTGCWCPC.js +120 -0
  318. package/chunks/{workspace-registration-store-KQWVVW4Y.js → workspace-registration-store-LHLPPWNE.js} +1 -1
  319. package/chunks/workspace-registry-X34MLN52.js +127 -0
  320. package/chunks/workspace-runtime-coordinator-U4PW4P7K.js +128 -0
  321. package/chunks/workspace-service-KD7BCGYL.js +132 -0
  322. package/chunks/workspace-skills-status-YJGO6Y3T.js +119 -0
  323. package/chunks/{workspace-trust-reconciler-IBDFQBQS.js → workspace-trust-reconciler-EUYHISCH.js} +74 -69
  324. package/chunks/write-file-EBSB34NJ.js +91 -0
  325. package/chunks/{zh-25DF7OGK.js → zh-DVFYHRK5.js} +3 -1
  326. package/chunks/{zh-TW-5EDMZVGK.js → zh-TW-W2GNP2IU.js} +3 -1
  327. package/chunks/{zoom-image-IFXSN74N.js → zoom-image-UJ5VKWKP.js} +13 -11
  328. package/cli.js +13 -13
  329. package/export-transcript-document.js +617 -0
  330. package/locales/ca.js +1 -0
  331. package/locales/de.js +1 -0
  332. package/locales/en.js +5 -2
  333. package/locales/fr.js +1 -0
  334. package/locales/ja.js +1 -0
  335. package/locales/pt.js +1 -0
  336. package/locales/ru.js +1 -0
  337. package/locales/zh-TW.js +5 -2
  338. package/locales/zh.js +5 -2
  339. package/package.json +5 -4
  340. package/web-shell/assets/{abnfDiagram-VCTEODGH-Cxf7xE_Z.js → abnfDiagram-VCTEODGH-Dur--luQ.js} +1 -1
  341. package/web-shell/assets/{arc-ESi1eNkE.js → arc-tYLobxFi.js} +1 -1
  342. package/web-shell/assets/{architectureDiagram-5GKGNRK7-D9l7-bDo.js → architectureDiagram-5GKGNRK7-IG6aXD03.js} +1 -1
  343. package/web-shell/assets/{blockDiagram-NRAW4CY4-Bc8DEasw.js → blockDiagram-NRAW4CY4-C6eBSkfA.js} +1 -1
  344. package/web-shell/assets/{c4Diagram-UCG6FXSJ-Dimb2Hmh.js → c4Diagram-UCG6FXSJ-BrX3HJqB.js} +1 -1
  345. package/web-shell/assets/channel-uEkvKckd.js +1 -0
  346. package/web-shell/assets/{chunk-2Q5K7J3B-jVDmOpAQ.js → chunk-2Q5K7J3B-B3fcJ8ee.js} +1 -1
  347. package/web-shell/assets/{chunk-5VM5RSS4-DbG_SwdB.js → chunk-5VM5RSS4-CeC90yKM.js} +1 -1
  348. package/web-shell/assets/{chunk-F27PBJKO-QEc4cY1v.js → chunk-F27PBJKO-CW44RVki.js} +1 -1
  349. package/web-shell/assets/{chunk-G27WJ6UU-iJ36lQ3X.js → chunk-G27WJ6UU-D1PAMukD.js} +1 -1
  350. package/web-shell/assets/{chunk-JWPE2WC7-DuArnVtF.js → chunk-JWPE2WC7-Dt3Y2Fvx.js} +1 -1
  351. package/web-shell/assets/{chunk-LCL6LL3I-DxOf1zwL.js → chunk-LCL6LL3I-CZHw2lLI.js} +1 -1
  352. package/web-shell/assets/{chunk-POPQ4Y6H-lVLu9Ild.js → chunk-POPQ4Y6H-ysNAdTGx.js} +1 -1
  353. package/web-shell/assets/{chunk-SVP7TREG-C6XYlIer.js → chunk-SVP7TREG-BdNXW6YQ.js} +1 -1
  354. package/web-shell/assets/{chunk-XXDRQBXY-CiG2j2Ji.js → chunk-XXDRQBXY-DgqQ9UA8.js} +1 -1
  355. package/web-shell/assets/classDiagram-DTDB5LWJ-DuPsnhWS.js +1 -0
  356. package/web-shell/assets/classDiagram-v2-JRS7N3AN-DuPsnhWS.js +1 -0
  357. package/web-shell/assets/{cose-bilkent-JH36ORCC-DGVHMMVm.js → cose-bilkent-JH36ORCC-BILImXzJ.js} +1 -1
  358. package/web-shell/assets/{cynefin-OW5HDTMX-D6cgpCnH.js → cynefin-OW5HDTMX-DR88Pund.js} +1 -1
  359. package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-BKv4Z-UX.js → cynefinDiagram-5FMLGOSQ-BYFbfkA6.js} +1 -1
  360. package/web-shell/assets/{dagre-3AP2YEHR-B4ABMIG-.js → dagre-3AP2YEHR-rfpyc6sX.js} +1 -1
  361. package/web-shell/assets/{diagram-S7CK7UJ4-DgCkp_Lm.js → diagram-S7CK7UJ4-BJxLmEwH.js} +1 -1
  362. package/web-shell/assets/{diagram-UQ7AKVKN-FG0FNokz.js → diagram-UQ7AKVKN-H34xm7k3.js} +1 -1
  363. package/web-shell/assets/{diagram-VSXAHHWV-JgkP9qg-.js → diagram-VSXAHHWV-HYxhwNLx.js} +1 -1
  364. package/web-shell/assets/{diagram-VX7I27RA-ADh2x83l.js → diagram-VX7I27RA-BJazso8F.js} +1 -1
  365. package/web-shell/assets/{diagram-Z3DM3KII-yXqoYF1J.js → diagram-Z3DM3KII-Clje1aNy.js} +1 -1
  366. package/web-shell/assets/{ebnfDiagram-PWID7BFC-Duk83Ek_.js → ebnfDiagram-PWID7BFC-M93YBkFh.js} +1 -1
  367. package/web-shell/assets/{erDiagram-SSCWMZ5O-DMdvxySG.js → erDiagram-SSCWMZ5O-DY8XzSHU.js} +1 -1
  368. package/web-shell/assets/{flowDiagram-A5DVABFB-DHjVgSji.js → flowDiagram-A5DVABFB-CE6Aylcq.js} +1 -1
  369. package/web-shell/assets/{ganttDiagram-EL5Y4UJY-DMM9DkCE.js → ganttDiagram-EL5Y4UJY-DI-5LL22.js} +1 -1
  370. package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-t_ug9vO8.js → gitGraphDiagram-WWUBYQGX-C7BZWElk.js} +1 -1
  371. package/web-shell/assets/index-CVyqwW7y.js +2142 -0
  372. package/web-shell/assets/{index-zqvnpGHv.js → index-DclFHns9.js} +1 -1
  373. package/web-shell/assets/index-FO7JXPnH.css +36 -0
  374. package/web-shell/assets/{infoDiagram-RXCK75RN-eT1fANNm.js → infoDiagram-RXCK75RN-CGUSy4Pc.js} +1 -1
  375. package/web-shell/assets/{ishikawaDiagram-5VMMS53U-k3evzZNn.js → ishikawaDiagram-5VMMS53U-B5BVks9q.js} +1 -1
  376. package/web-shell/assets/{journeyDiagram-EYS64GPL-CGim3EAi.js → journeyDiagram-EYS64GPL-CFh6Tf7h.js} +1 -1
  377. package/web-shell/assets/{kanban-definition-3QL26DDD-WHfJo-22.js → kanban-definition-3QL26DDD-B7TlxP7c.js} +1 -1
  378. package/web-shell/assets/{layout-DkqIaFlJ.js → layout-Br_pZq2Q.js} +1 -1
  379. package/web-shell/assets/{linear-Bdkd3mCz.js → linear-BVlP6fte.js} +1 -1
  380. package/web-shell/assets/{mermaid.core-CGw0LkT_.js → mermaid.core-TrcYWoiF.js} +6 -6
  381. package/web-shell/assets/{mindmap-definition-FBJOCRG2-C9V4rBvo.js → mindmap-definition-FBJOCRG2-BJ4LzqjZ.js} +1 -1
  382. package/web-shell/assets/{pegDiagram-XKGWAZYB-CwoI2T5G.js → pegDiagram-XKGWAZYB-1b_MxlOl.js} +1 -1
  383. package/web-shell/assets/{pieDiagram-E7YTZNPT-DaTmBmPG.js → pieDiagram-E7YTZNPT-B8zl0YhY.js} +1 -1
  384. package/web-shell/assets/{quadrantDiagram-AXDQQJYC-plh6MyGI.js → quadrantDiagram-AXDQQJYC-CIZO8ukl.js} +1 -1
  385. package/web-shell/assets/{railroadDiagram-O6MQD6OU-D_b-S0iK.js → railroadDiagram-O6MQD6OU-CepHSbCj.js} +1 -1
  386. package/web-shell/assets/{requirementDiagram-EFPCY7ZU-zUzTN7VE.js → requirementDiagram-EFPCY7ZU-BCgxkcSW.js} +1 -1
  387. package/web-shell/assets/{sankeyDiagram-P5KCCOFB-m6AhoD0l.js → sankeyDiagram-P5KCCOFB-CE5CcoMM.js} +1 -1
  388. package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-Cwhzsine.js → sequenceDiagram-WJ2MYXX4-DvgHi-d5.js} +1 -1
  389. package/web-shell/assets/{sizeCapture-X5ZJPWSS-CcZuKIae.js → sizeCapture-X5ZJPWSS-T-fAsCPX.js} +1 -1
  390. package/web-shell/assets/{stateDiagram-HBIQ2CUA-CFoiJwD_.js → stateDiagram-HBIQ2CUA-DYHaul-5.js} +1 -1
  391. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-BcYho9a4.js +1 -0
  392. package/web-shell/assets/{swimlanes-XN3QIQJK-CgS9hcaV.js → swimlanes-XN3QIQJK-Dbz3Qiej.js} +1 -1
  393. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-D6HsOIgX.js +8 -0
  394. package/web-shell/assets/{timeline-definition-24CTP7MA-Dzzc05t9.js → timeline-definition-24CTP7MA-9NVRts3N.js} +1 -1
  395. package/web-shell/assets/{vennDiagram-4TSXK5OY-DemK0f7Y.js → vennDiagram-4TSXK5OY-C7cb7vnH.js} +1 -1
  396. package/web-shell/assets/{wardleyDiagram-VM6X3IG4-CquLxtMr.js → wardleyDiagram-VM6X3IG4-CG-8Ddjm.js} +1 -1
  397. package/web-shell/assets/{xychartDiagram-S5SC5T6Z-BTBKTM5g.js → xychartDiagram-S5SC5T6Z-iGeYAcP4.js} +1 -1
  398. package/web-shell/index.html +2 -2
  399. package/chunks/MaxSizedBox-B3D7545A.js +0 -111
  400. package/chunks/agent-headless-OC2IB55D.js +0 -85
  401. package/chunks/askUserQuestion-THQZMG44.js +0 -322
  402. package/chunks/bridge-IHSBI2YJ.js +0 -118
  403. package/chunks/channel-settings-store-BVKWAI2T.js +0 -121
  404. package/chunks/chunk-I2TMJPCV.js +0 -448
  405. package/chunks/chunk-QI27MKNQ.js +0 -4008
  406. package/chunks/config-utils-LVSYDLHZ.js +0 -114
  407. package/chunks/contextCommand-TZD7UAJK.js +0 -107
  408. package/chunks/daemon-status-provider-GRRVCJFW.js +0 -117
  409. package/chunks/daemon-trust-policy-YJL442BK.js +0 -113
  410. package/chunks/deferred-core-runtime-S32AYVZI.js +0 -115
  411. package/chunks/earlyInputCapture-BBPCIVZG.js +0 -108
  412. package/chunks/environment-VN6RXDVN.js +0 -130
  413. package/chunks/errors-UEY36PIT.js +0 -114
  414. package/chunks/exitPlanMode-EPHIEDAA.js +0 -83
  415. package/chunks/handleAutoUpdate-HVWQT2AU.js +0 -110
  416. package/chunks/i18n-5OR7NTRZ.js +0 -125
  417. package/chunks/initializer-JE5RQSOE.js +0 -114
  418. package/chunks/installationInfo-KO3CCSCK.js +0 -108
  419. package/chunks/list-3IORSFIY.js +0 -117
  420. package/chunks/loadedSettingsAdapter-KLLFZF3M.js +0 -111
  421. package/chunks/mcp-A2UEHETW.js +0 -111
  422. package/chunks/nonInteractiveCli-YA47F2F4.js +0 -190
  423. package/chunks/pidfile-ETHAZNMY.js +0 -112
  424. package/chunks/prompt-terminal-ledger-GZ747VYE.js +0 -106
  425. package/chunks/resumeHistoryUtils-DPZKFW24.js +0 -119
  426. package/chunks/ripGrep-C7LJKUPZ.js +0 -37
  427. package/chunks/runtime-LNBLEMZS.js +0 -149
  428. package/chunks/scheduled-tasks-FLDYZQOF.js +0 -128
  429. package/chunks/serve-3UR2H4CV.js +0 -119
  430. package/chunks/session-attachments-root-ZCGXQQTR.js +0 -104
  431. package/chunks/shell-YHOGC7TO.js +0 -93
  432. package/chunks/skill-settings-AKSP665O.js +0 -119
  433. package/chunks/spawnChannel-N25MBB6F.js +0 -112
  434. package/chunks/standalone-update-XGPWJDRN.js +0 -119
  435. package/chunks/terminal-image-renderer-KKM4OBLO.js +0 -117
  436. package/chunks/theme-manager-GQHF3A7T.js +0 -103
  437. package/chunks/total-session-admission-G4CGCSTG.js +0 -113
  438. package/chunks/trustedFolders-D2I3FDPB.js +0 -123
  439. package/chunks/updateCheck-ZXOQDFEI.js +0 -119
  440. package/chunks/useAutoAcceptIndicator-6EK4QGAH.js +0 -121
  441. package/chunks/workspace-providers-status-PCJK3RC7.js +0 -115
  442. package/chunks/workspace-registry-YNIOB6HJ.js +0 -122
  443. package/chunks/workspace-runtime-coordinator-WG2RNEN7.js +0 -123
  444. package/chunks/workspace-service-G4ZNBOFH.js +0 -127
  445. package/chunks/workspace-skills-status-FMTPPMWC.js +0 -114
  446. package/chunks/write-file-YTLFY2S5.js +0 -88
  447. package/web-shell/assets/channel-B7ohGDil.js +0 -1
  448. package/web-shell/assets/classDiagram-DTDB5LWJ-DdFpqpfD.js +0 -1
  449. package/web-shell/assets/classDiagram-v2-JRS7N3AN-DdFpqpfD.js +0 -1
  450. package/web-shell/assets/index-BGZRqbRo.css +0 -36
  451. package/web-shell/assets/index-DRri_6_x.js +0 -2067
  452. package/web-shell/assets/stateDiagram-v2-4QOOHH4V--H8HdEmk.js +0 -1
  453. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-ShE9OIgf.js +0 -8
@@ -4,8 +4,9 @@ import {
4
4
  PollingChannelBase,
5
5
  isTerminalTaskLifecycleType,
6
6
  sanitizeLogText,
7
+ stripMessagePrefix,
7
8
  truncateCodePoints
8
- } from "./chunk-U4DJ5XB3.js";
9
+ } from "./chunk-VDXYYVCD.js";
9
10
  import "./chunk-IW6RQPQB.js";
10
11
  import "./chunk-CQ35AJ4Z.js";
11
12
  import {
@@ -770,8 +771,6 @@ var DwsClient = class {
770
771
  const result = onMessage(message);
771
772
  if (!result || !("admitted" in result))
772
773
  return result;
773
- if (source.kind !== "direct")
774
- return result.completed;
775
774
  const reportError = /* @__PURE__ */ __name((error) => {
776
775
  try {
777
776
  onError(error instanceof Error ? error : new Error(String(error)));
@@ -1076,7 +1075,7 @@ var MAX_DOCUMENT_CONTEXT_CHARS = 12e3;
1076
1075
  var MAX_TODO_CONTEXT_CHARS = 12e3;
1077
1076
  var MAX_COMMENT_CHARS = 4e3;
1078
1077
  var MAX_PROCESSED_ITEMS = 5e3;
1079
- var MAX_DIRECT_REPLAY_DISPATCHES = 16;
1078
+ var MAX_REPLAY_CONVERSATIONS = 16;
1080
1079
  var MAX_INBOUND_ATTEMPTS = 5;
1081
1080
  var MAX_IM_TARGETS = 1e3;
1082
1081
  var MAX_TODO_STATES = 1e3;
@@ -1205,12 +1204,12 @@ function isPendingMessage(value) {
1205
1204
  return false;
1206
1205
  }
1207
1206
  const pending = value;
1208
- const sourceValid = pending.source?.kind === "direct" || pending.source?.kind === "group-all" || pending.source?.kind === "group" && typeof pending.source.conversationId === "string" && Boolean(pending.source.conversationId);
1207
+ const sourceValid = pending.source?.kind === "at" || pending.source?.kind === "direct" || pending.source?.kind === "group-all" || pending.source?.kind === "group" && typeof pending.source.conversationId === "string" && Boolean(pending.source.conversationId);
1209
1208
  const message = pending.message;
1210
1209
  if (!sourceValid || typeof message !== "object" || message === null) {
1211
1210
  return false;
1212
1211
  }
1213
- return (message.type === "user_im_message_receive_o2o" || message.type === "user_im_message_receive_o2o_all" || message.type === "user_im_message_receive_group" || message.type === "user_im_message_receive_group_all") && [
1212
+ return (message.type === "user_im_message_receive_at" || message.type === "user_im_message_receive_o2o" || message.type === "user_im_message_receive_o2o_all" || message.type === "user_im_message_receive_group" || message.type === "user_im_message_receive_group_all") && [
1214
1213
  message.type,
1215
1214
  message.eventId,
1216
1215
  message.messageId,
@@ -1285,6 +1284,14 @@ function sourceLabel(source) {
1285
1284
  return "group messages";
1286
1285
  }
1287
1286
  __name(sourceLabel, "sourceLabel");
1287
+ function sameImSource(left, right) {
1288
+ if (left.kind !== right.kind)
1289
+ return false;
1290
+ if (left.kind !== "group")
1291
+ return true;
1292
+ return right.kind === "group" && left.conversationId === right.conversationId;
1293
+ }
1294
+ __name(sameImSource, "sameImSource");
1288
1295
  function retryLimit(error) {
1289
1296
  if (!(error instanceof DwsEventProcessError))
1290
1297
  return 1;
@@ -1338,6 +1345,7 @@ var DwsChannel = class extends PollingChannelBase {
1338
1345
  userInstructions;
1339
1346
  client;
1340
1347
  imStates;
1348
+ dwsMessagePrefix;
1341
1349
  startReactionName;
1342
1350
  endReactionName;
1343
1351
  watchTodos;
@@ -1348,13 +1356,17 @@ var DwsChannel = class extends PollingChannelBase {
1348
1356
  endReactionKeys = /* @__PURE__ */ new Set();
1349
1357
  notifiedSenderPairingNotifications = /* @__PURE__ */ new Set();
1350
1358
  processingMessages = /* @__PURE__ */ new Map();
1351
- queuedDirectMessages = /* @__PURE__ */ new Map();
1352
- // Replay-started direct dispatches only. The cap must not be consumed by
1359
+ queuedMessages = /* @__PURE__ */ new Map();
1360
+ // Replay-started dispatches only. The cap must not be consumed by
1353
1361
  // live or followup traffic, whose queue entries outlive their turn.
1354
- replayDirectDispatches = /* @__PURE__ */ new Map();
1355
- directConversationTails = /* @__PURE__ */ new Map();
1356
- directMessageStartResolvers = /* @__PURE__ */ new Map();
1362
+ replayDispatches = /* @__PURE__ */ new Map();
1363
+ attemptedPendingMessages = /* @__PURE__ */ new Set();
1364
+ conversationTails = /* @__PURE__ */ new Map();
1365
+ messageStartResolvers = /* @__PURE__ */ new Map();
1366
+ processingMessageGenerations = /* @__PURE__ */ new Map();
1357
1367
  pendingMessageCapacityWaiters = /* @__PURE__ */ new Set();
1368
+ drainingImSubscriptions = /* @__PURE__ */ new Set();
1369
+ pendingImStartups = /* @__PURE__ */ new Set();
1358
1370
  pollAbortController = new AbortController();
1359
1371
  lifecycleGeneration = 0;
1360
1372
  connectionStartedAt = 0;
@@ -1363,6 +1375,7 @@ var DwsChannel = class extends PollingChannelBase {
1363
1375
  notificationWatermarkPulledBack = false;
1364
1376
  constructor(name, config, bridge, options, client) {
1365
1377
  const profile = configuredString(config.profile, "profile");
1378
+ const messagePrefix = configuredString(config.messagePrefix, "messagePrefix");
1366
1379
  const startReactionName = configuredString(config.startReaction, "startReaction") ?? DEFAULT_START_REACTION;
1367
1380
  const endReactionName = configuredString(config.endReaction, "endReaction");
1368
1381
  const watchTodos = configuredBoolean(config.watchTodos, "watchTodos");
@@ -1394,6 +1407,7 @@ var DwsChannel = class extends PollingChannelBase {
1394
1407
  }));
1395
1408
  this.startReactionName = startReactionName;
1396
1409
  this.endReactionName = endReactionName;
1410
+ this.dwsMessagePrefix = messagePrefix;
1397
1411
  this.watchTodos = watchTodos;
1398
1412
  }
1399
1413
  createInitialCursor() {
@@ -1431,7 +1445,7 @@ var DwsChannel = class extends PollingChannelBase {
1431
1445
  notificationCheckpoint: cursor.notificationCheckpoint,
1432
1446
  mentionCheckpoint: cursor.mentionCheckpoint,
1433
1447
  pendingDocumentNotifications: (cursor.pendingDocumentNotifications ?? []).slice(-MAX_PROCESSED_ITEMS),
1434
- pendingMessages: (cursor.pendingMessages ?? []).slice(-MAX_PROCESSED_ITEMS),
1448
+ pendingMessages: (cursor.pendingMessages ?? []).slice(),
1435
1449
  processedMessages: cursor.processedMessages.slice(-MAX_PROCESSED_ITEMS),
1436
1450
  imTargets: cursor.imTargets.slice(-MAX_IM_TARGETS),
1437
1451
  todosInitialized: cursor.todosInitialized ?? false,
@@ -1444,9 +1458,13 @@ var DwsChannel = class extends PollingChannelBase {
1444
1458
  if (this.connected)
1445
1459
  return;
1446
1460
  const generation = ++this.lifecycleGeneration;
1447
- this.connectionStartedAt = Date.now();
1448
1461
  this.pollAbortController.abort();
1449
1462
  this.pollAbortController = new AbortController();
1463
+ await this.waitForDisconnect();
1464
+ if (generation !== this.lifecycleGeneration) {
1465
+ throw new Error("DWS channel connection was cancelled.");
1466
+ }
1467
+ this.connectionStartedAt = Date.now();
1450
1468
  await this.client.assertCompatible?.(this.pollAbortController.signal);
1451
1469
  if (generation !== this.lifecycleGeneration) {
1452
1470
  throw new Error("DWS channel connection was cancelled.");
@@ -1504,7 +1522,10 @@ var DwsChannel = class extends PollingChannelBase {
1504
1522
  }
1505
1523
  this.connected = true;
1506
1524
  try {
1507
- await Promise.all(this.imStates.map((state) => this.startImSourceWithRetry(state, generation)));
1525
+ const startups = this.imStates.map((state) => this.startImSourceWithRetry(state, generation));
1526
+ for (const startup of startups)
1527
+ this.trackImStartup(startup);
1528
+ await Promise.all(startups);
1508
1529
  if (generation !== this.lifecycleGeneration || !this.connected) {
1509
1530
  throw new Error("DWS channel connection was cancelled.");
1510
1531
  }
@@ -1537,12 +1558,13 @@ var DwsChannel = class extends PollingChannelBase {
1537
1558
  this.cleanupReaction(key, "disconnect reaction removal");
1538
1559
  }
1539
1560
  this.sessionReactionKeys.clear();
1540
- this.queuedDirectMessages.clear();
1541
- this.replayDirectDispatches.clear();
1542
- for (const resolve of this.directMessageStartResolvers.values())
1561
+ this.queuedMessages.clear();
1562
+ this.replayDispatches.clear();
1563
+ this.attemptedPendingMessages.clear();
1564
+ for (const { resolve } of this.messageStartResolvers.values())
1543
1565
  resolve();
1544
- this.directMessageStartResolvers.clear();
1545
- this.directConversationTails.clear();
1566
+ this.messageStartResolvers.clear();
1567
+ this.conversationTails.clear();
1546
1568
  for (const resolve of this.pendingMessageCapacityWaiters)
1547
1569
  resolve();
1548
1570
  this.pendingMessageCapacityWaiters.clear();
@@ -1551,11 +1573,34 @@ var DwsChannel = class extends PollingChannelBase {
1551
1573
  if (state.retryTimer)
1552
1574
  clearTimeout(state.retryTimer);
1553
1575
  state.retryTimer = void 0;
1554
- state.subscription?.stop();
1576
+ const subscription = state.subscription;
1577
+ if (subscription) {
1578
+ void this.drainImSubscription(subscription);
1579
+ }
1555
1580
  state.subscription = void 0;
1556
1581
  state.restartAttempts = 0;
1557
1582
  }
1558
1583
  }
1584
+ async waitForDisconnect() {
1585
+ while (this.pendingImStartups.size > 0 || this.drainingImSubscriptions.size > 0) {
1586
+ await Promise.all([
1587
+ ...this.pendingImStartups,
1588
+ ...this.drainingImSubscriptions
1589
+ ]);
1590
+ }
1591
+ }
1592
+ trackImStartup(startup) {
1593
+ const settled = startup.then(() => void 0, () => void 0);
1594
+ this.pendingImStartups.add(settled);
1595
+ void settled.then(() => this.pendingImStartups.delete(settled));
1596
+ }
1597
+ drainImSubscription(subscription) {
1598
+ const drain = subscription.closed.then(() => void 0, () => void 0);
1599
+ this.drainingImSubscriptions.add(drain);
1600
+ void drain.then(() => this.drainingImSubscriptions.delete(drain));
1601
+ subscription.stop();
1602
+ return drain;
1603
+ }
1559
1604
  supportsProactiveSend() {
1560
1605
  return true;
1561
1606
  }
@@ -1724,6 +1769,7 @@ Ask the bot operator to approve you with:
1724
1769
  const signal = this.pollAbortController.signal;
1725
1770
  if (!this.connected || signal.aborted)
1726
1771
  return;
1772
+ this.attemptedPendingMessages.clear();
1727
1773
  const endTime = Date.now();
1728
1774
  await this.replayPendingMessages(signal);
1729
1775
  if (signal.aborted || !this.connected)
@@ -1742,8 +1788,16 @@ Ask the bot operator to approve you with:
1742
1788
  for (const message of mentions.messages) {
1743
1789
  if (signal.aborted || !this.connected)
1744
1790
  return;
1745
- await this.receiveImMessage({ kind: "at" }, message, true);
1791
+ const key = messageKey(message);
1792
+ if (this.cursor.processedMessages.includes(key))
1793
+ continue;
1794
+ if (this.hasPendingMessage(key))
1795
+ continue;
1796
+ this.enqueuePendingConversation(message.conversationId);
1797
+ await this.admitHistoryMessage({ kind: "at" }, message);
1746
1798
  }
1799
+ if (signal.aborted || !this.connected)
1800
+ return;
1747
1801
  if (mentions.nextCursor) {
1748
1802
  this.cursor.mentionCheckpoint = {
1749
1803
  ...mentionCheckpoint,
@@ -1777,7 +1831,8 @@ Ask the bot operator to approve you with:
1777
1831
  }
1778
1832
  if (this.hasPendingMessage(key))
1779
1833
  continue;
1780
- await this.receiveDirectMessage(message, true).admitted;
1834
+ this.enqueuePendingConversation(message.conversationId);
1835
+ await this.admitHistoryMessage({ kind: "direct" }, message);
1781
1836
  }
1782
1837
  if (signal.aborted || !this.connected)
1783
1838
  return;
@@ -1883,6 +1938,7 @@ Ask the bot operator to approve you with:
1883
1938
  text: `Process this DingTalk todo:
1884
1939
  ${truncateCodePoints(title, MAX_COMMENT_CHARS)}`,
1885
1940
  displayText: title,
1941
+ bypassMessagePrefix: true,
1886
1942
  isGroup: true,
1887
1943
  isMentioned: true,
1888
1944
  isReplyToBot: false,
@@ -1924,17 +1980,21 @@ ${truncateCodePoints(JSON.stringify(detail.data), MAX_TODO_CONTEXT_CHARS)}`
1924
1980
  this.saveCursor();
1925
1981
  }
1926
1982
  async startImSource(state, generation) {
1983
+ const connectionStartedAt = this.connectionStartedAt;
1927
1984
  const subscription = await this.client.subscribeToIm(state.source, (message) => {
1928
1985
  state.lastError = void 0;
1929
1986
  state.restartAttempts = 0;
1930
- return state.source.kind === "direct" ? this.receiveDirectMessage(message) : this.receiveImMessage(state.source, message);
1987
+ return this.receiveImMessage(state.source, message, false, false, {
1988
+ generation,
1989
+ connectionStartedAt
1990
+ });
1931
1991
  }, (error) => {
1932
1992
  if (error instanceof DwsEventProcessError)
1933
1993
  state.lastError = error;
1934
1994
  this.logImError(state.source, error);
1935
1995
  });
1936
1996
  if (!this.connected || generation !== this.lifecycleGeneration) {
1937
- subscription.stop();
1997
+ await this.drainImSubscription(subscription);
1938
1998
  return;
1939
1999
  }
1940
2000
  state.lastError = void 0;
@@ -2005,11 +2065,12 @@ ${truncateCodePoints(JSON.stringify(detail.data), MAX_TODO_CONTEXT_CHARS)}`
2005
2065
  if (!this.connected)
2006
2066
  return;
2007
2067
  state.lastError = void 0;
2008
- void this.startImSource(state, this.lifecycleGeneration).catch((error2) => {
2068
+ const startup = this.startImSource(state, this.lifecycleGeneration).catch((error2) => {
2009
2069
  const resolvedError2 = error2 instanceof Error ? error2 : new Error(String(error2));
2010
2070
  this.logImError(state.source, resolvedError2);
2011
2071
  this.scheduleImRestart(state, resolvedError2 instanceof DwsEventProcessError ? resolvedError2 : void 0);
2012
2072
  });
2073
+ this.trackImStartup(startup);
2013
2074
  }, delay);
2014
2075
  state.retryTimer.unref?.();
2015
2076
  }
@@ -2017,26 +2078,11 @@ ${truncateCodePoints(JSON.stringify(detail.data), MAX_TODO_CONTEXT_CHARS)}`
2017
2078
  process2.stderr.write(`[Channel:${this.name}] DWS ${sanitizeLogText(sourceLabel(source), 120)} stream error: ${sanitizeLogText(error.message, 300)}
2018
2079
  `);
2019
2080
  }
2020
- async receiveImMessage(source, message, fromHistory = false) {
2021
- if (!this.connected)
2022
- return;
2023
- if (this.markSelfMessageProcessed(message))
2024
- return;
2025
- if (this.isStaleLiveMessage(message, fromHistory) && message.eventTime !== void 0) {
2026
- this.markProcessedMessage(messageKey(message));
2027
- this.saveCursor();
2028
- return;
2029
- }
2030
- if (source.kind === "group-all" && (this.config.groups[message.conversationId]?.requireMention ?? this.config.groups["*"]?.requireMention ?? true)) {
2031
- return;
2032
- }
2033
- if ((source.kind === "group" || source.kind === "group-all") && this.config.groupPolicy === "pairing" && !this.groupGate.isGroupApproved(message.conversationId)) {
2034
- return;
2035
- }
2036
- await this.dispatchImMessage(source, message, messageKey(message));
2081
+ requiresMention(conversationId) {
2082
+ return this.config.groups[conversationId]?.requireMention ?? this.config.groups["*"]?.requireMention ?? true;
2037
2083
  }
2038
- receiveDirectMessage(message, fromHistory = false, reportFailure = fromHistory) {
2039
- const admission = this.admitReceivedDirectMessage(message, fromHistory, reportFailure);
2084
+ receiveImMessage(source, message, fromHistory = false, reportFailure = fromHistory, admissionContext) {
2085
+ const admission = this.admitReceivedMessage(source, message, fromHistory, reportFailure, admissionContext);
2040
2086
  const completed = admission.then(({ completion }) => completion);
2041
2087
  void completed.catch(() => void 0);
2042
2088
  return {
@@ -2044,50 +2090,124 @@ ${truncateCodePoints(JSON.stringify(detail.data), MAX_TODO_CONTEXT_CHARS)}`
2044
2090
  completed
2045
2091
  };
2046
2092
  }
2047
- async admitReceivedDirectMessage(message, fromHistory, reportFailure) {
2048
- if (!this.connected)
2049
- return { completion: Promise.resolve() };
2093
+ async admitReceivedMessage(source, message, fromHistory, reportFailure, admissionContext) {
2094
+ const isAmbientSource = source.kind === "group" || source.kind === "group-all";
2095
+ const isCurrentLifecycle = this.connected && (admissionContext === void 0 || admissionContext.generation === this.lifecycleGeneration);
2096
+ if (!isCurrentLifecycle && (!admissionContext || !isAmbientSource)) {
2097
+ return { completion: Promise.resolve(), remembered: true };
2098
+ }
2050
2099
  const key = messageKey(message);
2051
2100
  if (this.markSelfMessageProcessed(message)) {
2052
- return { completion: Promise.resolve() };
2101
+ return { completion: Promise.resolve(), remembered: true };
2053
2102
  }
2054
- if (this.isStaleLiveMessage(message, fromHistory) && message.eventTime !== void 0) {
2055
- this.cursor.notificationWatermark = Math.min(this.cursor.notificationWatermark ?? this.connectionStartedAt, message.eventTime);
2056
- this.notificationWatermarkPulledBack = true;
2057
- this.cursor.notificationCheckpoint = void 0;
2058
- process2.stderr.write(`[Channel:${this.name}] parked a stale direct message for history polling and pulled the watermark back to ${message.eventTime}: ${sanitizeLogText(message.messageId, 120)}
2059
- `);
2103
+ if (this.isStaleLiveMessage(message, fromHistory, admissionContext?.connectionStartedAt) && message.eventTime !== void 0) {
2104
+ if (source.kind === "direct") {
2105
+ this.parkStaleDirectMessage(message);
2106
+ return { completion: Promise.resolve(), remembered: true };
2107
+ }
2108
+ this.markProcessedMessage(key);
2060
2109
  this.saveCursor();
2061
- return { completion: Promise.resolve() };
2110
+ return { completion: Promise.resolve(), remembered: true };
2111
+ }
2112
+ if (this.shouldFilterImMessage(source, message)) {
2113
+ if (source.kind === "group" || source.kind === "group-all") {
2114
+ const text = stripMessagePrefix(message.content.trim(), this.dwsMessagePrefix);
2115
+ if (!this.dwsMessagePrefix || text) {
2116
+ const envelope = this.createImEnvelope(source, message, text);
2117
+ if (this.groupGate.check(envelope, { createPairingRequest: false }).reason === "mention_required" && !this.queuedMessages.has(key) && !this.cursor.processedMessages.includes(key) && !this.hasPendingMessage(key)) {
2118
+ this.recordPendingGroupHistory(envelope);
2119
+ }
2120
+ }
2121
+ }
2122
+ this.removePersistedPendingMessageForSource(key, source);
2123
+ return { completion: Promise.resolve(), remembered: true };
2124
+ }
2125
+ if (!isCurrentLifecycle) {
2126
+ if (this.cursor.processedMessages.includes(key)) {
2127
+ this.removePersistedPendingMessage(key);
2128
+ return { completion: Promise.resolve(), remembered: true };
2129
+ }
2130
+ this.rememberDrainingPendingMessage(source, message);
2131
+ return { completion: Promise.resolve(), remembered: true };
2062
2132
  }
2063
- return this.admitDirectMessage({ kind: "direct" }, message, key, reportFailure);
2133
+ return this.admitMessage(source, message, key, reportFailure);
2134
+ }
2135
+ async admitHistoryMessage(source, message) {
2136
+ const { completion, remembered } = await this.admitReceivedMessage(source, message, true, true);
2137
+ if (remembered) {
2138
+ void completion.catch(() => void 0);
2139
+ return;
2140
+ }
2141
+ await completion;
2142
+ }
2143
+ shouldFilterImMessage(source, message) {
2144
+ const groupConfig = this.config.groups[message.conversationId] ?? this.config.groups["*"];
2145
+ if ((source.kind === "group" || source.kind === "group-all") && (groupConfig?.requireMention ?? true)) {
2146
+ return true;
2147
+ }
2148
+ return (source.kind === "group" || source.kind === "group-all") && this.config.groupPolicy === "pairing" && !this.groupGate.isGroupApproved(message.conversationId);
2149
+ }
2150
+ parkStaleDirectMessage(message) {
2151
+ this.cursor.notificationWatermark = Math.min(this.cursor.notificationWatermark ?? this.connectionStartedAt, message.eventTime);
2152
+ this.notificationWatermarkPulledBack = true;
2153
+ this.cursor.notificationCheckpoint = void 0;
2154
+ process2.stderr.write(`[Channel:${this.name}] parked a stale direct message for history polling and pulled the watermark back to ${message.eventTime}: ${sanitizeLogText(message.messageId, 120)}
2155
+ `);
2156
+ this.saveCursor();
2064
2157
  }
2065
2158
  markSelfMessageProcessed(message) {
2066
2159
  if (!this.isSelfMessage(message))
2067
2160
  return false;
2068
- this.markProcessedMessage(messageKey(message));
2161
+ const key = messageKey(message);
2162
+ this.markProcessedMessage(key);
2163
+ this.removePendingMessage(key);
2069
2164
  this.saveCursor();
2070
2165
  return true;
2071
2166
  }
2072
- isStaleLiveMessage(message, fromHistory) {
2073
- return !fromHistory && message.eventTime !== void 0 && message.eventTime < this.connectionStartedAt - 5e3;
2167
+ isStaleLiveMessage(message, fromHistory, connectionStartedAt = this.connectionStartedAt) {
2168
+ return !fromHistory && message.eventTime !== void 0 && message.eventTime < connectionStartedAt - 5e3;
2074
2169
  }
2075
- async admitDirectMessage(source, message, key, reportFailure) {
2170
+ async admitMessage(source, message, key, reportFailure) {
2076
2171
  if (this.cursor.processedMessages.includes(key)) {
2077
2172
  this.removePersistedPendingMessage(key);
2078
- return { completion: Promise.resolve() };
2173
+ return { completion: Promise.resolve(), remembered: true };
2174
+ }
2175
+ if (!reportFailure) {
2176
+ this.enqueuePendingConversation(message.conversationId);
2079
2177
  }
2178
+ let remembered = true;
2080
2179
  if (!this.hasPendingMessage(key)) {
2081
- if (!await this.rememberPendingMessage(source, message)) {
2082
- return { completion: Promise.resolve() };
2180
+ const dispatchUnparkedAtCapacity = (source.kind === "at" || source.kind === "direct") && this.connected && (this.cursor.pendingMessages?.length ?? 0) >= MAX_PROCESSED_ITEMS;
2181
+ remembered = dispatchUnparkedAtCapacity ? false : source.kind === "group" || source.kind === "group-all" ? await this.rememberPendingMessageWhenAvailable(source, message) : await this.rememberPendingMessage(source, message);
2182
+ if (!remembered) {
2183
+ if (!dispatchUnparkedAtCapacity) {
2184
+ return { completion: Promise.resolve(), remembered };
2185
+ }
2083
2186
  }
2084
2187
  }
2085
2188
  return {
2086
- completion: this.scheduleDirectMessage(source, message, key, reportFailure)
2189
+ completion: this.scheduleMessage(source, message, key, reportFailure),
2190
+ remembered
2087
2191
  };
2088
2192
  }
2089
- scheduleDirectMessage(source, message, key, reportFailure) {
2090
- const queued = this.queuedDirectMessages.get(key);
2193
+ enqueuePendingConversation(conversationId) {
2194
+ for (const pending of [...this.cursor.pendingMessages ?? []]) {
2195
+ if (pending.message.conversationId !== conversationId)
2196
+ continue;
2197
+ const key = messageKey(pending.message);
2198
+ if (this.attemptedPendingMessages.has(key))
2199
+ continue;
2200
+ if (this.queuedMessages.has(key))
2201
+ continue;
2202
+ const dispatch = this.receiveImMessage(pending.source, pending.message, true, true);
2203
+ void dispatch.admitted.catch((error) => {
2204
+ process2.stderr.write(`[Channel:${this.name}] pending DWS message remains degraded: ${sanitizeLogText(error instanceof Error ? error.message : String(error), 300)}
2205
+ `);
2206
+ });
2207
+ }
2208
+ }
2209
+ scheduleMessage(source, message, key, reportFailure) {
2210
+ const queued = this.queuedMessages.get(key);
2091
2211
  if (queued)
2092
2212
  return queued;
2093
2213
  if (this.cursor.processedMessages.includes(key)) {
@@ -2099,10 +2219,10 @@ ${truncateCodePoints(JSON.stringify(detail.data), MAX_TODO_CONTEXT_CHARS)}`
2099
2219
  try {
2100
2220
  if (!this.connected || generation !== this.lifecycleGeneration)
2101
2221
  return;
2102
- await this.dispatchImMessage(source, message, key);
2222
+ await this.dispatchImMessage(source, message, key, generation);
2103
2223
  } finally {
2104
- if (this.queuedDirectMessages.get(key) === task) {
2105
- this.queuedDirectMessages.delete(key);
2224
+ if (this.queuedMessages.get(key) === task) {
2225
+ this.queuedMessages.delete(key);
2106
2226
  }
2107
2227
  }
2108
2228
  }, "dispatch");
@@ -2110,17 +2230,19 @@ ${truncateCodePoints(JSON.stringify(detail.data), MAX_TODO_CONTEXT_CHARS)}`
2110
2230
  const started = new Promise((resolve) => {
2111
2231
  resolveStarted = resolve;
2112
2232
  });
2113
- const previous = this.directConversationTails.get(message.conversationId);
2114
- const predecessor = reportFailure || this.config.dispatchMode === "followup" ? previous?.completed : previous?.started;
2233
+ const previous = this.conversationTails.get(message.conversationId);
2234
+ const groupConfig = source.kind === "direct" ? void 0 : this.config.groups[message.conversationId] ?? this.config.groups["*"];
2235
+ const predecessor = reportFailure || (groupConfig?.dispatchMode ?? this.config.dispatchMode) === "followup" ? previous?.completed : previous?.started;
2115
2236
  const task = predecessor ? predecessor.catch(() => void 0).then(dispatch) : Promise.resolve().then(dispatch);
2116
2237
  const tail = { started, completed: task };
2117
- this.queuedDirectMessages.set(key, task);
2118
- this.directMessageStartResolvers.set(key, resolveStarted);
2119
- this.directConversationTails.set(message.conversationId, tail);
2238
+ this.queuedMessages.set(key, task);
2239
+ const startResolver = { generation, resolve: resolveStarted };
2240
+ this.messageStartResolvers.set(key, startResolver);
2241
+ this.conversationTails.set(message.conversationId, tail);
2120
2242
  void task.finally(() => {
2121
- this.releaseDirectMessageStart(message.conversationId, message.messageId);
2122
- if (this.directConversationTails.get(message.conversationId) === tail) {
2123
- this.directConversationTails.delete(message.conversationId);
2243
+ this.releaseMessageStart(message.conversationId, message.messageId, startResolver);
2244
+ if (this.conversationTails.get(message.conversationId) === tail) {
2245
+ this.conversationTails.delete(message.conversationId);
2124
2246
  }
2125
2247
  }).catch(() => void 0);
2126
2248
  if (reportFailure) {
@@ -2130,20 +2252,28 @@ ${truncateCodePoints(JSON.stringify(detail.data), MAX_TODO_CONTEXT_CHARS)}`
2130
2252
  }
2131
2253
  return task;
2132
2254
  }
2133
- async dispatchImMessage(source, message, key) {
2255
+ async dispatchImMessage(source, message, key, generation) {
2134
2256
  let waitedOnInFlight = false;
2257
+ let waitedOnCurrentGeneration = false;
2135
2258
  let inFlightError;
2136
2259
  while (true) {
2137
2260
  const existing = this.processingMessages.get(key);
2138
2261
  if (!existing)
2139
2262
  break;
2140
2263
  waitedOnInFlight = true;
2264
+ if (this.processingMessageGenerations.get(key) === generation) {
2265
+ waitedOnCurrentGeneration = true;
2266
+ }
2141
2267
  inFlightError = await existing.then(() => void 0, (error) => error);
2142
2268
  }
2269
+ if (!this.connected || generation !== this.lifecycleGeneration)
2270
+ return;
2143
2271
  if (this.cursor.processedMessages.includes(key))
2144
2272
  return;
2145
- if (waitedOnInFlight && this.hasPendingMessage(key))
2273
+ if (waitedOnInFlight && waitedOnCurrentGeneration && this.hasPendingMessage(key)) {
2146
2274
  throw inFlightError;
2275
+ }
2276
+ this.processingMessageGenerations.set(key, generation);
2147
2277
  const task = this.processImMessage(source, message, key);
2148
2278
  this.processingMessages.set(key, task);
2149
2279
  try {
@@ -2154,49 +2284,37 @@ ${truncateCodePoints(JSON.stringify(detail.data), MAX_TODO_CONTEXT_CHARS)}`
2154
2284
  } finally {
2155
2285
  if (this.processingMessages.get(key) === task) {
2156
2286
  this.processingMessages.delete(key);
2287
+ this.processingMessageGenerations.delete(key);
2157
2288
  }
2158
2289
  }
2159
2290
  }
2160
2291
  async processImMessage(source, message, key) {
2292
+ const rawText = source.kind === "at" && this.requiresMention(message.conversationId) ? message.content.replace(/^\s*@[^\s\p{Cf}]+\s+(?=\/[a-zA-Z0-9_:-]+(?:\s|$))(?![\s\S]*(?<![A-Za-z0-9_])@)/u, "").trim() : message.content.trim();
2293
+ const providerDocumentNotification = source.kind === "direct" ? parseDocumentMentionNotification(rawText) : void 0;
2294
+ const text = providerDocumentNotification ? rawText : stripMessagePrefix(rawText, this.dwsMessagePrefix);
2295
+ if (this.dwsMessagePrefix && !text) {
2296
+ this.markProcessedMessage(key);
2297
+ this.saveCursor();
2298
+ return;
2299
+ }
2161
2300
  const target = source.kind === "direct" ? { kind: "direct", openDingTalkId: message.senderId } : { kind: "group", conversationId: message.conversationId };
2162
2301
  this.rememberImTarget(message.conversationId, target);
2163
- const text = message.content.trim();
2164
2302
  if (!text) {
2165
2303
  this.markProcessedMessage(key);
2166
2304
  this.saveCursor();
2167
2305
  return;
2168
2306
  }
2169
- const documentNotification = source.kind === "direct" ? parseDocumentMentionNotification(text) : void 0;
2307
+ const documentNotification = providerDocumentNotification ?? (source.kind === "direct" ? parseDocumentMentionNotification(text) : void 0);
2170
2308
  if (documentNotification) {
2171
2309
  await this.processDocumentNotification(message, key, documentNotification);
2172
2310
  return;
2173
2311
  }
2174
- const isGroup = source.kind !== "direct";
2175
- const envelope = {
2176
- channelName: this.name,
2177
- senderId: message.senderId,
2178
- senderName: message.senderName,
2179
- chatId: message.conversationId,
2180
- chatName: message.conversationId,
2181
- messageId: message.messageId,
2182
- text,
2183
- ...message.referencedText ? { referencedText: message.referencedText } : {},
2184
- isGroup,
2185
- isMentioned: source.kind === "at",
2186
- isReplyToBot: false,
2187
- metadata: [
2188
- `DWS event type: ${message.type}`,
2189
- `DingTalk conversation: ${message.conversationId}`,
2190
- `DWS event ID: ${message.eventId}`
2191
- ].join("\n")
2192
- };
2312
+ const envelope = this.createImEnvelope(source, message, text);
2193
2313
  this.rememberInboundReactionTarget(message.conversationId, message.messageId);
2194
2314
  try {
2195
2315
  await this.handleInbound(envelope);
2196
2316
  } catch (error) {
2197
- if (source.kind !== "at") {
2198
- await this.rememberFailedMessage(source, message);
2199
- }
2317
+ this.attemptedPendingMessages.add(key);
2200
2318
  if (this.recordInboundFailure(key, error, () => {
2201
2319
  this.markProcessedMessage(key);
2202
2320
  this.removePendingMessage(key);
@@ -2210,6 +2328,27 @@ ${truncateCodePoints(JSON.stringify(detail.data), MAX_TODO_CONTEXT_CHARS)}`
2210
2328
  this.markProcessedMessage(key);
2211
2329
  this.saveCursor();
2212
2330
  }
2331
+ createImEnvelope(source, message, text = message.content.trim()) {
2332
+ return {
2333
+ channelName: this.name,
2334
+ senderId: message.senderId,
2335
+ senderName: message.senderName,
2336
+ chatId: message.conversationId,
2337
+ chatName: message.conversationId,
2338
+ messageId: message.messageId,
2339
+ text,
2340
+ bypassMessagePrefix: true,
2341
+ ...message.referencedText ? { referencedText: message.referencedText } : {},
2342
+ isGroup: source.kind !== "direct",
2343
+ isMentioned: source.kind === "at",
2344
+ isReplyToBot: false,
2345
+ metadata: [
2346
+ `DWS event type: ${message.type}`,
2347
+ `DingTalk conversation: ${message.conversationId}`,
2348
+ `DWS event ID: ${message.eventId}`
2349
+ ].join("\n")
2350
+ };
2351
+ }
2213
2352
  /**
2214
2353
  * Account one failed inbound turn, and drop the message once its budget is
2215
2354
  * spent.
@@ -2268,21 +2407,34 @@ ${truncateCodePoints(JSON.stringify(detail.data), MAX_TODO_CONTEXT_CHARS)}`
2268
2407
  try {
2269
2408
  this.saveCursor();
2270
2409
  } catch (error) {
2410
+ if (source.kind === "group" || source.kind === "group-all") {
2411
+ return true;
2412
+ }
2271
2413
  this.removePendingMessage(key);
2272
2414
  throw error;
2273
2415
  }
2274
2416
  return true;
2275
2417
  }
2276
- async rememberFailedMessage(source, message) {
2418
+ async rememberPendingMessageWhenAvailable(source, message) {
2277
2419
  const key = messageKey(message);
2278
2420
  if (this.hasPendingMessage(key))
2279
- return;
2421
+ return true;
2280
2422
  const generation = this.lifecycleGeneration;
2281
2423
  while (this.connected && generation === this.lifecycleGeneration && (this.cursor.pendingMessages?.length ?? 0) >= MAX_PROCESSED_ITEMS) {
2282
2424
  await new Promise((resolve) => {
2283
2425
  this.pendingMessageCapacityWaiters.add(resolve);
2284
2426
  });
2285
2427
  }
2428
+ if (this.hasPendingMessage(key))
2429
+ return true;
2430
+ if (!this.connected || generation !== this.lifecycleGeneration) {
2431
+ this.rememberDrainingPendingMessage(source, message);
2432
+ return true;
2433
+ }
2434
+ return this.rememberPendingMessage(source, message);
2435
+ }
2436
+ rememberDrainingPendingMessage(source, message) {
2437
+ const key = messageKey(message);
2286
2438
  if (this.hasPendingMessage(key))
2287
2439
  return;
2288
2440
  const pending = this.cursor.pendingMessages ?? [];
@@ -2290,14 +2442,20 @@ ${truncateCodePoints(JSON.stringify(detail.data), MAX_TODO_CONTEXT_CHARS)}`
2290
2442
  this.cursor.pendingMessages = pending;
2291
2443
  try {
2292
2444
  this.saveCursor();
2293
- } catch {
2294
- return;
2445
+ } catch (error) {
2446
+ process2.stderr.write(`[Channel:${this.name}] could not persist a draining DWS message; keeping it in memory: ${sanitizeLogText(error instanceof Error ? error.message : String(error), 300)}
2447
+ `);
2295
2448
  }
2296
2449
  }
2297
2450
  removePersistedPendingMessage(key) {
2298
2451
  if (this.removePendingMessage(key))
2299
2452
  this.saveCursor();
2300
2453
  }
2454
+ removePersistedPendingMessageForSource(key, source) {
2455
+ const ownsPendingMessage = (this.cursor.pendingMessages ?? []).some((pending) => messageKey(pending.message) === key && sameImSource(pending.source, source));
2456
+ if (ownsPendingMessage)
2457
+ this.removePersistedPendingMessage(key);
2458
+ }
2301
2459
  removePendingMessage(key) {
2302
2460
  const pending = this.cursor.pendingMessages ?? [];
2303
2461
  const remaining = pending.filter((item) => messageKey(item.message) !== key);
@@ -2356,6 +2514,7 @@ ${truncateCodePoints(JSON.stringify(detail.data), MAX_TODO_CONTEXT_CHARS)}`
2356
2514
  threadId: notification.commentKey,
2357
2515
  messageId: message.messageId,
2358
2516
  text: truncateCodePoints(notification.request, MAX_COMMENT_CHARS),
2517
+ bypassMessagePrefix: true,
2359
2518
  isGroup: true,
2360
2519
  isMentioned: true,
2361
2520
  isReplyToBot: false,
@@ -2398,35 +2557,68 @@ ${context}` : "Document Markdown was unavailable; answer from the comment only."
2398
2557
  }
2399
2558
  }
2400
2559
  async replayPendingMessages(signal) {
2560
+ const activeBySource = /* @__PURE__ */ new Map();
2561
+ const activeConversations = /* @__PURE__ */ new Set();
2562
+ for (const { sourceKind, conversationId } of this.replayDispatches.values()) {
2563
+ if (!activeConversations.has(conversationId)) {
2564
+ activeBySource.set(sourceKind, (activeBySource.get(sourceKind) ?? 0) + 1);
2565
+ activeConversations.add(conversationId);
2566
+ }
2567
+ }
2568
+ const selectedConversations = /* @__PURE__ */ new Set();
2569
+ const blockedConversations = /* @__PURE__ */ new Set();
2401
2570
  for (const pending of [...this.cursor.pendingMessages ?? []]) {
2402
2571
  if (signal.aborted || !this.connected)
2403
2572
  return;
2404
2573
  const key = messageKey(pending.message);
2405
- if (pending.source.kind === "direct") {
2406
- if (this.queuedDirectMessages.has(key))
2407
- continue;
2408
- if (this.replayDirectDispatches.size >= MAX_DIRECT_REPLAY_DISPATCHES) {
2409
- continue;
2410
- }
2411
- const dispatched = this.scheduleDirectMessage(pending.source, pending.message, key, true);
2412
- this.replayDirectDispatches.set(key, dispatched);
2413
- void dispatched.finally(() => {
2414
- if (this.replayDirectDispatches.get(key) === dispatched) {
2415
- this.replayDirectDispatches.delete(key);
2574
+ if (this.queuedMessages.has(key))
2575
+ continue;
2576
+ if (this.markSelfMessageProcessed(pending.message))
2577
+ continue;
2578
+ if (this.shouldFilterImMessage(pending.source, pending.message)) {
2579
+ if (pending.source.kind === "group" || pending.source.kind === "group-all") {
2580
+ const text = stripMessagePrefix(pending.message.content.trim(), this.dwsMessagePrefix);
2581
+ if (!this.dwsMessagePrefix || text) {
2582
+ const envelope = this.createImEnvelope(pending.source, pending.message, text);
2583
+ if (this.groupGate.check(envelope, { createPairingRequest: false }).reason === "mention_required") {
2584
+ this.recordPendingGroupHistory(envelope);
2585
+ }
2416
2586
  }
2417
- }).catch(() => void 0);
2587
+ }
2588
+ this.removePersistedPendingMessageForSource(key, pending.source);
2418
2589
  continue;
2419
2590
  }
2420
- try {
2421
- await this.receiveImMessage(pending.source, pending.message, true);
2422
- this.removePendingMessage(key);
2423
- this.saveCursor();
2424
- } catch (error) {
2591
+ if (activeConversations.has(pending.message.conversationId))
2592
+ continue;
2593
+ if (blockedConversations.has(pending.message.conversationId))
2594
+ continue;
2595
+ if (!selectedConversations.has(pending.message.conversationId)) {
2596
+ const activeForSource = activeBySource.get(pending.source.kind) ?? 0;
2597
+ if (activeForSource >= MAX_REPLAY_CONVERSATIONS) {
2598
+ blockedConversations.add(pending.message.conversationId);
2599
+ continue;
2600
+ }
2601
+ activeBySource.set(pending.source.kind, activeForSource + 1);
2602
+ selectedConversations.add(pending.message.conversationId);
2603
+ }
2604
+ const dispatch = this.receiveImMessage(pending.source, pending.message, true, true);
2605
+ const completed = dispatch.completed;
2606
+ const replay = {
2607
+ sourceKind: pending.source.kind,
2608
+ conversationId: pending.message.conversationId
2609
+ };
2610
+ this.replayDispatches.set(key, replay);
2611
+ void dispatch.admitted.catch((error) => {
2425
2612
  if (signal.aborted || !this.connected)
2426
2613
  return;
2427
2614
  process2.stderr.write(`[Channel:${this.name}] pending DWS message remains degraded: ${sanitizeLogText(error instanceof Error ? error.message : String(error), 300)}
2428
2615
  `);
2429
- }
2616
+ });
2617
+ void completed.finally(() => {
2618
+ if (this.replayDispatches.get(key) === replay) {
2619
+ this.replayDispatches.delete(key);
2620
+ }
2621
+ }).catch(() => void 0);
2430
2622
  }
2431
2623
  }
2432
2624
  async replayPendingDocumentNotifications(signal) {
@@ -2510,13 +2702,16 @@ ${context}` : "Document Markdown was unavailable; answer from the comment only."
2510
2702
  reactionKey(conversationId, messageId) {
2511
2703
  return `${conversationId}\0${messageId}`;
2512
2704
  }
2513
- releaseDirectMessageStart(conversationId, messageId) {
2705
+ releaseMessageStart(conversationId, messageId, expected) {
2514
2706
  const key = `${conversationId}\0${messageId}`;
2515
- const resolve = this.directMessageStartResolvers.get(key);
2516
- if (!resolve)
2707
+ const resolver = this.messageStartResolvers.get(key);
2708
+ if (!resolver || expected && resolver !== expected)
2517
2709
  return;
2518
- this.directMessageStartResolvers.delete(key);
2519
- resolve();
2710
+ if (!expected && this.processingMessageGenerations.get(key) !== resolver.generation) {
2711
+ return;
2712
+ }
2713
+ this.messageStartResolvers.delete(key);
2714
+ resolver.resolve();
2520
2715
  }
2521
2716
  rememberInboundReactionTarget(chatId, messageId, conversationId = chatId) {
2522
2717
  const key = this.reactionKey(chatId, messageId);
@@ -2664,7 +2859,7 @@ ${context}` : "Document Markdown was unavailable; answer from the comment only."
2664
2859
  onTaskLifecycle(event) {
2665
2860
  if (event.type === "started") {
2666
2861
  if (event.messageId) {
2667
- this.releaseDirectMessageStart(event.chatId, event.messageId);
2862
+ this.releaseMessageStart(event.chatId, event.messageId);
2668
2863
  }
2669
2864
  this.startReaction(event.chatId, event.messageId, event.sessionId);
2670
2865
  return;