@qwen-code/qwen-code 0.19.4 → 0.19.5-nightly.20260703.b16baf1ff

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 (234) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +22 -6
  2. package/bundled/qc-helper/docs/features/commands.md +41 -34
  3. package/bundled/qc-helper/docs/features/headless.md +19 -18
  4. package/bundled/qc-helper/docs/qwen-serve.md +34 -0
  5. package/bundled/qc-helper/docs/support/troubleshooting.md +5 -0
  6. package/chunks/{MaxSizedBox-ERTNFI22.js → MaxSizedBox-42KZ5OFE.js} +12 -11
  7. package/chunks/{StandaloneSessionPicker-Y5NGRLRY.js → StandaloneSessionPicker-G4VTICMM.js} +23 -22
  8. package/chunks/{acpAgent-UMN6OYTR.js → acpAgent-6O25PA3M.js} +82 -78
  9. package/chunks/{agent-56DZU4ZU.js → agent-SNVTRNV7.js} +9 -8
  10. package/chunks/{agent-headless-SR7N2IJG.js → agent-headless-LNKVTSBX.js} +9 -8
  11. package/chunks/{anthropicContentGenerator-5OZFO6WQ.js → anthropicContentGenerator-WL3LJOUB.js} +99 -23
  12. package/chunks/{artifact-tool-JVZMHA4B.js → artifact-tool-W76WC2JX.js} +1 -1
  13. package/chunks/{askUserQuestion-CMJZ2F3D.js → askUserQuestion-J3P6TH3V.js} +1 -1
  14. package/chunks/{bridge-AUHNFOUS.js → bridge-AZZAYKI2.js} +15 -13
  15. package/chunks/{ca-RYOETBUW.js → ca-HCMB2I54.js} +1 -0
  16. package/chunks/channel-worker-supervisor-C2J3TIOV.js +665 -0
  17. package/chunks/{chunk-W2ZOAX7F.js → chunk-26UO4PLG.js} +3 -3
  18. package/chunks/chunk-2Z43HUXT.js +99 -0
  19. package/chunks/{chunk-VKGG724L.js → chunk-3GCPLNVF.js} +11 -10
  20. package/chunks/chunk-3RW4AZJV.js +5063 -0
  21. package/chunks/{chunk-6AQR7732.js → chunk-46IAL3RB.js} +1 -1
  22. package/chunks/{chunk-QAFQLTXG.js → chunk-4JWM2UGC.js} +1 -1
  23. package/chunks/{chunk-C2IHHGBZ.js → chunk-4PGQKUIV.js} +10 -10
  24. package/chunks/{chunk-PPFWEV7G.js → chunk-4RQIB5UZ.js} +62 -62
  25. package/chunks/{chunk-L7VH7HQA.js → chunk-4UEWG5AS.js} +29 -4
  26. package/chunks/{chunk-J3F7X3LW.js → chunk-5B2WNM6V.js} +1 -1
  27. package/chunks/{chunk-XCUFHOAD.js → chunk-6NHUWPNL.js} +1 -1
  28. package/chunks/{chunk-HI55Z6PR.js → chunk-7DMQRPC7.js} +401 -58
  29. package/chunks/{chunk-Q7VHIRDD.js → chunk-7K4G2H2H.js} +1 -1
  30. package/chunks/{chunk-W6X4FGWX.js → chunk-7XS7CMSU.js} +1 -1
  31. package/chunks/{chunk-SFN4TEHY.js → chunk-APTOAKV5.js} +4 -4
  32. package/chunks/{chunk-BNJLLAQ7.js → chunk-AYUVPH6L.js} +1 -1
  33. package/chunks/chunk-BPFJQGY7.js +193 -0
  34. package/chunks/{chunk-CUGEBAKG.js → chunk-C47IJLUT.js} +1 -1
  35. package/chunks/chunk-CXBG27SF.js +35 -0
  36. package/chunks/{chunk-UQFP2FEF.js → chunk-DG573EOO.js} +1 -1
  37. package/chunks/{chunk-ND25GXEU.js → chunk-DLJKEPXB.js} +14 -6
  38. package/chunks/{chunk-MNDTD5E5.js → chunk-DNJ2KHWN.js} +4 -4
  39. package/chunks/{chunk-KKQWC6WS.js → chunk-DNV4FSN5.js} +1 -1
  40. package/chunks/chunk-DOYHOG47.js +949 -0
  41. package/chunks/chunk-E2K45AJ7.js +5448 -0
  42. package/chunks/{chunk-75X2VLSH.js → chunk-F26BNXI2.js} +26 -5
  43. package/chunks/{chunk-6TLY5W3B.js → chunk-FB6LGUF4.js} +127 -23
  44. package/chunks/{chunk-UT5JU5DJ.js → chunk-FEPEMQR4.js} +42 -15
  45. package/chunks/{chunk-2X2JUE47.js → chunk-FKHE7ZNF.js} +2 -2
  46. package/chunks/{chunk-YBDZ63KI.js → chunk-FVRLDQ7T.js} +8 -4
  47. package/chunks/{chunk-DQ74W65K.js → chunk-HCLTQ3PV.js} +47 -20
  48. package/chunks/{chunk-BQNJBEUA.js → chunk-KFO6YNQT.js} +16 -2
  49. package/chunks/{chunk-UQYOMM6J.js → chunk-L4CYPEA7.js} +10 -10
  50. package/chunks/{chunk-MEQWZGK5.js → chunk-L7OJ3ZO3.js} +1 -1
  51. package/chunks/chunk-LOEYAC6N.js +86 -0
  52. package/chunks/{chunk-4VZH35PN.js → chunk-MTNTVOJR.js} +2 -0
  53. package/chunks/{chunk-6CIIP6OE.js → chunk-O2EZ4VRP.js} +3 -3
  54. package/chunks/{chunk-ZJP5T7IA.js → chunk-ODPWORQZ.js} +1 -1
  55. package/chunks/{chunk-TTFNVEO5.js → chunk-P5GH4DTN.js} +3 -3
  56. package/chunks/{chunk-7KPI4LAI.js → chunk-QURP4S5U.js} +3 -3
  57. package/chunks/{chunk-UANCYOOQ.js → chunk-R6RI2HIC.js} +1 -1
  58. package/chunks/{chunk-FYKX6XOT.js → chunk-RBLDOR7U.js} +1 -1
  59. package/chunks/{chunk-EDAGQADF.js → chunk-S6RLAIUR.js} +2 -0
  60. package/chunks/chunk-SIUQ3YYX.js +78 -0
  61. package/chunks/{chunk-GICCHL2Q.js → chunk-STP6AYKH.js} +1 -1
  62. package/chunks/{chunk-HJDF3ZVU.js → chunk-UEGNXWAX.js} +6 -6
  63. package/chunks/{chunk-PIYV6COW.js → chunk-UTWYG2WA.js} +1 -1
  64. package/chunks/{chunk-QMIND2AS.js → chunk-UY2TCIZS.js} +15 -1
  65. package/chunks/{chunk-CG7SVARK.js → chunk-VDIZBM46.js} +2 -2
  66. package/chunks/{chunk-73H73ASU.js → chunk-VJSWLYUL.js} +1 -1
  67. package/chunks/{chunk-FNLXLI4I.js → chunk-WMLQKZ64.js} +2 -2
  68. package/chunks/{chunk-KVPFPC4J.js → chunk-WSAAEPPQ.js} +14 -14
  69. package/chunks/{chunk-BFG6OZN7.js → chunk-WWOVV2PW.js} +3742 -2737
  70. package/chunks/{chunk-MKHC4BYZ.js → chunk-XAVV2JAM.js} +21 -5
  71. package/chunks/{chunk-ZXCVPMIK.js → chunk-XR7W5VRL.js} +167 -54
  72. package/chunks/{chunk-CS5XYDBO.js → chunk-XS7IHJ63.js} +5 -5
  73. package/chunks/{chunk-B7KGXIPZ.js → chunk-YCU7QV7Q.js} +11 -4
  74. package/chunks/{chunk-OJCECIJA.js → chunk-YHTNWGRR.js} +5 -4
  75. package/chunks/{chunk-7VPC7D7O.js → chunk-YLQSGKAN.js} +2 -2
  76. package/chunks/{chunk-OAFUMTWW.js → chunk-Z75MFQFL.js} +2 -2
  77. package/chunks/{chunk-HRZB5CSC.js → chunk-ZRHHQFV4.js} +1 -1
  78. package/chunks/{computer-use-VWN5HH6A.js → computer-use-UHZAYYGO.js} +9 -8
  79. package/chunks/{contextCommand-DFFG5KDJ.js → contextCommand-X4WOJ2L4.js} +11 -10
  80. package/chunks/{cron-create-CSSWJ67I.js → cron-create-6YTCOX6P.js} +1 -1
  81. package/chunks/{cron-delete-E56CFQ7A.js → cron-delete-E3NIFSUK.js} +1 -1
  82. package/chunks/{cron-list-BKSINY6Y.js → cron-list-Q64MNQNE.js} +1 -1
  83. package/chunks/{daemon-5T6IHWJV.js → daemon-EEB2RYOL.js} +23 -0
  84. package/chunks/{daemon-status-provider-V5UY7O7J.js → daemon-status-provider-YXWNGOAF.js} +18 -16
  85. package/chunks/{de-HB5NJXGB.js → de-PLLFDERI.js} +1 -0
  86. package/chunks/{dist-TAVAGZU6.js → dist-AP5V4WYU.js} +54 -14
  87. package/chunks/{dist-XBOVZ3R5.js → dist-IZP2VV4C.js} +156 -57
  88. package/chunks/{dist-B7SSDVWT.js → dist-SNXOUPYS.js} +201 -7
  89. package/chunks/{dist-2HDL5SHQ.js → dist-X4ZDE726.js} +43 -8
  90. package/chunks/{dist-BL3SL665.js → dist-Z57Q4YF5.js} +1 -1
  91. package/chunks/{earlyInputCapture-VVYU4FDO.js → earlyInputCapture-3HUGMAFL.js} +9 -8
  92. package/chunks/{edit-F35PTMBA.js → edit-QDKRNFZK.js} +14 -17
  93. package/chunks/{en-FZREZFPO.js → en-M4EBUBNU.js} +2 -0
  94. package/chunks/{enter-worktree-3DIW7EGJ.js → enter-worktree-ODWIPMOP.js} +9 -8
  95. package/chunks/{enterPlanMode-QNXT77KP.js → enterPlanMode-XROL6G5C.js} +11 -10
  96. package/chunks/{errors-M53YG76R.js → errors-RCPBWFTG.js} +11 -10
  97. package/chunks/{exit-worktree-BSDWNWHZ.js → exit-worktree-BIU7P4TR.js} +9 -8
  98. package/chunks/{exitPlanMode-EL7AY327.js → exitPlanMode-LWZHZ7CF.js} +107 -12
  99. package/chunks/{fast-path-DUCSMUFW.js → fast-path-7S4NR2WI.js} +6 -4
  100. package/chunks/{fast-path-settings-UQLRFDQP.js → fast-path-settings-RCRXH2JG.js} +2 -2
  101. package/chunks/{fr-XY3NQFCM.js → fr-MBMNQSQ6.js} +1 -0
  102. package/chunks/{gemini-F3IERB37.js → gemini-W7CZCFFV.js} +75 -67
  103. package/chunks/{geminiContentGenerator-6OULAKFQ.js → geminiContentGenerator-MWZWJAWR.js} +39 -3
  104. package/chunks/{glob-ZMLFTD4T.js → glob-GZ4LUOQT.js} +9 -8
  105. package/chunks/{grep-H5X66EI7.js → grep-BZ34WAQJ.js} +9 -8
  106. package/chunks/{initializer-LEOT2OLH.js → initializer-W4EUD3H7.js} +14 -13
  107. package/chunks/{ja-J7YAG7SA.js → ja-HFV5QCHR.js} +1 -0
  108. package/chunks/{list-M3DKXML6.js → list-S325XJ2Y.js} +16 -15
  109. package/chunks/{loadedSettingsAdapter-OKMQFGGG.js → loadedSettingsAdapter-QP3XBMQI.js} +14 -13
  110. package/chunks/{loop-wakeup-FPBAVVPR.js → loop-wakeup-G2EHBRGR.js} +2 -2
  111. package/chunks/{ls-UGWQXPTY.js → ls-IDHUVSAG.js} +1 -1
  112. package/chunks/{lsp-24WV7NXB.js → lsp-FSRYXGFT.js} +1 -1
  113. package/chunks/mcp-LRKXM6OS.js +66 -0
  114. package/chunks/{monitor-ARL5P45R.js → monitor-7C33CWA5.js} +11 -10
  115. package/chunks/{nonInteractiveCli-NUVLF3YR.js → nonInteractiveCli-FPZS7ROR.js} +46 -43
  116. package/chunks/{notebook-edit-ANTZ2DDY.js → notebook-edit-ZXQ25NWU.js} +14 -16
  117. package/chunks/{openaiContentGenerator-TFGMKGHN.js → openaiContentGenerator-FUQ7GNK6.js} +4 -4
  118. package/chunks/{pidfile-AWTL4C63.js → pidfile-NPZV5ZIA.js} +10 -9
  119. package/chunks/{pt-6RTAA6SS.js → pt-2THT3YHA.js} +1 -0
  120. package/chunks/{qwenContentGenerator-6QWAYTWS.js → qwenContentGenerator-LNEWYA52.js} +10 -9
  121. package/chunks/{read-file-EJY73XQ3.js → read-file-G6GBNSM3.js} +3 -3
  122. package/chunks/{read-mcp-resource-NCBTPP7X.js → read-mcp-resource-PIJF24RO.js} +1 -1
  123. package/chunks/{ripGrep-HC4SA6CQ.js → ripGrep-IGOC7PVL.js} +9 -8
  124. package/chunks/{ru-AUBGJ2C4.js → ru-Z67YJHBG.js} +1 -0
  125. package/chunks/{run-qwen-serve-AGLZ642J.js → run-qwen-serve-AAA53KS4.js} +131 -38
  126. package/chunks/{scheduler-TURO7NGY.js → scheduler-SPGJ7ILO.js} +9 -8
  127. package/chunks/{send-message-3S2NYS3O.js → send-message-33PYFMCT.js} +15 -1
  128. package/chunks/{serve-5DAMOIDW.js → serve-37UIHUYP.js} +15 -14
  129. package/chunks/{server-4AGEK2HC.js → server-MFMOYMEB.js} +187 -173
  130. package/chunks/{session-7ZOQUC4Y.js → session-XRY2CG4Z.js} +47 -44
  131. package/chunks/{settings-DR4V6L5Y.js → settings-X5GXXGKH.js} +13 -12
  132. package/chunks/{shell-H5WFKUXH.js → shell-E5HOWJMT.js} +9 -8
  133. package/chunks/{skill-ANHU5ZCR.js → skill-FELDZMWO.js} +3 -3
  134. package/chunks/{spawnChannel-VN5LJV7Z.js → spawnChannel-XLTVHAT6.js} +12 -10
  135. package/chunks/{src-OVZLTVVM.js → src-ZWPLTWTV.js} +21 -10
  136. package/chunks/{startInteractiveUI-OA22V32P.js → startInteractiveUI-GO6J3SJ7.js} +2609 -2458
  137. package/chunks/{syntheticOutput-SV7GBHZ5.js → syntheticOutput-YOSWIHDJ.js} +2 -2
  138. package/chunks/{task-create-W2H2UJCH.js → task-create-NHS2NGB3.js} +3 -2
  139. package/chunks/{task-list-THBOPV4G.js → task-list-5UIB564R.js} +1 -1
  140. package/chunks/{task-stop-33FVCNCJ.js → task-stop-HGXZ2VZ3.js} +1 -1
  141. package/chunks/{task-update-LVFQLXEI.js → task-update-IYYWUILG.js} +34 -2
  142. package/chunks/{team-create-OYL5CAQO.js → team-create-WWMKZ3UO.js} +9 -8
  143. package/chunks/{team-delete-NTUQ25UY.js → team-delete-FEKJCU4P.js} +1 -1
  144. package/chunks/team-plan-approval-CUNEZJOV.js +202 -0
  145. package/chunks/{theme-manager-XCMPF2SI.js → theme-manager-LRBEA5ID.js} +9 -8
  146. package/chunks/{todoWrite-SEPO2RI3.js → todoWrite-TKMVZ2HT.js} +1 -1
  147. package/chunks/{tool-search-YXW55X6Z.js → tool-search-L57ZRBJF.js} +8 -6
  148. package/chunks/{trustedFolders-TEPGM5YL.js → trustedFolders-DYAOFXN2.js} +10 -9
  149. package/chunks/{validateNonInterActiveAuth-OQIS7WUE.js → validateNonInterActiveAuth-AB4C2FLG.js} +43 -40
  150. package/chunks/version-2A66AIB2.js +10 -0
  151. package/chunks/{web-fetch-OE7LHURA.js → web-fetch-J4PIW36Q.js} +2 -2
  152. package/chunks/{workflow-RTUWORAP.js → workflow-H7YLGTBI.js} +12 -11
  153. package/chunks/{workspace-providers-status-DM2XANVB.js → workspace-providers-status-UUIBOTKI.js} +16 -15
  154. package/chunks/{workspace-service-VKBI2KZD.js → workspace-service-FATHYK5C.js} +21 -20
  155. package/chunks/workspace-skills-status-KIC3KYPR.js +62 -0
  156. package/chunks/{write-file-WGALQ53L.js → write-file-ETGUMYAK.js} +14 -18
  157. package/chunks/yargs-B64EYTCF.js +10 -0
  158. package/chunks/{zh-V3B4TFWL.js → zh-SLZNSSZB.js} +2 -0
  159. package/chunks/{zh-TW-6GIKXEAN.js → zh-TW-P53C2SL5.js} +2 -0
  160. package/cli-entry.js +81 -8
  161. package/cli.js +348 -55
  162. package/locales/ca.js +2 -0
  163. package/locales/de.js +2 -0
  164. package/locales/en.js +3 -0
  165. package/locales/fr.js +2 -0
  166. package/locales/ja.js +2 -0
  167. package/locales/pt.js +2 -0
  168. package/locales/ru.js +2 -0
  169. package/locales/zh-TW.js +3 -0
  170. package/locales/zh.js +3 -0
  171. package/node_modules/@qwen-code/audio-capture/package.json +1 -1
  172. package/node_modules/@qwen-code/audio-capture/prebuilds/darwin-arm64/@qwen-code+audio-capture.node +0 -0
  173. package/node_modules/@qwen-code/audio-capture/prebuilds/darwin-x64/@qwen-code+audio-capture.node +0 -0
  174. package/node_modules/@qwen-code/audio-capture/prebuilds/win32-x64/@qwen-code+audio-capture.node +0 -0
  175. package/package.json +6 -15
  176. package/web-shell/assets/{arc-Det5Ccum.js → arc-QjIJgYzv.js} +1 -1
  177. package/web-shell/assets/{architectureDiagram-3BPJPVTR-DqNWVFpl.js → architectureDiagram-3BPJPVTR-DJkZ9KoB.js} +1 -1
  178. package/web-shell/assets/{blockDiagram-GPEHLZMM-CYl7tYBi.js → blockDiagram-GPEHLZMM-BlNeekUB.js} +1 -1
  179. package/web-shell/assets/{c4Diagram-AAUBKEIU-DaAEi0NQ.js → c4Diagram-AAUBKEIU-B6FDrE3D.js} +1 -1
  180. package/web-shell/assets/channel-M6R-XOoS.js +1 -0
  181. package/web-shell/assets/{chunk-2J33WTMH-Df2CDEE2.js → chunk-2J33WTMH-CZO5-3og.js} +1 -1
  182. package/web-shell/assets/{chunk-4BX2VUAB-DNBFcyL2.js → chunk-4BX2VUAB-CZ2VJPFe.js} +1 -1
  183. package/web-shell/assets/{chunk-55IACEB6-BKjF-0HI.js → chunk-55IACEB6-3zVP6pGF.js} +1 -1
  184. package/web-shell/assets/{chunk-727SXJPM-DYwAwfIM.js → chunk-727SXJPM-omuP8Zhh.js} +1 -1
  185. package/web-shell/assets/{chunk-AQP2D5EJ-C6FswLqy.js → chunk-AQP2D5EJ-BK6Ivmyv.js} +1 -1
  186. package/web-shell/assets/{chunk-FMBD7UC4-DRWAcZSY.js → chunk-FMBD7UC4-NLjjxV0s.js} +1 -1
  187. package/web-shell/assets/{chunk-ND2GUHAM-AoL16mNR.js → chunk-ND2GUHAM-Dc0JTV8t.js} +1 -1
  188. package/web-shell/assets/{chunk-QZHKN3VN-a8PtLMck.js → chunk-QZHKN3VN-ZYp-8jN-.js} +1 -1
  189. package/web-shell/assets/classDiagram-4FO5ZUOK-B7rcL2Jc.js +1 -0
  190. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-B7rcL2Jc.js +1 -0
  191. package/web-shell/assets/{cose-bilkent-S5V4N54A-C4Aeu5qf.js → cose-bilkent-S5V4N54A-BNu1jqy7.js} +1 -1
  192. package/web-shell/assets/{dagre-BM42HDAG-BOulamjo.js → dagre-BM42HDAG-0AHvPm2v.js} +1 -1
  193. package/web-shell/assets/{diagram-2AECGRRQ-D1wt2ykO.js → diagram-2AECGRRQ-BJsDQdp0.js} +1 -1
  194. package/web-shell/assets/{diagram-5GNKFQAL-BRseus-O.js → diagram-5GNKFQAL-C1gNnoxj.js} +1 -1
  195. package/web-shell/assets/{diagram-KO2AKTUF-XSMkNzpZ.js → diagram-KO2AKTUF-FmgehSoq.js} +1 -1
  196. package/web-shell/assets/{diagram-LMA3HP47-21KNLqoi.js → diagram-LMA3HP47-i7_13R2F.js} +1 -1
  197. package/web-shell/assets/{diagram-OG6HWLK6-DnUI8F5G.js → diagram-OG6HWLK6-DkUUR1x-.js} +1 -1
  198. package/web-shell/assets/{erDiagram-TEJ5UH35-BVSOMuM2.js → erDiagram-TEJ5UH35-BcwJzw0n.js} +1 -1
  199. package/web-shell/assets/{flowDiagram-I6XJVG4X-fYtDPJsW.js → flowDiagram-I6XJVG4X-CCPgwkQS.js} +1 -1
  200. package/web-shell/assets/{ganttDiagram-6RSMTGT7-CmRXosW_.js → ganttDiagram-6RSMTGT7-C3g0sliF.js} +1 -1
  201. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-DPrmySxO.js → gitGraphDiagram-PVQCEYII-DLt4J_oG.js} +1 -1
  202. package/web-shell/assets/index-9qfvU0_r.css +5 -0
  203. package/web-shell/assets/index-DasTT8n6.js +717 -0
  204. package/web-shell/assets/{infoDiagram-5YYISTIA-x3VbEuCV.js → infoDiagram-5YYISTIA-DMO0nW8F.js} +1 -1
  205. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-SmitHRMC.js → ishikawaDiagram-YF4QCWOH-qSN9LjC5.js} +1 -1
  206. package/web-shell/assets/{journeyDiagram-JHISSGLW-BxvA551S.js → journeyDiagram-JHISSGLW-CQZH-jC2.js} +1 -1
  207. package/web-shell/assets/{kanban-definition-UN3LZRKU-DNHC16jY.js → kanban-definition-UN3LZRKU-Cu6qk5En.js} +1 -1
  208. package/web-shell/assets/{linear-CQ6irBL9.js → linear-Dpp4BWJF.js} +1 -1
  209. package/web-shell/assets/{mermaid.core-DtB6NO1e.js → mermaid.core-DDAcmZsz.js} +5 -5
  210. package/web-shell/assets/{mindmap-definition-RKZ34NQL-QKMAgV2v.js → mindmap-definition-RKZ34NQL-G3JXxnUU.js} +1 -1
  211. package/web-shell/assets/{pieDiagram-4H26LBE5-bvb6dGn6.js → pieDiagram-4H26LBE5-ABQwHraX.js} +1 -1
  212. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-DLgdlG4D.js → quadrantDiagram-W4KKPZXB-BUWZV-ho.js} +1 -1
  213. package/web-shell/assets/{requirementDiagram-4Y6WPE33-2M9YH4GF.js → requirementDiagram-4Y6WPE33-XHg5n00A.js} +1 -1
  214. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-DzwfclTH.js → sankeyDiagram-5OEKKPKP-Bwzw0RtM.js} +1 -1
  215. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-BvPmTuy2.js → sequenceDiagram-3UESZ5HK-CGYLtnFV.js} +1 -1
  216. package/web-shell/assets/{stateDiagram-AJRCARHV-BjwUmrJF.js → stateDiagram-AJRCARHV-BG1UhKch.js} +1 -1
  217. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-CSG8MpoN.js +1 -0
  218. package/web-shell/assets/{timeline-definition-PNZ67QCA-CXzS6qqz.js → timeline-definition-PNZ67QCA-B_tY-Dyz.js} +1 -1
  219. package/web-shell/assets/{vennDiagram-CIIHVFJN-yRSolF5B.js → vennDiagram-CIIHVFJN-Crp_Rw_L.js} +1 -1
  220. package/web-shell/assets/{wardley-L42UT6IY-ClLJjHPG.js → wardley-L42UT6IY-DR27pFXX.js} +1 -1
  221. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-VIa6t2p2.js → wardleyDiagram-YWT4CUSO-BM_CRFgm.js} +1 -1
  222. package/web-shell/assets/{xychartDiagram-2RQKCTM6-CtmrkezW.js → xychartDiagram-2RQKCTM6-DO2Z2lWl.js} +1 -1
  223. package/web-shell/index.html +28 -3
  224. package/chunks/channel-worker-supervisor-A74FV522.js +0 -308
  225. package/chunks/chunk-MVZXZWGT.js +0 -11323
  226. package/chunks/chunk-S5EQPDTM.js +0 -91
  227. package/patches/chrome-devtools-mcp+1.4.0.patch +0 -31
  228. package/postinstall.js +0 -50
  229. package/web-shell/assets/channel-Bm0bFauD.js +0 -1
  230. package/web-shell/assets/classDiagram-4FO5ZUOK--NgUfb55.js +0 -1
  231. package/web-shell/assets/classDiagram-v2-Q7XG4LA2--NgUfb55.js +0 -1
  232. package/web-shell/assets/index-BpKnmyFV.js +0 -717
  233. package/web-shell/assets/index-fLrtxpOG.css +0 -5
  234. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-C4L8zXeL.js +0 -1
@@ -14,7 +14,7 @@ import {
14
14
 
15
15
  // packages/channels/base/dist/sanitize.js
16
16
  init_esbuild_shims();
17
- var PROMPT_UNSAFE_INVISIBLES = /[\u0080-\u009f\u200b-\u200d\u2028\u2029\u202a-\u202e\u2060\u2066-\u2069\ufeff]/g;
17
+ var PROMPT_UNSAFE_INVISIBLES = new RegExp("[\\u0080-\\u009f\\p{Cf}\\u2028\\u2029]|\\p{Variation_Selector}", "gu");
18
18
  function truncateCodePoints(str, max) {
19
19
  const cp = Array.from(str);
20
20
  return cp.length > max ? cp.slice(0, max).join("") : str;
@@ -340,10 +340,6 @@ function summarizeProtocolDetails(details) {
340
340
  return summary;
341
341
  }
342
342
  __name(summarizeProtocolDetails, "summarizeProtocolDetails");
343
- async function drainDaemonEventLoop() {
344
- await new Promise((resolve2) => setTimeout(resolve2, 0));
345
- }
346
- __name(drainDaemonEventLoop, "drainDaemonEventLoop");
347
343
  var DaemonChannelBridge = class extends EventEmitter2 {
348
344
  static {
349
345
  __name(this, "DaemonChannelBridge");
@@ -356,6 +352,7 @@ var DaemonChannelBridge = class extends EventEmitter2 {
356
352
  activePrompts = /* @__PURE__ */ new Set();
357
353
  activePromptControllers = /* @__PURE__ */ new Map();
358
354
  availableCommandsBySession = /* @__PURE__ */ new Map();
355
+ turnBarriers = /* @__PURE__ */ new Map();
359
356
  connected = false;
360
357
  latestAvailableCommandsSessionId;
361
358
  lastError;
@@ -378,6 +375,17 @@ var DaemonChannelBridge = class extends EventEmitter2 {
378
375
  getAvailableCommands(sessionId) {
379
376
  return this.availableCommandsBySession.get(sessionId) ?? [];
380
377
  }
378
+ listSessions() {
379
+ const result = [];
380
+ for (const session of this.sessions.values()) {
381
+ result.push({
382
+ sessionId: session.sessionId,
383
+ workspaceCwd: session.workspaceCwd,
384
+ hasActivePrompt: this.activePrompts.has(session.sessionId)
385
+ });
386
+ }
387
+ return result;
388
+ }
381
389
  async start() {
382
390
  this.connected = true;
383
391
  }
@@ -429,6 +437,7 @@ var DaemonChannelBridge = class extends EventEmitter2 {
429
437
  }, "onSessionDied");
430
438
  this.on("textChunk", onChunk);
431
439
  this.on("sessionDied", onSessionDied);
440
+ const turnBarrier = this.createTurnBarrier(sessionId);
432
441
  const prompt = [];
433
442
  if (options?.imageBase64 && options.imageMimeType) {
434
443
  prompt.push({
@@ -440,7 +449,10 @@ var DaemonChannelBridge = class extends EventEmitter2 {
440
449
  prompt.push({ type: "text", text });
441
450
  try {
442
451
  const result = await session.prompt({ prompt }, controller.signal);
443
- await drainDaemonEventLoop();
452
+ await Promise.race([
453
+ turnBarrier,
454
+ new Promise((resolve2) => setTimeout(resolve2, 0))
455
+ ]);
444
456
  const textResult = chunks.join("");
445
457
  this.emit("promptComplete", {
446
458
  sessionId,
@@ -449,6 +461,7 @@ var DaemonChannelBridge = class extends EventEmitter2 {
449
461
  });
450
462
  return textResult;
451
463
  } finally {
464
+ this.clearTurnBarrier(sessionId);
452
465
  this.off("textChunk", onChunk);
453
466
  this.off("sessionDied", onSessionDied);
454
467
  this.activePrompts.delete(sessionId);
@@ -467,9 +480,10 @@ var DaemonChannelBridge = class extends EventEmitter2 {
467
480
  }
468
481
  async cancelSession(sessionId) {
469
482
  const session = this.ensureSession(sessionId);
470
- await session.cancel();
483
+ this.resolveTurnBarrier(sessionId);
471
484
  this.abortActivePrompts(sessionId);
472
485
  this.activePrompts.delete(sessionId);
486
+ await session.cancel();
473
487
  }
474
488
  async setSessionModel(sessionId, modelId) {
475
489
  return await this.ensureSession(sessionId).setModel(modelId);
@@ -583,6 +597,13 @@ var DaemonChannelBridge = class extends EventEmitter2 {
583
597
  case "stream_error":
584
598
  this.dropSession(session.sessionId, this.getStringField(event.data, "error", "stream_error"));
585
599
  break;
600
+ case "turn_complete":
601
+ this.resolveTurnBarrier(session.sessionId);
602
+ break;
603
+ case "turn_error":
604
+ this.emitProtocolError(`Daemon turn error for session ${session.sessionId}`, event.data);
605
+ this.resolveTurnBarrier(session.sessionId);
606
+ break;
586
607
  default:
587
608
  break;
588
609
  }
@@ -728,6 +749,7 @@ var DaemonChannelBridge = class extends EventEmitter2 {
728
749
  if (!this.sessions.has(sessionId)) {
729
750
  return;
730
751
  }
752
+ this.resolveTurnBarrier(sessionId);
731
753
  this.eventControllers.get(sessionId)?.abort();
732
754
  this.eventControllers.delete(sessionId);
733
755
  this.sessions.delete(sessionId);
@@ -762,6 +784,21 @@ var DaemonChannelBridge = class extends EventEmitter2 {
762
784
  }
763
785
  this.activePromptControllers.delete(sessionId);
764
786
  }
787
+ createTurnBarrier(sessionId) {
788
+ return new Promise((resolve2) => {
789
+ this.turnBarriers.set(sessionId, resolve2);
790
+ });
791
+ }
792
+ resolveTurnBarrier(sessionId) {
793
+ const resolve2 = this.turnBarriers.get(sessionId);
794
+ if (resolve2) {
795
+ this.turnBarriers.delete(sessionId);
796
+ resolve2();
797
+ }
798
+ }
799
+ clearTurnBarrier(sessionId) {
800
+ this.turnBarriers.delete(sessionId);
801
+ }
765
802
  emitProtocolError(message, details) {
766
803
  const error = new Error(message);
767
804
  error.details = summarizeProtocolDetails(details);
@@ -1664,6 +1701,11 @@ var ChannelLoopSkippedError = class extends Error {
1664
1701
  static {
1665
1702
  __name(this, "ChannelLoopSkippedError");
1666
1703
  }
1704
+ reason;
1705
+ constructor(message, reason = "dropped") {
1706
+ super(message);
1707
+ this.reason = reason;
1708
+ }
1667
1709
  };
1668
1710
  var ChannelLoopScheduler = class {
1669
1711
  static {
@@ -1941,6 +1983,7 @@ var CURRENT_MESSAGE_MARKER = "[Current message - respond to this]";
1941
1983
  var GROUP_HISTORY_ENTRY_TEXT_LIMIT = 1e3;
1942
1984
  var GROUP_HISTORY_ENTRY_METADATA_LIMIT = 256;
1943
1985
  var LOOP_CANCEL_GRACE_MS = 5e3;
1986
+ var LOOP_TIMED_OUT_MESSAGE = "loop timed out";
1944
1987
  var COMMAND_TOKEN_CHARS = "a-zA-Z0-9_:-";
1945
1988
  var PARSE_COMMAND_RE = new RegExp(`^\\/([${COMMAND_TOKEN_CHARS}]+)(?:@\\S+)?\\s*(.*)`, "s");
1946
1989
  var COMMAND_TOKEN_RE = new RegExp(`^[${COMMAND_TOKEN_CHARS}]+(?:@\\S+)?$`);
@@ -1966,6 +2009,9 @@ var ChannelBase = class {
1966
2009
  gate;
1967
2010
  router;
1968
2011
  name;
2012
+ /** Resolved (defaulted + frozen) identity/scope — adapters should read these, not raw config. */
2013
+ identity;
2014
+ memoryScope;
1969
2015
  /** Resolved proxy URL, available to subclasses for adapter-specific clients. */
1970
2016
  proxy;
1971
2017
  channelMemory;
@@ -1987,19 +2033,41 @@ var ChannelBase = class {
1987
2033
  /** Per-session message buffer for collect mode. */
1988
2034
  collectBuffers = /* @__PURE__ */ new Map();
1989
2035
  bridgeToolCallListener = /* @__PURE__ */ __name((event) => {
1990
- const target = this.router.getTarget(event.sessionId);
1991
- if (target) {
1992
- this.onToolCall(target.chatId, event);
1993
- }
2036
+ this.dispatchToolCall(event);
1994
2037
  }, "bridgeToolCallListener");
1995
2038
  bridgeSessionDiedListener = /* @__PURE__ */ __name((event) => {
1996
2039
  this.onSessionDied(event.sessionId);
1997
2040
  }, "bridgeSessionDiedListener");
2041
+ dispatchToolCall(event) {
2042
+ const target = this.router.getTarget(event.sessionId);
2043
+ const active = this.activePrompts.get(event.sessionId);
2044
+ const chatId = active?.chatId ?? target?.chatId;
2045
+ if (!chatId) {
2046
+ return;
2047
+ }
2048
+ if (active && !active.cancelled && !active.cancelPending) {
2049
+ const safeToolCall = {
2050
+ sessionId: event.sessionId,
2051
+ toolCallId: event.toolCallId,
2052
+ kind: sanitizeLogText(event.kind ?? "", 20),
2053
+ title: sanitizeLogText(event.title ?? "", 80),
2054
+ status: sanitizeLogText(event.status ?? "", 20)
2055
+ };
2056
+ this.emitTaskLifecycle({
2057
+ ...this.lifecycleBase(chatId, event.sessionId, active.messageId),
2058
+ type: "tool_call",
2059
+ toolCall: safeToolCall
2060
+ });
2061
+ }
2062
+ this.onToolCall(chatId, event);
2063
+ }
1998
2064
  constructor(name, config, bridge, options) {
1999
2065
  this.name = name;
2000
2066
  this.config = config;
2001
2067
  this.bridge = bridge;
2002
2068
  this.proxy = options?.proxy;
2069
+ this.identity = Object.freeze(this.resolveIdentity(name, config));
2070
+ this.memoryScope = Object.freeze(this.resolveMemoryScope(name, config));
2003
2071
  this.channelMemory = options?.channelMemory;
2004
2072
  this.groupHistory = new GroupHistoryStore(options?.groupHistoryPath ?? join4(getGlobalQwenDir(), "channels", `${encodeURIComponent(name)}-group-history.jsonl`));
2005
2073
  this.loopController = options?.loopController;
@@ -2013,6 +2081,96 @@ var ChannelBase = class {
2013
2081
  this.attachBridgeEvents(bridge);
2014
2082
  }
2015
2083
  }
2084
+ /**
2085
+ * Adapter hook for task lifecycle events — the canonical way to track task
2086
+ * state (onPromptStart/onPromptEnd are retained for back-compat). The prompt
2087
+ * flow never awaits this hook; an async override's rejection is caught and
2088
+ * logged, nothing more.
2089
+ */
2090
+ onTaskLifecycle(_event) {
2091
+ }
2092
+ emitTaskLifecycle(event) {
2093
+ try {
2094
+ const result = this.onTaskLifecycle(event);
2095
+ if (result && typeof result.catch === "function") {
2096
+ result.catch((err) => {
2097
+ this.logTaskLifecycleError(event, err);
2098
+ });
2099
+ }
2100
+ } catch (err) {
2101
+ this.logTaskLifecycleError(event, err);
2102
+ }
2103
+ }
2104
+ logTaskLifecycleError(event, err) {
2105
+ const channel = sanitizeLogText(this.name, 64);
2106
+ const sessionId = sanitizeLogText(event.sessionId, 64);
2107
+ const stack = err instanceof Error && err.stack ? ` | ${sanitizeLogText(err.stack, 500)}` : "";
2108
+ process.stderr.write(`[${channel}] onTaskLifecycle threw for ${event.type} session ${sessionId}: ${this.lifecycleError(err)}${stack}
2109
+ `);
2110
+ }
2111
+ lifecycleError(err) {
2112
+ return sanitizeLogText(err instanceof Error ? err.message : String(err), 200);
2113
+ }
2114
+ emitTaskCancellation(active, sessionId, reason) {
2115
+ if (active.cancellationEmitted) {
2116
+ return;
2117
+ }
2118
+ active.cancellationEmitted = true;
2119
+ this.emitTaskLifecycle({
2120
+ ...this.lifecycleBase(active.chatId, sessionId, active.messageId),
2121
+ type: "cancelled",
2122
+ reason
2123
+ });
2124
+ }
2125
+ resolveIdentity(name, config) {
2126
+ return {
2127
+ id: config.identity?.id || `channel:${name}`,
2128
+ displayName: config.identity?.displayName || name,
2129
+ ...config.identity?.description ? { description: config.identity.description } : {}
2130
+ };
2131
+ }
2132
+ resolveMemoryScope(name, config) {
2133
+ return {
2134
+ namespace: config.memoryScope?.namespace || `channel:${name}`,
2135
+ mode: config.memoryScope?.mode ?? "metadata-only"
2136
+ };
2137
+ }
2138
+ /** Built once — identity/memoryScope are frozen at construction. */
2139
+ boundaryPrompt;
2140
+ channelBoundaryPrompt() {
2141
+ if (this.boundaryPrompt !== void 0) {
2142
+ return this.boundaryPrompt;
2143
+ }
2144
+ const identityLines = [
2145
+ "Channel identity:",
2146
+ `- id: ${sanitizeQuotedText(this.identity.id, 128)}`,
2147
+ `- display name: ${sanitizeQuotedText(this.identity.displayName, 128)}`,
2148
+ ...this.identity.description ? [
2149
+ `- description: ${sanitizeQuotedText(this.identity.description, 256)}`
2150
+ ] : []
2151
+ ];
2152
+ const memoryLines = [
2153
+ "Memory scope:",
2154
+ `- namespace: ${sanitizeQuotedText(this.memoryScope.namespace, 128)}`,
2155
+ `- mode: ${this.memoryScope.mode}`,
2156
+ "- data from other channels must not be shared."
2157
+ ];
2158
+ this.boundaryPrompt = [...identityLines, "", ...memoryLines].join("\n");
2159
+ return this.boundaryPrompt;
2160
+ }
2161
+ shouldPrependChannelBoundaryPrompt() {
2162
+ return Boolean(this.config.identity || this.config.memoryScope);
2163
+ }
2164
+ lifecycleBase(chatId, sessionId, messageId) {
2165
+ return {
2166
+ channelName: this.name,
2167
+ chatId,
2168
+ sessionId,
2169
+ ...messageId ? { messageId } : {},
2170
+ identity: this.identity,
2171
+ memoryScope: this.memoryScope
2172
+ };
2173
+ }
2016
2174
  supportsProactiveSend() {
2017
2175
  return false;
2018
2176
  }
@@ -2057,7 +2215,7 @@ var ChannelBase = class {
2057
2215
  const sessionId = await this.router.resolve(this.name, job.target.senderId, job.target.chatId, job.target.threadId, job.cwd);
2058
2216
  const label = sanitizeQuotedText(job.label || job.id, 80);
2059
2217
  const createdBy = sanitizeSenderName(job.createdBy || "unknown");
2060
- let promptText = `[Loop "${label}" created by ${createdBy}]
2218
+ let promptText = `[Loop "${label}" created by ${createdBy}] Scheduled task running unattended: no one is present to answer questions, and your final response is delivered to this chat automatically \u2014 do whatever work the task requires, then put the result in your final response instead of trying to deliver it to this chat yourself.
2061
2219
 
2062
2220
  ${sanitizePromptText(job.prompt)}`;
2063
2221
  const shouldPrependSessionContext = !this.instructedSessions.has(sessionId);
@@ -2097,6 +2255,9 @@ ${sanitizePromptText(memoryText)}`);
2097
2255
  if (this.config.instructions) {
2098
2256
  context.push(this.config.instructions);
2099
2257
  }
2258
+ if (this.shouldPrependChannelBoundaryPrompt()) {
2259
+ context.push(this.channelBoundaryPrompt());
2260
+ }
2100
2261
  if (context.length > 0) {
2101
2262
  promptText = `${context.join("\n\n")}
2102
2263
 
@@ -2124,35 +2285,96 @@ ${promptText}`;
2124
2285
  done,
2125
2286
  resolve: doneResolve,
2126
2287
  chatId: job.target.chatId,
2127
- messageId: job.id
2288
+ messageId: job.id,
2289
+ loopPrompt: true
2128
2290
  };
2129
2291
  this.activePrompts.set(sessionId, promptState);
2130
- this.onPromptStart(job.target.chatId, sessionId);
2292
+ this.emitTaskLifecycle({
2293
+ ...this.lifecycleBase(job.target.chatId, sessionId, job.id),
2294
+ type: "started"
2295
+ });
2296
+ try {
2297
+ this.onPromptStart(job.target.chatId, sessionId);
2298
+ } catch (err) {
2299
+ process.stderr.write(`[${this.name}] onPromptStart threw in loop ${job.id} for session ${sessionId}: ${this.lifecycleError(err)}
2300
+ `);
2301
+ }
2302
+ const heldChunks = [];
2303
+ const releaseHeldChunks = /* @__PURE__ */ __name(() => {
2304
+ for (const held of heldChunks.splice(0)) {
2305
+ this.emitTaskLifecycle({
2306
+ ...this.lifecycleBase(job.target.chatId, sessionId, job.id),
2307
+ type: "text_chunk",
2308
+ chunk: held
2309
+ });
2310
+ this.onResponseChunk(job.target.chatId, held, sessionId);
2311
+ }
2312
+ }, "releaseHeldChunks");
2131
2313
  const onChunk = /* @__PURE__ */ __name((sid, chunk) => {
2132
- if (sid === sessionId && !promptState.cancelled) {
2133
- this.onResponseChunk(job.target.chatId, chunk, sessionId);
2314
+ if (sid !== sessionId || promptState.cancelled) {
2315
+ return;
2316
+ }
2317
+ heldChunks.push(chunk);
2318
+ if (!promptState.cancelPending) {
2319
+ releaseHeldChunks();
2134
2320
  }
2135
2321
  }, "onChunk");
2136
2322
  const promptBridge = this.bridge;
2137
2323
  promptBridge.on("textChunk", onChunk);
2138
2324
  try {
2139
2325
  const response = await this.runLoopBridgePrompt(promptBridge, sessionId, promptText, promptState, job.id, options.timeoutMs);
2140
- if (promptState.cancelRequested && !promptState.cancelled) {
2141
- const cancelled = await promptState.cancelRequested;
2142
- if (cancelled) {
2143
- promptState.cancelled = true;
2144
- }
2145
- }
2326
+ await this.settleCancelRequested(promptState);
2146
2327
  if (promptState.cancelled) {
2147
- throw new ChannelLoopSkippedError("loop cancelled before delivery");
2328
+ throw new ChannelLoopSkippedError("loop cancelled before delivery", "cancel_command");
2148
2329
  }
2330
+ releaseHeldChunks();
2149
2331
  if (options.shouldContinue && !await options.shouldContinue()) {
2150
2332
  throw new ChannelLoopSkippedError("loop dropped before delivery");
2151
2333
  }
2334
+ if (promptState.cancelled) {
2335
+ throw new ChannelLoopSkippedError("loop cancelled before delivery", "cancel_command");
2336
+ }
2152
2337
  if (response) {
2338
+ promptState.deliveryStarted = true;
2153
2339
  await this.pushProactive(job.target, response);
2154
2340
  }
2341
+ if (!promptState.deliveryStarted) {
2342
+ await this.settleCancelRequested(promptState);
2343
+ if (promptState.cancelled) {
2344
+ throw new ChannelLoopSkippedError("loop cancelled before delivery", "cancel_command");
2345
+ }
2346
+ }
2347
+ if (!promptState.cancellationEmitted) {
2348
+ this.emitTaskLifecycle({
2349
+ ...this.lifecycleBase(job.target.chatId, sessionId, job.id),
2350
+ type: "completed"
2351
+ });
2352
+ }
2155
2353
  return response;
2354
+ } catch (err) {
2355
+ if (!promptState.deliveryStarted) {
2356
+ await this.settleCancelRequested(promptState);
2357
+ }
2358
+ if (err instanceof ChannelLoopSkippedError && !promptState.cancelled) {
2359
+ this.emitTaskCancellation(promptState, sessionId, err.reason);
2360
+ promptState.cancelled = true;
2361
+ }
2362
+ if (!promptState.cancelled && !(err instanceof ChannelLoopSkippedError)) {
2363
+ releaseHeldChunks();
2364
+ this.emitTaskLifecycle({
2365
+ ...this.lifecycleBase(job.target.chatId, sessionId, job.id),
2366
+ type: "failed",
2367
+ error: this.lifecycleError(err),
2368
+ phase: promptState.deliveryStarted ? "delivery" : "agent"
2369
+ });
2370
+ } else if (promptState.cancelled && !(err instanceof ChannelLoopSkippedError) && !(err instanceof Error && err.message === LOOP_TIMED_OUT_MESSAGE)) {
2371
+ const channel = sanitizeLogText(this.name, 64);
2372
+ const safeJobId = sanitizeLogText(job.id, 64);
2373
+ const safeSessionId = sanitizeLogText(sessionId, 64);
2374
+ process.stderr.write(`[${channel}] loop ${safeJobId} threw after cancellation for session ${safeSessionId}: ${this.lifecycleError(err)}
2375
+ `);
2376
+ }
2377
+ throw err;
2156
2378
  } finally {
2157
2379
  promptBridge.off("textChunk", onChunk);
2158
2380
  const stillCurrent = this.activePrompts.get(sessionId) === promptState;
@@ -2207,15 +2429,16 @@ ${promptText}`;
2207
2429
  prompt,
2208
2430
  new Promise((_, reject) => {
2209
2431
  timer = setTimeout(() => {
2210
- reject(new Error("loop timed out"));
2432
+ reject(new Error(LOOP_TIMED_OUT_MESSAGE));
2211
2433
  }, timeoutMs);
2212
2434
  timer.unref?.();
2213
2435
  })
2214
2436
  ]);
2215
2437
  } catch (err) {
2216
- if (err instanceof Error && err.message === "loop timed out") {
2438
+ if (err instanceof Error && err.message === LOOP_TIMED_OUT_MESSAGE) {
2217
2439
  promptState.cancelled = true;
2218
2440
  await this.cancelTimedOutLoopPrompt(promptBridge, sessionId, jobId);
2441
+ this.emitTaskCancellation(promptState, sessionId, "timeout");
2219
2442
  }
2220
2443
  throw err;
2221
2444
  } finally {
@@ -2245,6 +2468,62 @@ ${promptText}`;
2245
2468
  clearTimeout(graceTimer);
2246
2469
  }
2247
2470
  }
2471
+ requestActivePromptCancellation(sessionId, reason = "cancel_command") {
2472
+ const active = this.activePrompts.get(sessionId);
2473
+ if (!active) {
2474
+ return this.bridge.cancelSession(sessionId).then(() => true, (err) => {
2475
+ this.logCancelSessionFailure(sessionId, err);
2476
+ return false;
2477
+ });
2478
+ }
2479
+ if (active.deliveryStarted) {
2480
+ return Promise.resolve(false);
2481
+ }
2482
+ const cancelRequested = active.cancelRequested ?? this.bridge.cancelSession(sessionId).then(() => true, (err) => {
2483
+ this.logCancelSessionFailure(sessionId, err);
2484
+ active.cancelRequested = void 0;
2485
+ return false;
2486
+ });
2487
+ active.cancelRequested = cancelRequested;
2488
+ active.cancelPending = true;
2489
+ return cancelRequested.finally(() => {
2490
+ active.cancelPending = false;
2491
+ }).then((cancelSucceeded) => {
2492
+ const turnEnded = this.activePrompts.get(sessionId) !== active;
2493
+ if (!cancelSucceeded || active.deliveryStarted || turnEnded && !active.cancelled) {
2494
+ return false;
2495
+ }
2496
+ active.cancelled = true;
2497
+ this.stopActiveStreaming(active, sessionId, reason);
2498
+ this.collectBuffers.delete(sessionId);
2499
+ this.emitTaskCancellation(active, sessionId, reason);
2500
+ return true;
2501
+ });
2502
+ }
2503
+ logCancelSessionFailure(sessionId, err) {
2504
+ process.stderr.write(`[${sanitizeLogText(this.name, 64)}] cancelSession failed for session=${sanitizeLogText(sessionId, 64)}: ${this.lifecycleError(err)}
2505
+ `);
2506
+ }
2507
+ async settleCancelRequested(active) {
2508
+ if (!active.cancelRequested || active.cancelled) {
2509
+ return;
2510
+ }
2511
+ let timer;
2512
+ try {
2513
+ const cancelled = await Promise.race([
2514
+ active.cancelRequested,
2515
+ new Promise((resolve2) => {
2516
+ timer = setTimeout(() => resolve2(false), CLEAR_CANCEL_TIMEOUT_MS);
2517
+ timer.unref?.();
2518
+ })
2519
+ ]);
2520
+ if (cancelled) {
2521
+ active.cancelled = true;
2522
+ }
2523
+ } finally {
2524
+ clearTimeout(timer);
2525
+ }
2526
+ }
2248
2527
  onToolCall(_chatId, _event) {
2249
2528
  }
2250
2529
  onSessionDied(sessionId) {
@@ -2311,22 +2590,8 @@ ${promptText}`;
2311
2590
  await this.sendMessage(envelope.chatId, "No request is currently running.");
2312
2591
  return true;
2313
2592
  }
2314
- const cancelRequested = active.cancelRequested ?? this.bridge.cancelSession(activeSessionId).then(() => true, (err) => {
2315
- process.stderr.write(`[${this.name}] cancelSession failed for session=${activeSessionId}: ${err instanceof Error ? err.message : err}
2316
- `);
2317
- active.cancelRequested = void 0;
2318
- return false;
2319
- });
2320
- active.cancelRequested = cancelRequested;
2321
- const cancelSucceeded = await cancelRequested;
2322
- if (!cancelSucceeded) {
2323
- await this.sendMessage(envelope.chatId, "Failed to cancel current request.");
2324
- return true;
2325
- }
2326
- active.cancelled = true;
2327
- active.stopStreaming?.();
2328
- this.collectBuffers.delete(activeSessionId);
2329
- await this.sendMessage(envelope.chatId, "Cancelled current request.");
2593
+ const cancelSucceeded = await this.requestActivePromptCancellation(activeSessionId, "cancel_command");
2594
+ await this.sendMessage(envelope.chatId, cancelSucceeded ? "Cancelled current request." : "Failed to cancel current request.");
2330
2595
  return true;
2331
2596
  });
2332
2597
  }
@@ -2354,7 +2619,7 @@ ${promptText}`;
2354
2619
  `);
2355
2620
  active.clearEvicted = true;
2356
2621
  try {
2357
- this.onPromptEnd(active.chatId, id, active.messageId);
2622
+ this.onPromptEnd(active.chatId, id, active.loopPrompt ? void 0 : active.messageId);
2358
2623
  } catch (err) {
2359
2624
  process.stderr.write(`[${this.name}] onPromptEnd threw during /clear eviction for session ${id}: ${err instanceof Error ? err.message : err}
2360
2625
  `);
@@ -2405,6 +2670,12 @@ ${promptText}`;
2405
2670
  const scopeNote = this.config.sessionScope === "single" ? " (shared channel-wide)" : this.isSharedSession(envelope) ? envelope.isGroup ? " (shared by this group)" : "" : envelope.isGroup ? " (private to you)" : "";
2406
2671
  await this.sendMessage(envelope.chatId, [
2407
2672
  `Channel: ${this.name}`,
2673
+ // Identity/memory lines only for channels that opted in — keep
2674
+ // unconfigured channels' output unchanged.
2675
+ ...this.shouldPrependChannelBoundaryPrompt() ? [
2676
+ `Identity: ${sanitizeQuotedText(this.identity.displayName, 128)}`,
2677
+ `Memory: ${sanitizeQuotedText(this.memoryScope.namespace, 128)}`
2678
+ ] : [],
2408
2679
  // Only the basename — don't leak the absolute cwd to group members.
2409
2680
  `Workspace: ${basename(this.config.cwd)}`,
2410
2681
  `Session: ${active ? "active" : "none"}${scopeNote}`
@@ -2542,7 +2813,11 @@ ${promptText}`;
2542
2813
  const lines = [
2543
2814
  `Session: ${hasSession ? "active" : "none"}`,
2544
2815
  `Access: ${policy}`,
2545
- `Channel: ${this.name}`
2816
+ `Channel: ${this.name}`,
2817
+ ...this.shouldPrependChannelBoundaryPrompt() ? [
2818
+ `Identity: ${sanitizeQuotedText(this.identity.id, 128)}`,
2819
+ `Memory: ${this.memoryScope.mode}`
2820
+ ] : []
2546
2821
  ];
2547
2822
  await this.sendMessage(envelope.chatId, lines.join("\n"));
2548
2823
  return true;
@@ -2855,6 +3130,7 @@ ${promptText}`;
2855
3130
  process.stderr.write(`[${this.name}] cancelSession failed for session=${sessionId} (clear/await): ${err instanceof Error ? err.message : err}
2856
3131
  `);
2857
3132
  });
3133
+ this.emitTaskCancellation(active, sessionId, "clear");
2858
3134
  let timer;
2859
3135
  const settled = await Promise.race([
2860
3136
  active.done.then(() => true),
@@ -3149,14 +3425,18 @@ ${promptText}`;
3149
3425
  `);
3150
3426
  break;
3151
3427
  }
3428
+ const firstCancellation = !active.cancelled;
3152
3429
  active.cancelled = true;
3153
- process.stderr.write(`[${this.name}] steer: cancelled active turn for ${envelope.senderId} in session ${sessionId}
3430
+ if (firstCancellation) {
3431
+ process.stderr.write(`[${this.name}] steer: cancelled active turn for ${envelope.senderId} in session ${sessionId}
3154
3432
  `);
3155
- this.stopActiveStreaming(active, sessionId, "steer");
3156
- void this.bridge.cancelSession(sessionId).catch((err) => {
3157
- process.stderr.write(`[${this.name}] cancelSession failed for session=${sessionId} (steer): ${err instanceof Error ? err.message : err}
3433
+ this.stopActiveStreaming(active, sessionId, "steer");
3434
+ void this.bridge.cancelSession(sessionId).catch((err) => {
3435
+ process.stderr.write(`[${this.name}] cancelSession failed for session=${sessionId} (steer): ${err instanceof Error ? err.message : err}
3158
3436
  `);
3159
- });
3437
+ });
3438
+ this.emitTaskCancellation(active, sessionId, "steer");
3439
+ }
3160
3440
  steerWatchdog = setTimeout(() => {
3161
3441
  if (this.activePrompts.get(sessionId) === active) {
3162
3442
  process.stderr.write(`[${this.name}] steer queued behind active turn for session ${sessionId}: still waiting after ${CLEAR_CANCEL_TIMEOUT_MS}ms (use /clear to recover)
@@ -3212,6 +3492,9 @@ ${sanitizePromptText(memoryText)}`);
3212
3492
  if (this.config.instructions) {
3213
3493
  sessionContext.push(this.config.instructions);
3214
3494
  }
3495
+ if (this.shouldPrependChannelBoundaryPrompt()) {
3496
+ sessionContext.push(this.channelBoundaryPrompt());
3497
+ }
3215
3498
  }
3216
3499
  if (this.dropQueuedTurnIfStale(sessionId, generation, envelope)) {
3217
3500
  return;
@@ -3236,7 +3519,16 @@ ${promptToSend}`;
3236
3519
  messageId: envelope.messageId
3237
3520
  };
3238
3521
  this.activePrompts.set(sessionId, promptState);
3239
- this.onPromptStart(envelope.chatId, sessionId, envelope.messageId);
3522
+ this.emitTaskLifecycle({
3523
+ ...this.lifecycleBase(envelope.chatId, sessionId, envelope.messageId),
3524
+ type: "started"
3525
+ });
3526
+ try {
3527
+ this.onPromptStart(envelope.chatId, sessionId, envelope.messageId);
3528
+ } catch (err) {
3529
+ process.stderr.write(`[${this.name}] onPromptStart threw for session ${sessionId}: ${this.lifecycleError(err)}
3530
+ `);
3531
+ }
3240
3532
  const streamer = useBlockStreaming ? new BlockStreamer({
3241
3533
  minChars: this.config.blockStreamingChunk?.minChars ?? 400,
3242
3534
  maxChars: this.config.blockStreamingChunk?.maxChars ?? 1e3,
@@ -3244,10 +3536,25 @@ ${promptToSend}`;
3244
3536
  send: /* @__PURE__ */ __name((text) => this.sendMessage(envelope.chatId, text), "send")
3245
3537
  }) : null;
3246
3538
  promptState.stopStreaming = () => streamer?.stop();
3539
+ const heldChunks = [];
3540
+ const releaseHeldChunks = /* @__PURE__ */ __name(() => {
3541
+ for (const held of heldChunks.splice(0)) {
3542
+ this.emitTaskLifecycle({
3543
+ ...this.lifecycleBase(envelope.chatId, sessionId, envelope.messageId),
3544
+ type: "text_chunk",
3545
+ chunk: held
3546
+ });
3547
+ this.onResponseChunk(envelope.chatId, held, sessionId);
3548
+ streamer?.push(held);
3549
+ }
3550
+ }, "releaseHeldChunks");
3247
3551
  const onChunk = /* @__PURE__ */ __name((sid, chunk) => {
3248
- if (sid === sessionId && !promptState.cancelled) {
3249
- this.onResponseChunk(envelope.chatId, chunk, sessionId);
3250
- streamer?.push(chunk);
3552
+ if (sid !== sessionId || promptState.cancelled) {
3553
+ return;
3554
+ }
3555
+ heldChunks.push(chunk);
3556
+ if (!promptState.cancelPending) {
3557
+ releaseHeldChunks();
3251
3558
  }
3252
3559
  }, "onChunk");
3253
3560
  const promptBridge = this.bridge;
@@ -3257,19 +3564,47 @@ ${promptToSend}`;
3257
3564
  imageBase64,
3258
3565
  imageMimeType
3259
3566
  });
3260
- if (promptState.cancelRequested && !promptState.cancelled) {
3261
- const cancelled = await promptState.cancelRequested;
3262
- if (cancelled) {
3263
- promptState.cancelled = true;
3264
- }
3567
+ await this.settleCancelRequested(promptState);
3568
+ if (!promptState.cancelled) {
3569
+ releaseHeldChunks();
3265
3570
  }
3266
3571
  if (!promptState.cancelled && response) {
3572
+ promptState.deliveryStarted = true;
3267
3573
  if (streamer) {
3268
3574
  await streamer.flush();
3269
3575
  } else {
3270
3576
  await this.onResponseComplete(envelope.chatId, response, sessionId);
3271
3577
  }
3272
3578
  }
3579
+ if (!promptState.deliveryStarted) {
3580
+ await this.settleCancelRequested(promptState);
3581
+ }
3582
+ if (!promptState.cancelled && !promptState.cancellationEmitted) {
3583
+ this.emitTaskLifecycle({
3584
+ ...this.lifecycleBase(envelope.chatId, sessionId, envelope.messageId),
3585
+ type: "completed"
3586
+ });
3587
+ }
3588
+ } catch (err) {
3589
+ if (!promptState.deliveryStarted) {
3590
+ await this.settleCancelRequested(promptState);
3591
+ }
3592
+ if (!promptState.cancelled) {
3593
+ releaseHeldChunks();
3594
+ this.emitTaskLifecycle({
3595
+ ...this.lifecycleBase(envelope.chatId, sessionId, envelope.messageId),
3596
+ type: "failed",
3597
+ error: this.lifecycleError(err),
3598
+ phase: promptState.deliveryStarted ? "delivery" : "agent"
3599
+ });
3600
+ } else {
3601
+ const channel = sanitizeLogText(this.name, 64);
3602
+ const safeSessionId = sanitizeLogText(sessionId, 64);
3603
+ const safeMessageId = sanitizeLogText(envelope.messageId ?? "", 64);
3604
+ process.stderr.write(`[${channel}] turn ${safeMessageId} threw after cancellation for session ${safeSessionId}: ${this.lifecycleError(err)}
3605
+ `);
3606
+ }
3607
+ throw err;
3273
3608
  } finally {
3274
3609
  promptBridge.off("textChunk", onChunk);
3275
3610
  streamer?.stop();
@@ -3507,6 +3842,13 @@ function normalizeJob(job) {
3507
3842
  }
3508
3843
  __name(normalizeJob, "normalizeJob");
3509
3844
 
3845
+ // packages/channels/base/dist/types.js
3846
+ init_esbuild_shims();
3847
+ function isTerminalTaskLifecycleType(type) {
3848
+ return type === "completed" || type === "cancelled" || type === "failed";
3849
+ }
3850
+ __name(isTerminalTaskLifecycleType, "isTerminalTaskLifecycleType");
3851
+
3510
3852
  export {
3511
3853
  resolvePath,
3512
3854
  getGlobalQwenDir,
@@ -3519,5 +3861,6 @@ export {
3519
3861
  SessionRouter,
3520
3862
  ChannelLoopScheduler,
3521
3863
  ChannelBase,
3522
- ChannelLoopStore
3864
+ ChannelLoopStore,
3865
+ isTerminalTaskLifecycleType
3523
3866
  };