@qwen-code/qwen-code 0.23.5-dev.codemode-responses.20260915.f024b37689 → 0.23.5-preview.0
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.
- package/bundled/computer-use/SKILL.md +24 -3
- package/bundled/qc-helper/docs/configuration/model-providers.md +43 -0
- package/bundled/qc-helper/docs/configuration/settings.md +10 -9
- package/bundled/qc-helper/docs/extension/agent-plugins.md +1 -0
- package/bundled/qc-helper/docs/extension/introduction.md +49 -0
- package/bundled/qc-helper/docs/features/channels/dingtalk.md +39 -4
- package/bundled/qc-helper/docs/features/channels/overview.md +12 -0
- package/bundled/qc-helper/docs/features/commands.md +57 -52
- package/bundled/qc-helper/docs/features/computer-use.md +1 -1
- package/bundled/qc-helper/docs/features/goals.md +8 -0
- package/bundled/qc-helper/docs/features/hooks.md +16 -0
- package/bundled/qc-helper/docs/qwen-serve.md +3 -1
- package/bundled/workflow-authoring/SKILL.md +48 -22
- package/chunks/{MaxSizedBox-BFMIFJWT.js → MaxSizedBox-FCF6M53W.js} +40 -43
- package/chunks/{StandaloneSessionPicker-4ZH7MOVG.js → StandaloneSessionPicker-V635V72I.js} +60 -63
- package/chunks/{acp-startup-profiler-RUQNTNU5.js → acp-startup-profiler-MOOU37VM.js} +2 -2
- package/chunks/{acp-subagent-executor-AHMVA4P3.js → acp-subagent-executor-TND6W2O5.js} +46 -47
- package/chunks/{acpAgent-UMAJ3XR3.js → acpAgent-3DPWZTNC.js} +954 -322
- package/chunks/{agent-CXB2CCQN.js → agent-KIHGINKN.js} +27 -30
- package/chunks/{agent-headless-7D5ZC736.js → agent-headless-EJ4QOUSM.js} +27 -30
- package/chunks/{anthropicContentGenerator-H5YPXIDE.js → anthropicContentGenerator-4FGOM5LK.js} +46 -64
- package/chunks/{artifact-tool-MFGORTWZ.js → artifact-tool-MUTNH4NI.js} +1 -1
- package/chunks/{askUserQuestion-WS4GUT7C.js → askUserQuestion-AKIRLVB5.js} +1 -1
- package/chunks/bareMode-QWKZPLPX.js +14 -0
- package/chunks/{bridge-A2WKX6IK.js → bridge-MUX5YJZT.js} +46 -49
- package/chunks/{ca-GZ4FDJU2.js → ca-WC3A5B3Q.js} +12 -1
- package/chunks/{channel-management-service-AFVIT4VH.js → channel-management-service-RRILWSXX.js} +4 -4
- package/chunks/{channel-settings-store-AXJIN7HG.js → channel-settings-store-7CBIRZER.js} +51 -54
- package/chunks/{channel-worker-group-JR6JOELM.js → channel-worker-group-3DUJFZJR.js} +8 -8
- package/chunks/{channel-worker-manager-AVKJEZFL.js → channel-worker-manager-E5UW2VLA.js} +8 -8
- package/chunks/{channel-worker-supervisor-OOYY7BAQ.js → channel-worker-supervisor-VN33GSEC.js} +5 -5
- package/chunks/{chunk-2YMRRI2C.js → chunk-2C5TR6HN.js} +82 -9
- package/chunks/{chunk-YDFOHRS5.js → chunk-2GP6BQ2J.js} +1 -1
- package/chunks/{chunk-RN6BU77T.js → chunk-347O2YZJ.js} +158 -290
- package/chunks/{chunk-LTINUI3O.js → chunk-36NRLIR6.js} +10 -8
- package/chunks/{chunk-AXZMWAJV.js → chunk-36SDZ2Q4.js} +8 -0
- package/chunks/{chunk-QR4Q425T.js → chunk-3BZI5GDP.js} +1 -1
- package/chunks/{chunk-C3YMBSLR.js → chunk-3HTUE6ZR.js} +3 -3
- package/chunks/{chunk-QS5Q5F42.js → chunk-3LLEB5CU.js} +2 -2
- package/chunks/{chunk-FPPG5Y3W.js → chunk-3UGMLA4V.js} +10 -8
- package/chunks/{chunk-66N6C4EH.js → chunk-3WILPKTJ.js} +2 -2
- package/chunks/{chunk-SROLVJFY.js → chunk-3WWPEFMX.js} +1 -1
- package/chunks/{chunk-ZKIAGIGH.js → chunk-3XBUCOWS.js} +1 -1
- package/chunks/{chunk-6RQFMGN2.js → chunk-43Y26NPF.js} +3 -3
- package/chunks/{chunk-INGBUYL6.js → chunk-4FLUQWJ4.js} +1 -1
- package/chunks/{chunk-S77FFY67.js → chunk-4JFLRHNE.js} +1 -1
- package/chunks/{chunk-MJHLKWGJ.js → chunk-4QPVZA5J.js} +70 -23
- package/chunks/{chunk-XX5HQLCZ.js → chunk-6OTF7TTE.js} +32 -1
- package/chunks/{chunk-4Y2I3CI3.js → chunk-6USYH3EU.js} +99 -6
- package/chunks/{chunk-Q3TFRP5G.js → chunk-7D4CV7JH.js} +102 -9
- package/chunks/{chunk-EWJTAP3Y.js → chunk-7O5PYQ3M.js} +20 -1
- package/chunks/chunk-ADN5KESB.js +28 -0
- package/chunks/chunk-AKRSSKUT.js +229 -0
- package/chunks/{chunk-54YUXX7X.js → chunk-AQP3H22J.js} +1 -1
- package/chunks/{chunk-EQWKIA72.js → chunk-AUX2FL5T.js} +24 -7
- package/chunks/{chunk-YGFJ6BRT.js → chunk-AZCTY64Z.js} +1 -1
- package/chunks/{chunk-QLX4D55R.js → chunk-B5TJK7B3.js} +1 -1
- package/chunks/{chunk-HXMDDII6.js → chunk-B6RMK4ED.js} +4 -4
- package/chunks/{chunk-UCKM6KCJ.js → chunk-BHG3H6OZ.js} +1 -1
- package/chunks/{chunk-JLF2AQAL.js → chunk-BHVF3R6B.js} +7 -5
- package/chunks/{chunk-HFJSQ4GL.js → chunk-BTICBRPL.js} +1 -1
- package/chunks/{chunk-KZCK5JUN.js → chunk-C3T6HPNM.js} +1 -1
- package/chunks/{chunk-FCLMJS6N.js → chunk-CDDP4ONL.js} +164 -27
- package/chunks/{chunk-Y3ZXDBUL.js → chunk-CQPM66MG.js} +4 -4
- package/chunks/{chunk-WKVZES7O.js → chunk-CXONOVBN.js} +1 -1
- package/chunks/{chunk-TYBRGFYL.js → chunk-CXY6BICQ.js} +501 -479
- package/chunks/{chunk-W23HOFDK.js → chunk-D3KVGQUV.js} +1 -1
- package/chunks/{chunk-LMJSPC55.js → chunk-D7JMO2GP.js} +3 -7
- package/chunks/{chunk-CXXAZ2LZ.js → chunk-DC4ZNGH4.js} +1 -1
- package/chunks/{chunk-FMLBBXHB.js → chunk-DRAX5YAI.js} +2 -2
- package/chunks/{chunk-DOTF2PF2.js → chunk-DRD6VBNH.js} +1 -1
- package/chunks/chunk-DX6JTDMR.js +105 -0
- package/chunks/{chunk-MNRK6MIH.js → chunk-E2VSBAFA.js} +53 -11
- package/chunks/{chunk-QJKR2P2K.js → chunk-EIBECN2J.js} +3 -3
- package/chunks/{chunk-LWWRJRCD.js → chunk-ESBYWATJ.js} +1 -1
- package/chunks/{chunk-3544ZEGZ.js → chunk-FASYATAZ.js} +5 -7
- package/chunks/{chunk-6YUS5JCV.js → chunk-FBY32737.js} +4 -4
- package/chunks/{chunk-LBWIJ5T7.js → chunk-FCPJXKDG.js} +10 -7
- package/chunks/{chunk-FX6GJIPZ.js → chunk-FEDFZBGR.js} +3 -3
- package/chunks/{chunk-DQ4LBRZN.js → chunk-FIJODK52.js} +3 -3
- package/chunks/{chunk-HVSRWLOW.js → chunk-FX6PZBOV.js} +3 -3
- package/chunks/{chunk-L6DIANLD.js → chunk-G45B3INR.js} +1 -1
- package/chunks/{chunk-EYLUKEYW.js → chunk-GI7SLDOI.js} +2 -2
- package/chunks/chunk-GJKP6XOB.js +1092 -0
- package/chunks/{chunk-I6YJZGHS.js → chunk-GSAOVDTH.js} +9 -9
- package/chunks/{chunk-XK4UQSIR.js → chunk-H6L4NEAT.js} +1 -1
- package/chunks/{chunk-GMCEFKNR.js → chunk-HNFKYKHH.js} +103 -22
- package/chunks/{chunk-6XDB3FR4.js → chunk-HX4WXX3H.js} +301 -138
- package/chunks/{chunk-HG46TTAG.js → chunk-HXUI5D4H.js} +1 -1
- package/chunks/{chunk-QI4WBHPF.js → chunk-HYHSMTRA.js} +4 -4
- package/chunks/{chunk-ZUKC5J6Q.js → chunk-IKBEIDOH.js} +14 -14
- package/chunks/{chunk-LCAJ63TF.js → chunk-INN5ORKX.js} +1 -1
- package/chunks/{chunk-GNV2SFO7.js → chunk-IVFTLUZD.js} +26 -1
- package/chunks/{chunk-GNKSR3FU.js → chunk-IXO2OCIP.js} +2 -2
- package/chunks/{chunk-SNT634Q6.js → chunk-K4XMAIRX.js} +30 -33
- package/chunks/{chunk-WBP64MZR.js → chunk-KAYC5FBN.js} +5269 -2785
- package/chunks/chunk-KEM7MWS7.js +3541 -0
- package/chunks/{chunk-ADQUK6WA.js → chunk-KVC7HZWK.js} +1 -1
- package/chunks/{chunk-UQXURNLM.js → chunk-KVQ3QL4K.js} +3 -3
- package/chunks/{chunk-7U5G6JXI.js → chunk-KWYTSSTJ.js} +105 -6
- package/chunks/{chunk-Q4G2YPI4.js → chunk-L2A5VBDL.js} +3019 -2352
- package/chunks/{chunk-WD6YQI5M.js → chunk-L3SNMEDW.js} +1 -1
- package/chunks/{chunk-BYUAT5OC.js → chunk-L7TJUPNR.js} +19 -3
- package/chunks/{chunk-ABNX6E6K.js → chunk-LFKXIOGC.js} +1 -1
- package/chunks/{chunk-GFAK6DYU.js → chunk-LO2UWNO5.js} +2 -2
- package/chunks/{chunk-67ZDP7UX.js → chunk-M22WLKLI.js} +5 -5
- package/chunks/{chunk-54B2LTKP.js → chunk-M23GFJ5B.js} +24 -5
- package/chunks/{chunk-VGY2RGXL.js → chunk-M4U2LTD2.js} +1 -1
- package/chunks/{chunk-ZNI3YJHS.js → chunk-MFDKHGTD.js} +1 -1
- package/chunks/{chunk-R7OO56VZ.js → chunk-MMRGG6R4.js} +1 -1
- package/chunks/{chunk-E6IR653O.js → chunk-MO4XID7S.js} +1 -1
- package/chunks/{chunk-NJ4ZNDVP.js → chunk-NKTMUPHJ.js} +3 -6
- package/chunks/{chunk-4DTFTPTU.js → chunk-NQ272MQG.js} +1 -1
- package/chunks/{chunk-DWKFTUGI.js → chunk-OALXNGUA.js} +6 -6
- package/chunks/{chunk-FBDHP23D.js → chunk-OSG23MR3.js} +1 -1
- package/chunks/{chunk-NJ2OFVUX.js → chunk-P42KMMU6.js} +860 -1
- package/chunks/{chunk-5KJ54DY3.js → chunk-PF7GAP6K.js} +60 -58
- package/chunks/{chunk-MQRLLBMQ.js → chunk-PPJSG2PU.js} +2 -2
- package/chunks/{chunk-EPVEPTI3.js → chunk-PZRXWQUA.js} +753 -18
- package/chunks/{chunk-VI5UVPOB.js → chunk-Q54O3EIA.js} +30 -28
- package/chunks/{chunk-QTUQV33C.js → chunk-QGEISOJ2.js} +4 -4
- package/chunks/{chunk-XKRYQOHS.js → chunk-QHSOINX6.js} +2 -2
- package/chunks/{chunk-Z6Q7I37O.js → chunk-QIPLWW6Q.js} +1 -1
- package/chunks/chunk-QMENOK5T.js +1246 -0
- package/chunks/chunk-QT6Z2IBF.js +347 -0
- package/chunks/{chunk-TBSCTWKF.js → chunk-RN6A53UJ.js} +25 -0
- package/chunks/{chunk-E7ZTAOJZ.js → chunk-RRI764F7.js} +21 -19
- package/chunks/{chunk-YI2YCNSP.js → chunk-SENYKRII.js} +1 -1
- package/chunks/chunk-SFHX5G2S.js +2796 -0
- package/chunks/chunk-SK3RZOPS.js +34 -0
- package/chunks/{chunk-SKYOAH4Z.js → chunk-SOLRBF7L.js} +13 -9
- package/chunks/{chunk-5WLF44DS.js → chunk-SSWTA7CH.js} +12 -12
- package/chunks/{chunk-IAS753HG.js → chunk-SYMXYRM5.js} +11 -2
- package/chunks/{chunk-FGROOEKM.js → chunk-TDKUXSJO.js} +34 -6
- package/chunks/{chunk-ZJ7JQUGY.js → chunk-TKF4JINY.js} +1 -1
- package/chunks/{chunk-ZOQ6HC7U.js → chunk-TPY6HW55.js} +4 -4
- package/chunks/{chunk-EDB556X7.js → chunk-TRZ22SG5.js} +1 -1
- package/chunks/{chunk-FHSOZSBO.js → chunk-TXTCM3TC.js} +4 -4
- package/chunks/{chunk-5ODRE7E5.js → chunk-U4AASWUQ.js} +28 -12
- package/chunks/{chunk-PPE7VUMD.js → chunk-UQGRJTDK.js} +2 -2
- package/chunks/{chunk-JO67LVXW.js → chunk-UZSB57EV.js} +6 -8
- package/chunks/{chunk-UY4OCBX4.js → chunk-V4JJAVHQ.js} +2 -2
- package/chunks/chunk-VEXUA6DX.js +1026 -0
- package/chunks/{chunk-ME4JBHSB.js → chunk-VQDWCQOE.js} +2 -0
- package/chunks/{chunk-ZC75SULX.js → chunk-VU3XMZ5I.js} +23 -4
- package/chunks/{chunk-A2UYI473.js → chunk-WL36KHUQ.js} +6 -6
- package/chunks/{chunk-IWOJ2FHG.js → chunk-WNQIJTOP.js} +8 -8
- package/chunks/{chunk-IANIY25T.js → chunk-WSJI6ODG.js} +99 -30
- package/chunks/{chunk-3CKAOJ4L.js → chunk-WZWTY7SG.js} +6 -6
- package/chunks/{chunk-EKMJR7M3.js → chunk-X7AYIXC7.js} +1 -1
- package/chunks/{chunk-IBRQG2MP.js → chunk-XAJZFGD2.js} +11 -11
- package/chunks/{chunk-VRQZESKP.js → chunk-XICCGDWF.js} +2 -2
- package/chunks/{chunk-L5R4D5T4.js → chunk-Y2KJC55Y.js} +12 -7
- package/chunks/{chunk-2S2WIGCM.js → chunk-Y4NNIGYO.js} +1 -1
- package/chunks/{chunk-J7LBAKDH.js → chunk-YL3UJML3.js} +7 -7
- package/chunks/{chunk-GSS4SZNG.js → chunk-YP2K3WOS.js} +40 -56
- package/chunks/{chunk-ZZUXUBEB.js → chunk-YQQ2U7AS.js} +8 -5
- package/chunks/{chunk-FAWTMDX7.js → chunk-YXHY6BKS.js} +15 -0
- package/chunks/{chunk-FIP5QS2U.js → chunk-YZXSDPOQ.js} +140 -39
- package/chunks/{chunk-WATHOB6X.js → chunk-ZFHKUQZ4.js} +3 -3
- package/chunks/{chunk-R5OA3ONY.js → chunk-ZMYKNKET.js} +6 -6
- package/chunks/{codex-subagent-executor-LANZAZPH.js → codex-subagent-executor-AEAIQZDC.js} +48 -49
- package/chunks/{config-utils-CRK2LQPA.js → config-utils-KX2YS725.js} +43 -46
- package/chunks/{contextCommand-GY5X3LIY.js → contextCommand-RV6Y5LNJ.js} +41 -44
- package/chunks/{core-runtime-IJIV2LHP.js → core-runtime-ZI4RTOJQ.js} +45 -48
- package/chunks/{create-sub-session-MNIVRHGB.js → create-sub-session-BBWFQARJ.js} +46 -48
- package/chunks/{daemon-NJB4PWZ7.js → daemon-INCM4VBX.js} +3 -1
- package/chunks/{daemon-git-worktree-guard-W6Z2BGDH.js → daemon-git-worktree-guard-KECEMV6A.js} +39 -42
- package/chunks/{daemon-status-provider-TJF3APU3.js → daemon-status-provider-NULJNAEV.js} +53 -56
- package/chunks/{daemon-trust-policy-6INCISDU.js → daemon-trust-policy-S4KWGPV3.js} +47 -50
- package/chunks/{daemon-trust-policy-monitor-JRTAQG54.js → daemon-trust-policy-monitor-546N5ZVL.js} +47 -50
- package/chunks/{de-VGY3VNBU.js → de-6AVKPTXQ.js} +11 -0
- package/chunks/{deferred-core-runtime-2JRTPTNM.js → deferred-core-runtime-T23ZT443.js} +39 -42
- package/chunks/{dist-NIOJXMGY.js → dist-4P3ZJYGI.js} +1 -1
- package/chunks/{dist-VDLSBCLM.js → dist-7MGRENQ5.js} +1 -1
- package/chunks/{dist-SE4J6Z4O.js → dist-BNW423XT.js} +326 -77
- package/chunks/{dist-TFGETXFN.js → dist-CESMUYGN.js} +4 -4
- package/chunks/{dist-MPUZZOG5.js → dist-DBBOFWSC.js} +1 -1
- package/chunks/{dist-T6DDPDLQ.js → dist-G5UMXIGF.js} +1 -1
- package/chunks/{dist-PA7WPFVE.js → dist-UXVNLQHG.js} +3 -3
- package/chunks/{dist-GUB7QRYA.js → dist-VA4LREAQ.js} +2 -2
- package/chunks/{dist-2QYIVNS6.js → dist-XDRTR4QP.js} +1 -1
- package/chunks/{edit-JDIXXCYB.js → edit-CMSQB7NP.js} +27 -30
- package/chunks/{en-E5ZO5TZW.js → en-56QLKXS2.js} +23 -1
- package/chunks/{enter-worktree-CAARFWBI.js → enter-worktree-DA6A4XC5.js} +3 -3
- package/chunks/{enterPlanMode-YTNTBZBN.js → enterPlanMode-UDPMNESD.js} +27 -30
- package/chunks/{environment-UAI5L52V.js → environment-TSQJUTPV.js} +42 -45
- package/chunks/{errors-J4UCDCW5.js → errors-RIVYJS6T.js} +41 -44
- package/chunks/{exit-worktree-JXGGUOBP.js → exit-worktree-4H6Z2VQI.js} +3 -3
- package/chunks/{exitPlanMode-YMWJ2EO7.js → exitPlanMode-BYBBFN2T.js} +27 -30
- package/chunks/{fast-path-MBAN7TK3.js → fast-path-F2CYDDZ4.js} +4 -4
- package/chunks/{fast-path-settings-XDYX7X5Z.js → fast-path-settings-N2VGRGDJ.js} +2 -2
- package/chunks/{fr-UAZJJH5N.js → fr-EBUDHJL3.js} +11 -0
- package/chunks/{glob-YEM24E3Z.js → glob-Z2JMJKKN.js} +27 -30
- package/chunks/{goal-tools-LJIVH5T6.js → goal-tools-HXVVLGCV.js} +27 -30
- package/chunks/{handleAutoUpdate-DYCSYDYL.js → handleAutoUpdate-FZP45KOR.js} +43 -46
- package/chunks/{i18n-PTAV7SN3.js → i18n-OTB62AKW.js} +40 -43
- package/chunks/{image-gen-5G2TQ3DY.js → image-gen-HIAZCB5T.js} +6 -7
- package/chunks/{initializer-MPXTKQA4.js → initializer-4JXZEC4B.js} +47 -50
- package/chunks/{installationInfo-U5EFA3OL.js → installationInfo-2IJV5QKC.js} +39 -42
- package/chunks/{ja-2RITCMAJ.js → ja-NCDT4CGV.js} +11 -0
- package/chunks/{list-YOE25QUI.js → list-KQSQ4A5G.js} +50 -53
- package/chunks/{llm-ZZ2WNQMC.js → llm-LSUBOJAR.js} +154 -974
- package/chunks/{llm-content-generator-CG2HRJZC.js → llm-content-generator-MLIONRXE.js} +17 -12
- package/chunks/{loadedSettingsAdapter-NPGWGURF.js → loadedSettingsAdapter-TZTTNRHI.js} +47 -50
- package/chunks/{loggingContentGenerator-TUL6SJVL.js → loggingContentGenerator-TUPEXFMM.js} +31 -34
- package/chunks/{loop-wakeup-VG6CGBQA.js → loop-wakeup-ZBVRI6VH.js} +1 -1
- package/chunks/{managed-npm-update-YUDSCJP3.js → managed-npm-update-WEA5XMFZ.js} +40 -43
- package/chunks/{mcp-EX3GDQVO.js → mcp-TFDTUPIA.js} +47 -50
- package/chunks/{model-configuration-6DEKTXJI.js → model-configuration-ZCAKKIOF.js} +48 -51
- package/chunks/{modelConfigUtils-4NA2MHEE.js → modelConfigUtils-J3ZPW7ZK.js} +41 -44
- package/chunks/{monitor-PPUGNAWR.js → monitor-CI7YE7MT.js} +29 -32
- package/chunks/{nonInteractiveCli-6TW2XYP5.js → nonInteractiveCli-GPT3TVOK.js} +96 -98
- package/chunks/{notebook-edit-4MUXHZHT.js → notebook-edit-3WCVRNGL.js} +27 -30
- package/chunks/{openaiContentGenerator-5J73W5XZ.js → openaiContentGenerator-OGILGUZE.js} +12 -17
- package/chunks/{openaiResponsesContentGenerator-AWRYZLJU.js → openaiResponsesContentGenerator-NXOXUPFM.js} +45 -13
- package/chunks/{pidfile-M7WELKBB.js → pidfile-GBTBIGHF.js} +39 -42
- package/chunks/{process-registry-X6ZCASEN.js → process-registry-7LAPI3ZB.js} +1 -1
- package/chunks/{processUtils-SPRINFNY.js → processUtils-O4II3RYH.js} +2 -2
- package/chunks/{prompt-terminal-ledger-25BRD7FX.js → prompt-terminal-ledger-ILIXZI3E.js} +40 -43
- package/chunks/{pt-5ZF7ZQUV.js → pt-FYYFWYUC.js} +11 -0
- package/chunks/{qwenContentGenerator-H5AAKXPC.js → qwenContentGenerator-I4LRYADV.js} +33 -36
- package/chunks/{qwenOAuth2-WIEUEFEY.js → qwenOAuth2-3J66TOT5.js} +6 -7
- package/chunks/{read-file-ILGEFPB3.js → read-file-G4XKW2CS.js} +5 -9
- package/chunks/{record-artifact-PXMNP7GZ.js → record-artifact-L3CFJOMA.js} +2 -2
- package/chunks/{report-findings-W6GR7SYZ.js → report-findings-LY5HQY4K.js} +3 -3
- package/chunks/{resumeHistoryUtils-RB52QOCH.js → resumeHistoryUtils-YPJU4XFE.js} +44 -47
- package/chunks/{ripGrep-O6QAFHQK.js → ripGrep-AAKMALLM.js} +7 -11
- package/chunks/{ru-7BNZFQKG.js → ru-RHEB3RNS.js} +11 -0
- package/chunks/{run-qwen-serve-5NO3TKUL.js → run-qwen-serve-ZVEKGS7Y.js} +177 -98
- package/chunks/{runtime-G2YUYMSZ.js → runtime-SJCRYNPA.js} +52 -55
- package/chunks/safe-mode-KLGUG54M.js +11 -0
- package/chunks/sandbox-UIXL423Z.js +146 -0
- package/chunks/sandboxConfig-CY343YNJ.js +114 -0
- package/chunks/{scheduled-tasks-HDHV3URA.js → scheduled-tasks-5UGBEVNZ.js} +50 -53
- package/chunks/{scheduler-6MDJX2ZK.js → scheduler-GCZYLZ2P.js} +41 -44
- package/chunks/{sdk-exporters-http-3R2TRQHE.js → sdk-exporters-http-DR4G663K.js} +1 -1
- package/chunks/{sdk-impl-4WF3VZ2F.js → sdk-impl-SJR26MQF.js} +3 -3
- package/chunks/{send-message-UMJKN27Q.js → send-message-DN76MXDX.js} +6 -6
- package/chunks/{serve-Z2EJQYKB.js → serve-2XXQLVK2.js} +48 -51
- package/chunks/{server-JTNBK3LH.js → server-UHMKPCAZ.js} +408 -211
- package/chunks/{session-5YK2BXH4.js → session-ZLUK7E4P.js} +108 -108
- package/chunks/{session-attachments-root-QO3VFJS6.js → session-attachments-root-DHQM5IEZ.js} +39 -42
- package/chunks/{session-pr-refresh-OTK3HCJZ.js → session-pr-refresh-3OMTQWCZ.js} +48 -51
- package/chunks/{settings-2VKLACYV.js → settings-P4DHIIUP.js} +50 -53
- package/chunks/{shell-64NAVGMS.js → shell-IMFUVQQ5.js} +27 -30
- package/chunks/{skill-R3ALMLLM.js → skill-NB5RJGZW.js} +7 -11
- package/chunks/{skill-settings-HZ34TUMP.js → skill-settings-IXG5CTQO.js} +47 -50
- package/chunks/{spawnChannel-XGFWHEIK.js → spawnChannel-Q3YALTCJ.js} +44 -45
- package/chunks/{standalone-update-R32Y3XRR.js → standalone-update-H5OJ7MM7.js} +41 -44
- package/chunks/{start-opentui-ui-YGJOUE2H.js → start-opentui-ui-JKAIWGF7.js} +733 -386
- package/chunks/{startInteractiveUI-5ZEVKSFF.js → startInteractiveUI-YRPOT6GH.js} +370 -337
- package/chunks/task-create-75HVPEAH.js +1 -1
- package/chunks/{team-create-GCVUXJLE.js → team-create-2XTBYRJF.js} +31 -34
- package/chunks/{team-plan-approval-NOL62FJD.js → team-plan-approval-CFNWW7ZQ.js} +27 -30
- package/chunks/{terminal-image-renderer-WG5TLPGC.js → terminal-image-renderer-UDPJPGPQ.js} +39 -42
- package/chunks/{theme-manager-HDS4YFPW.js → theme-manager-SK57EKMO.js} +39 -42
- package/chunks/{tool-search-HMT5GYUR.js → tool-search-ZHTJU2MV.js} +5 -9
- package/chunks/{total-session-admission-Y5RCHEXO.js → total-session-admission-UUZBDQCG.js} +47 -50
- package/chunks/{tree-sitter-LSORDVZ3.js → tree-sitter-4D7QS7F6.js} +1 -1
- package/chunks/{tree-sitter-bash-UARELQ6C.js → tree-sitter-bash-VEJGF5XF.js} +1 -1
- package/chunks/{trustedFolders-3Y2WCXMR.js → trustedFolders-4LDBLNTS.js} +40 -43
- package/chunks/{update-relaunch-MTJ32SLF.js → update-relaunch-LI7GRP36.js} +5 -5
- package/chunks/{updateCheck-YFX3VY6O.js → updateCheck-PKSSORPO.js} +43 -46
- package/chunks/{useAutoAcceptIndicator-FCHNQPMD.js → useAutoAcceptIndicator-I32UEQPI.js} +50 -53
- package/chunks/{validateNonInterActiveAuth-HUFQKCGG.js → validateNonInterActiveAuth-YFPCYYNL.js} +93 -95
- package/chunks/{version-S5TGWCA3.js → version-4MTL4JVU.js} +1 -1
- package/chunks/{web-fetch-23M7BYHB.js → web-fetch-O6RG6ISB.js} +9 -13
- package/chunks/{web-search-F5PNIQUA.js → web-search-JHAXVEMD.js} +9 -14
- package/chunks/{web-shell-static-T7UGLVE4.js → web-shell-static-FFWCUUZS.js} +8 -4
- package/chunks/{workflow-BLJLID2C.js → workflow-O7L6VDYU.js} +396 -113
- package/chunks/{workspace-providers-status-UH7KLZDT.js → workspace-providers-status-WRX6CJM4.js} +53 -56
- package/chunks/{workspace-registration-store-3SA3V7BA.js → workspace-registration-store-7G4E7YPY.js} +1 -1
- package/chunks/{workspace-registry-C6C6EKQ5.js → workspace-registry-SXIMGT4D.js} +47 -50
- package/chunks/{workspace-runtime-coordinator-RAI6XDJB.js → workspace-runtime-coordinator-7DOEHXYT.js} +47 -50
- package/chunks/{workspace-service-H7UTJYJU.js → workspace-service-HDXOZMYC.js} +53 -56
- package/chunks/{workspace-skills-status-FPVC7XXK.js → workspace-skills-status-VN4L37CA.js} +50 -53
- package/chunks/{workspace-trust-reconciler-JS7A6UIF.js → workspace-trust-reconciler-XEBW5FUL.js} +57 -60
- package/chunks/{write-file-GQGG7NBQ.js → write-file-LKX4ETIO.js} +29 -32
- package/chunks/{zh-V2EYTYJP.js → zh-F76MZTL3.js} +23 -1
- package/chunks/{zh-TW-7PRVUGLW.js → zh-TW-S3YTQ4DS.js} +23 -1
- package/chunks/{zoom-image-EC43KL4H.js → zoom-image-RDPRTP4B.js} +5 -9
- package/cli.js +19 -15
- package/export-transcript-document.css +1 -1
- package/export-transcript-document.js +151 -150
- package/locales/ca.js +19 -2
- package/locales/de.js +18 -0
- package/locales/en.js +33 -2
- package/locales/fr.js +18 -0
- package/locales/ja.js +18 -0
- package/locales/pt.js +18 -0
- package/locales/ru.js +18 -0
- package/locales/zh-TW.js +33 -2
- package/locales/zh.js +33 -2
- package/package.json +3 -3
- package/web-shell/assets/{abnfDiagram-VCTEODGH-BtpzKw3A.js → abnfDiagram-VCTEODGH-RxykUDmi.js} +1 -1
- package/web-shell/assets/{arc-CQiVKZJP.js → arc-CZpgGCJC.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-ekIPBb2d.js → architectureDiagram-5GKGNRK7-BHSMzNDT.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-BrRWkWri.js → blockDiagram-NRAW4CY4-Bn4mF9SZ.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-qYS8CYZ3.js → c4Diagram-UCG6FXSJ-CBM-Bj6t.js} +1 -1
- package/web-shell/assets/channel-DFYs_LlK.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-ZasyyEZm.js → chunk-2Q5K7J3B-D5Fin58O.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-C_IzCGeA.js → chunk-5VM5RSS4-CY05weF7.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-C25NZOyD.js → chunk-F27PBJKO-3neZnj5Y.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-XPOHNSGX.js → chunk-G27WJ6UU-Cd7EU4BE.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-BQBh0Xni.js → chunk-JWPE2WC7-DwK1mqFw.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-CoShjpX7.js → chunk-LCL6LL3I-Sl7vY22C.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-BwRmCDSz.js → chunk-POPQ4Y6H-BXNzpbVg.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-DSzE5-Mw.js → chunk-SVP7TREG-DjjButcp.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-BQSQv30h.js → chunk-XXDRQBXY-DNOiCjOJ.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-DnGrKXoM.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-DnGrKXoM.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-XVUVTHVo.js → cose-bilkent-JH36ORCC-BUnker7a.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-CrsKx4lQ.js → cynefin-OW5HDTMX-DcUgdWE5.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-BPeZEuHw.js → cynefinDiagram-5FMLGOSQ-CvDKsZsL.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-D31cQ2Qs.js → dagre-3AP2YEHR-jpCmUbr1.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-zyiG097Q.js → diagram-S7CK7UJ4-DBe_bKE5.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-Br3vtfsy.js → diagram-UQ7AKVKN-oXvPpDgs.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-Bxkhjx4u.js → diagram-VSXAHHWV-BD7-_SGh.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-BQH8QiDk.js → diagram-VX7I27RA-DOJL0wub.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-B_aQ1cw0.js → diagram-Z3DM3KII-DRIiodDD.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-B9N7BRQE.js → ebnfDiagram-PWID7BFC-Db31Ulmb.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-Cx6Hb1Re.js → erDiagram-SSCWMZ5O-CVHhwI2_.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-DTuLP7GU.js → flowDiagram-A5DVABFB-DWOFy1FK.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-DYS3d-sL.js → ganttDiagram-EL5Y4UJY-C0sxQtPd.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-Cp0EGx04.js → gitGraphDiagram-WWUBYQGX-CNituBYC.js} +1 -1
- package/web-shell/assets/index-B15NlwB8.js +2213 -0
- package/web-shell/assets/index-BSrS0tQ6.css +36 -0
- package/web-shell/assets/{index-45-LkPDB.js → index-gm9tLk7h.js} +1 -1
- package/web-shell/assets/{infoDiagram-RXCK75RN-9--kukiT.js → infoDiagram-RXCK75RN-CxhJYtIR.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-CGBdsDLD.js → ishikawaDiagram-5VMMS53U-By2mchUy.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-DeXhcscd.js → journeyDiagram-EYS64GPL-CVH-OweI.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-CFdvsU3b.js → kanban-definition-3QL26DDD-Cc9dQXLy.js} +1 -1
- package/web-shell/assets/knowledge-Dg9788h4.svg +1 -0
- package/web-shell/assets/{layout-DAnwQ3KB.js → layout-C_60ysHw.js} +1 -1
- package/web-shell/assets/{linear-CTo7v7Nh.js → linear-BvAVfqwu.js} +1 -1
- package/web-shell/assets/{mermaid.core-jggSxF1i.js → mermaid.core-C3CoBKAc.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-DzIepvlJ.js → mindmap-definition-FBJOCRG2-Cuu8Q8LM.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-BFGS9GJv.js → pegDiagram-XKGWAZYB-DmAeyDO2.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-B2UUcNIT.js → pieDiagram-E7YTZNPT-B7vbB_xv.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-BgM6htrX.js → quadrantDiagram-AXDQQJYC-BqOBkRR7.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-Dk9cS7N-.js → railroadDiagram-O6MQD6OU-sI06lZIu.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-C9oRg7xi.js → requirementDiagram-EFPCY7ZU-Bg13d10S.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-B-_c7GzI.js → sankeyDiagram-P5KCCOFB-WFOzZHrR.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-R0M-347u.js → sequenceDiagram-WJ2MYXX4-CCdRbA4E.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-Df0f8UAW.js → sizeCapture-X5ZJPWSS-BH5F3bGg.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-CsUEfAA-.js → stateDiagram-HBIQ2CUA-NwS2X3QB.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-1aU2JZXO.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-9OGHVSrx.js → swimlanes-XN3QIQJK-Bm38pM28.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-Dp-u6kQG.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-DAfGqS2B.js → timeline-definition-24CTP7MA-Do-agLSo.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-CKATpwHi.js → vennDiagram-4TSXK5OY-aggLfZzl.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-CQHdhTrm.js → wardleyDiagram-VM6X3IG4-D5JR3mXX.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-5k9NLqlY.js → xychartDiagram-S5SC5T6Z-DhtLDuXs.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/chunk-4OQSG35W.js +0 -1416
- package/chunks/chunk-7MIBD3LG.js +0 -137
- package/chunks/chunk-ARDHE6MM.js +0 -235
- package/chunks/chunk-C75BXMPM.js +0 -169
- package/chunks/chunk-ERU3SDXT.js +0 -27
- package/chunks/chunk-FPGTNKCP.js +0 -251
- package/chunks/chunk-JIJ65YKA.js +0 -2812
- package/chunks/chunk-JL6APGBX.js +0 -43
- package/chunks/chunk-SGXJQP5Q.js +0 -4172
- package/chunks/chunk-TPEV2QHG.js +0 -514
- package/chunks/chunk-YVWS4SLL.js +0 -137
- package/web-shell/assets/channel-DSQQnOZj.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-V94ta08R.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-V94ta08R.js +0 -1
- package/web-shell/assets/index-H8um-iEl.js +0 -2207
- package/web-shell/assets/index-n6N-2a3v.css +0 -36
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-CnSuTPJ2.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-Bb7TcWQw.js +0 -8
- package/chunks/{chunk-QZW6WRB7.js → chunk-5NUKK2DT.js} +2 -2
- package/chunks/{chunk-JS73NNWF.js → chunk-FUSEMYFX.js} +0 -0
- package/chunks/{chunk-SVWWF5TZ.js → chunk-WVURIAEE.js} +3 -3
- package/chunks/{task-update-RI7QNVDP.js → task-update-3LSYQDRW.js} +4 -4
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import {
|
|
4
4
|
ClientSideConnection,
|
|
5
5
|
PROTOCOL_VERSION,
|
|
6
|
+
RequestError,
|
|
6
7
|
ndJsonStream
|
|
7
8
|
} from "./chunk-IJOS26LH.js";
|
|
8
9
|
import {
|
|
@@ -461,6 +462,18 @@ init_esbuild_shims();
|
|
|
461
462
|
var CHANNEL_PROMPT_DISPLAY_TEXT_META_KEY = "qwen.daemon.promptDisplayText";
|
|
462
463
|
var CHANNEL_PROMPT_AUTHORIZATION_META_KEY = "qwen.daemon.channelPromptAuthorization";
|
|
463
464
|
var CHANNEL_PROMPT_META_KEY = "qwen.channel.prompt";
|
|
465
|
+
var CHANNEL_OUTPUT_MODE_META_KEY = "qwen.channel.outputMode";
|
|
466
|
+
var CHANNEL_TASK_RESULT_META_KEY = "qwen.channel.taskResult";
|
|
467
|
+
var CHANNEL_TASK_RESULT_PARTIAL_META_KEY = "qwen.channel.taskResultPartial";
|
|
468
|
+
var CHANNEL_TASK_OUTPUT_META_KEY = "qwen.channel.taskOutput";
|
|
469
|
+
var ChannelPromptCancelledError = class extends Error {
|
|
470
|
+
static {
|
|
471
|
+
__name(this, "ChannelPromptCancelledError");
|
|
472
|
+
}
|
|
473
|
+
constructor() {
|
|
474
|
+
super("Channel task cancelled");
|
|
475
|
+
}
|
|
476
|
+
};
|
|
464
477
|
var CHANNEL_BTW_METHOD = "qwen/control/session/btw";
|
|
465
478
|
var ACP_PRIVATE_PARENT_CAPABILITY_META_KEY = "qwen-code/private-parent-capability";
|
|
466
479
|
var ACP_PRIVATE_PARENT_CAPABILITY_ENV = "QWEN_CODE_PRIVATE_ACP_CAPABILITY";
|
|
@@ -857,22 +870,32 @@ var AcpBridge = class extends EventEmitter {
|
|
|
857
870
|
}
|
|
858
871
|
prompt.push({ type: "text", text });
|
|
859
872
|
try {
|
|
860
|
-
await conn.prompt({
|
|
873
|
+
const result = await conn.prompt({
|
|
861
874
|
sessionId,
|
|
862
875
|
prompt,
|
|
863
876
|
_meta: {
|
|
864
877
|
[CHANNEL_PROMPT_META_KEY]: true,
|
|
878
|
+
...options?.outputMode === "per_task" ? { [CHANNEL_OUTPUT_MODE_META_KEY]: "per_task" } : {},
|
|
865
879
|
...options?.displayText !== void 0 ? {
|
|
866
880
|
[CHANNEL_PROMPT_DISPLAY_TEXT_META_KEY]: options.displayText
|
|
867
881
|
} : {}
|
|
868
882
|
}
|
|
869
883
|
});
|
|
884
|
+
if (options?.outputMode === "per_task" && result?.stopReason === "cancelled") {
|
|
885
|
+
throw new ChannelPromptCancelledError();
|
|
886
|
+
}
|
|
887
|
+
const taskResult = result?._meta?.[CHANNEL_TASK_RESULT_META_KEY];
|
|
888
|
+
if (options?.outputMode === "per_task") {
|
|
889
|
+
options.onTaskResult?.({
|
|
890
|
+
partial: result?._meta?.[CHANNEL_TASK_RESULT_PARTIAL_META_KEY] === true
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
return options?.outputMode === "per_task" && typeof taskResult === "string" && taskResult.trim() ? taskResult : chunks.join("") || slashCommandOutput;
|
|
870
894
|
} finally {
|
|
871
895
|
this.off("textChunk", onChunk);
|
|
872
896
|
this.off("slashCommandOutput", onSlashCommandOutput);
|
|
873
897
|
this.off("responseBoundary", clearChunks);
|
|
874
898
|
}
|
|
875
|
-
return chunks.join("") || slashCommandOutput;
|
|
876
899
|
}
|
|
877
900
|
async btw(sessionId, question, signal) {
|
|
878
901
|
if (!this.knownSessionIds.has(sessionId)) {
|
|
@@ -957,7 +980,7 @@ var AcpBridge = class extends EventEmitter {
|
|
|
957
980
|
}
|
|
958
981
|
const content = update["content"];
|
|
959
982
|
if (meta?.["qwenDiscreteMessage"] === true) {
|
|
960
|
-
if (meta["source"] === "background_notification_response" && meta["rewritten"] !== true) {
|
|
983
|
+
if (meta["source"] === "background_notification_response" && meta["rewritten"] !== true && meta[CHANNEL_TASK_OUTPUT_META_KEY] !== true) {
|
|
961
984
|
const context = parseBackgroundResponseContext(meta["backgroundTask"]);
|
|
962
985
|
if (content?.type === "text" && (content.text || context?.turnComplete)) {
|
|
963
986
|
this.emit("backgroundResponse", sessionId, content.text ?? "", context);
|
|
@@ -1149,7 +1172,7 @@ var AcpBridge = class extends EventEmitter {
|
|
|
1149
1172
|
hasQueuedPrompt: false
|
|
1150
1173
|
};
|
|
1151
1174
|
}
|
|
1152
|
-
throw
|
|
1175
|
+
throw RequestError.methodNotFound(method);
|
|
1153
1176
|
}
|
|
1154
1177
|
async handleClientMcpMessage(params) {
|
|
1155
1178
|
if (!this.channelLoopMcpServer) {
|
|
@@ -1230,6 +1253,35 @@ function formatSkippedRegistrationReason(result) {
|
|
|
1230
1253
|
}
|
|
1231
1254
|
__name(formatSkippedRegistrationReason, "formatSkippedRegistrationReason");
|
|
1232
1255
|
|
|
1256
|
+
// packages/channels/base/dist/output-mode.js
|
|
1257
|
+
init_esbuild_shims();
|
|
1258
|
+
var DEFAULT_CHANNEL_OUTPUT_MODE = "per_turn";
|
|
1259
|
+
var CHANNEL_OUTPUT_MODE_FIELD = {
|
|
1260
|
+
key: "outputMode",
|
|
1261
|
+
label: "Output Mode",
|
|
1262
|
+
kind: "enum",
|
|
1263
|
+
default: DEFAULT_CHANNEL_OUTPUT_MODE,
|
|
1264
|
+
description: "Choose one final result for the complete task, each complete assistant response, or the last reply in each turn. Defaults to per turn: the main response finishes independently of background follow-ups. Applies to cards and ordinary messages.",
|
|
1265
|
+
options: [
|
|
1266
|
+
{ value: "per_task", label: "Per task" },
|
|
1267
|
+
{ value: "per_response", label: "Per response" },
|
|
1268
|
+
{ value: "per_turn", label: "Per turn (default)" }
|
|
1269
|
+
]
|
|
1270
|
+
};
|
|
1271
|
+
function parseChannelOutputMode(name, value, supportsOutputMode) {
|
|
1272
|
+
if (value === void 0) {
|
|
1273
|
+
return supportsOutputMode ? DEFAULT_CHANNEL_OUTPUT_MODE : void 0;
|
|
1274
|
+
}
|
|
1275
|
+
if (!supportsOutputMode) {
|
|
1276
|
+
throw new Error(`Channel "${name}" does not support outputMode.`);
|
|
1277
|
+
}
|
|
1278
|
+
if (value !== "per_task" && value !== "per_response" && value !== "per_turn") {
|
|
1279
|
+
throw new Error(`Channel "${name}" outputMode must be "per_task", "per_response", or "per_turn".`);
|
|
1280
|
+
}
|
|
1281
|
+
return value;
|
|
1282
|
+
}
|
|
1283
|
+
__name(parseChannelOutputMode, "parseChannelOutputMode");
|
|
1284
|
+
|
|
1233
1285
|
// packages/channels/base/dist/index.js
|
|
1234
1286
|
init_esbuild_shims();
|
|
1235
1287
|
|
|
@@ -2130,7 +2182,7 @@ var SessionRouter = class {
|
|
|
2130
2182
|
* heals it through the superseded redirect — the failed reset drops the
|
|
2131
2183
|
* old id from the live set so that load consults the daemon again.
|
|
2132
2184
|
*/
|
|
2133
|
-
async replaceManagedWorktreeSession(sessionId, target, workspaceCwd, expectedCwd) {
|
|
2185
|
+
async replaceManagedWorktreeSession(sessionId, target, workspaceCwd, expectedCwd, beforeForget) {
|
|
2134
2186
|
const bridge = this.bridge;
|
|
2135
2187
|
if (!bridge.resetWorktreeSession) {
|
|
2136
2188
|
throw new Error("Worktree reset is not supported by this bridge");
|
|
@@ -2156,6 +2208,7 @@ var SessionRouter = class {
|
|
|
2156
2208
|
this.toTarget.set(replacementId, target);
|
|
2157
2209
|
this.toCwd.set(replacementId, actualCwd);
|
|
2158
2210
|
this.liveSessionIds.add(replacementId);
|
|
2211
|
+
beforeForget?.();
|
|
2159
2212
|
this.forgetManagedSession(sessionId);
|
|
2160
2213
|
return replacementId;
|
|
2161
2214
|
} catch (error) {
|
|
@@ -2224,13 +2277,14 @@ var SessionRouter = class {
|
|
|
2224
2277
|
if (changed)
|
|
2225
2278
|
this.persist();
|
|
2226
2279
|
}
|
|
2227
|
-
async detachManagedSession(sessionId) {
|
|
2280
|
+
async detachManagedSession(sessionId, beforeForget) {
|
|
2228
2281
|
try {
|
|
2229
2282
|
if (this.bridge.discardSession) {
|
|
2230
2283
|
await this.bridge.discardSession(sessionId);
|
|
2231
2284
|
} else if (this.liveSessionIds.has(sessionId)) {
|
|
2232
2285
|
throw new Error("Managed session detach is not supported");
|
|
2233
2286
|
}
|
|
2287
|
+
beforeForget?.();
|
|
2234
2288
|
} finally {
|
|
2235
2289
|
this.forgetManagedSession(sessionId);
|
|
2236
2290
|
}
|
|
@@ -2730,6 +2784,7 @@ var NamedSessionManager = class {
|
|
|
2730
2784
|
filePath;
|
|
2731
2785
|
router;
|
|
2732
2786
|
isBusy;
|
|
2787
|
+
onSessionRetiring;
|
|
2733
2788
|
now;
|
|
2734
2789
|
registry;
|
|
2735
2790
|
taskBySessionId;
|
|
@@ -2747,6 +2802,7 @@ var NamedSessionManager = class {
|
|
|
2747
2802
|
this.filePath = options.filePath;
|
|
2748
2803
|
this.router = options.router;
|
|
2749
2804
|
this.isBusy = options.isBusy;
|
|
2805
|
+
this.onSessionRetiring = options.onSessionRetiring;
|
|
2750
2806
|
this.now = options.now ?? Date.now;
|
|
2751
2807
|
this.registry = this.readRegistry();
|
|
2752
2808
|
this.taskBySessionId = this.buildTaskIndex(this.registry);
|
|
@@ -2986,7 +3042,7 @@ var NamedSessionManager = class {
|
|
|
2986
3042
|
this.router.activateManagedSession(replacementSessionId ?? replacement.sessionId, replacement.target, replacement.cwd, { isolation: replacement.isolation, workspaceCwd: this.cwd });
|
|
2987
3043
|
}
|
|
2988
3044
|
try {
|
|
2989
|
-
await this.router.detachManagedSession(task.sessionId);
|
|
3045
|
+
await this.router.detachManagedSession(task.sessionId, () => this.onSessionRetiring?.(task.sessionId));
|
|
2990
3046
|
} catch (error) {
|
|
2991
3047
|
const healedReplacement = replacement !== void 0 && replacementSessionId !== void 0 && replacementSessionId !== replacement.sessionId ? { ...replacement, sessionId: replacementSessionId } : void 0;
|
|
2992
3048
|
this.commitOwner(healedReplacement ? this.replaceTask(owner, healedReplacement, owner.activeTaskName) : owner);
|
|
@@ -3059,6 +3115,7 @@ var NamedSessionManager = class {
|
|
|
3059
3115
|
throw error;
|
|
3060
3116
|
}
|
|
3061
3117
|
this.router.activateManagedSession(sessionId, updatedTask.target, updatedTask.cwd, { isolation: updatedTask.isolation, workspaceCwd: this.cwd });
|
|
3118
|
+
this.onSessionRetiring?.(task.sessionId);
|
|
3062
3119
|
this.router.forgetManagedSession(task.sessionId);
|
|
3063
3120
|
this.repointSupersededSessionIds(task.sessionId, sessionId);
|
|
3064
3121
|
this.supersededSessionIds.delete(task.sessionId);
|
|
@@ -3225,7 +3282,7 @@ var NamedSessionManager = class {
|
|
|
3225
3282
|
}
|
|
3226
3283
|
async resetWorktreeSession(task) {
|
|
3227
3284
|
try {
|
|
3228
|
-
return await this.router.replaceManagedWorktreeSession(task.sessionId, task.target, this.cwd, task.cwd);
|
|
3285
|
+
return await this.router.replaceManagedWorktreeSession(task.sessionId, task.target, this.cwd, task.cwd, () => this.onSessionRetiring?.(task.sessionId));
|
|
3229
3286
|
} catch (error) {
|
|
3230
3287
|
throw new NamedSessionTaskError(`Could not reset task "${task.name}".`, task.name, { cause: error });
|
|
3231
3288
|
}
|
|
@@ -4332,6 +4389,14 @@ var ChannelBase = class {
|
|
|
4332
4389
|
}
|
|
4333
4390
|
await this.deliverBackgroundResponseToTarget(sessionId, text, delivery);
|
|
4334
4391
|
}
|
|
4392
|
+
getBackgroundResponseSourceLabel(sessionId) {
|
|
4393
|
+
const target = this.router.getTarget(sessionId);
|
|
4394
|
+
const presentation = this.namedSessions?.presentation(sessionId);
|
|
4395
|
+
if (!target || target.channelName !== this.name || !this.router.isSessionLive(sessionId) || !presentation || presentation.status !== "open" || !this.sameTaskOwner(target, presentation.target)) {
|
|
4396
|
+
return void 0;
|
|
4397
|
+
}
|
|
4398
|
+
return this.createSourceLabel(presentation, target);
|
|
4399
|
+
}
|
|
4335
4400
|
async resolveBackgroundResponseDelivery(sessionId) {
|
|
4336
4401
|
let target = this.router.getTarget(sessionId);
|
|
4337
4402
|
if (!target || target.channelName !== this.name)
|
|
@@ -4863,7 +4928,8 @@ No answer is available from the current conversation context.`;
|
|
|
4863
4928
|
cwd: config.cwd,
|
|
4864
4929
|
filePath: join5(options.stateDir, "named-sessions.json"),
|
|
4865
4930
|
router: this.router,
|
|
4866
|
-
isBusy: /* @__PURE__ */ __name((sessionId) => this.isNamedSessionBusy(sessionId), "isBusy")
|
|
4931
|
+
isBusy: /* @__PURE__ */ __name((sessionId) => this.isNamedSessionBusy(sessionId), "isBusy"),
|
|
4932
|
+
onSessionRetiring: /* @__PURE__ */ __name((sessionId) => this.onSessionRetiring(sessionId), "onSessionRetiring")
|
|
4867
4933
|
});
|
|
4868
4934
|
}
|
|
4869
4935
|
this.registerSharedCommands();
|
|
@@ -5787,9 +5853,13 @@ ${promptText}` : promptText;
|
|
|
5787
5853
|
active.cancelPending = false;
|
|
5788
5854
|
}).then((cancelSucceeded) => {
|
|
5789
5855
|
const turnEnded = this.activePrompts.get(sessionId) !== active;
|
|
5790
|
-
if (!cancelSucceeded || active.deliveryStarted || turnEnded && !active.cancelled) {
|
|
5856
|
+
if (!cancelSucceeded || active.deliveryStarted || turnEnded && !active.cancelled && !active.cancellationEmitted) {
|
|
5791
5857
|
return false;
|
|
5792
5858
|
}
|
|
5859
|
+
if (turnEnded) {
|
|
5860
|
+
this.emitTaskCancellation(active, sessionId, reason);
|
|
5861
|
+
return true;
|
|
5862
|
+
}
|
|
5793
5863
|
active.cancelled = true;
|
|
5794
5864
|
this.dropCollectBuffer(sessionId);
|
|
5795
5865
|
this.removePendingPermissionsForSession(sessionId, "run_cancelled");
|
|
@@ -6525,7 +6595,6 @@ ${requestList}`);
|
|
|
6525
6595
|
const result = await namedSessions.close(owner, parts[0]);
|
|
6526
6596
|
if (closing) {
|
|
6527
6597
|
this.cancelBtw(closing.sessionId);
|
|
6528
|
-
this.onSessionRetiring(closing.sessionId);
|
|
6529
6598
|
}
|
|
6530
6599
|
await this.sendThreadMessage(envelope.chatId, envelope.threadId, result.active ? `Closed task "${result.closed.name}". Selected "${result.active.name}".` : `Closed task "${result.closed.name}". No task is selected.`);
|
|
6531
6600
|
return true;
|
|
@@ -6595,8 +6664,9 @@ ${requestList}`);
|
|
|
6595
6664
|
this.clearPendingGroupHistory(envelope);
|
|
6596
6665
|
if (removedIds.length > 0) {
|
|
6597
6666
|
for (const id of removedIds) {
|
|
6598
|
-
if (id !== retiringSessionId)
|
|
6667
|
+
if (!this.namedSessions && id !== retiringSessionId) {
|
|
6599
6668
|
this.onSessionRetiring(id);
|
|
6669
|
+
}
|
|
6600
6670
|
this.cancelBtw(id);
|
|
6601
6671
|
if (this.isSharedSession(envelope)) {
|
|
6602
6672
|
const who = sanitizeSenderName(envelope.senderName || envelope.senderId || "unknown");
|
|
@@ -8451,8 +8521,15 @@ ${promptToSend}`;
|
|
|
8451
8521
|
const promptBridge = this.bridge;
|
|
8452
8522
|
promptBridge.on("textChunk", onChunk);
|
|
8453
8523
|
promptBridge.on("responseBoundary", onResponseBoundary);
|
|
8524
|
+
let taskResultPartial = false;
|
|
8454
8525
|
try {
|
|
8455
8526
|
const response = await promptBridge.prompt(sessionId, promptToSend, {
|
|
8527
|
+
...this.config.outputMode === "per_task" ? {
|
|
8528
|
+
outputMode: "per_task",
|
|
8529
|
+
onTaskResult: /* @__PURE__ */ __name(({ partial }) => {
|
|
8530
|
+
taskResultPartial = partial;
|
|
8531
|
+
}, "onTaskResult")
|
|
8532
|
+
} : {},
|
|
8456
8533
|
...images.length > 0 ? { images } : {},
|
|
8457
8534
|
imageBase64,
|
|
8458
8535
|
imageMimeType,
|
|
@@ -8467,6 +8544,8 @@ ${promptToSend}`;
|
|
|
8467
8544
|
if (!promptState.cancelled && response) {
|
|
8468
8545
|
promptState.deliveryStarted = true;
|
|
8469
8546
|
const segment = this.ensureOutputSegment(sessionId, promptState);
|
|
8547
|
+
if (segment && taskResultPartial)
|
|
8548
|
+
segment.partial = true;
|
|
8470
8549
|
await this.onResponseComplete(envelope.chatId, response, sessionId, segment);
|
|
8471
8550
|
if (segment && promptState.activeSegmentId === segment.segmentId) {
|
|
8472
8551
|
promptState.activeSegmentId = void 0;
|
|
@@ -8484,10 +8563,14 @@ ${promptToSend}`;
|
|
|
8484
8563
|
});
|
|
8485
8564
|
}
|
|
8486
8565
|
} catch (err) {
|
|
8566
|
+
const runtimeCancelled = !promptState.deliveryStarted && err instanceof ChannelPromptCancelledError;
|
|
8487
8567
|
if (!promptState.deliveryStarted) {
|
|
8488
8568
|
await this.settleCancelRequested(promptState);
|
|
8569
|
+
if (runtimeCancelled) {
|
|
8570
|
+
this.emitTaskCancellation(promptState, sessionId, "runtime_cancelled");
|
|
8571
|
+
}
|
|
8489
8572
|
}
|
|
8490
|
-
if (!promptState.cancelled) {
|
|
8573
|
+
if (!promptState.cancelled && !runtimeCancelled) {
|
|
8491
8574
|
releaseHeldChunks();
|
|
8492
8575
|
const segment = this.closeOutputSegment(sessionId, promptState);
|
|
8493
8576
|
void this.notifyOutputSegmentEnd(envelope.chatId, sessionId, segment, "failed");
|
|
@@ -8504,7 +8587,7 @@ ${promptToSend}`;
|
|
|
8504
8587
|
process.stderr.write(`[${channel}] turn ${safeMessageId} threw after cancellation for session ${safeSessionId}: ${this.lifecycleError(err)}
|
|
8505
8588
|
`);
|
|
8506
8589
|
}
|
|
8507
|
-
if (promptState.cancelled) {
|
|
8590
|
+
if (promptState.cancelled || runtimeCancelled) {
|
|
8508
8591
|
return;
|
|
8509
8592
|
}
|
|
8510
8593
|
if (sourceLabel) {
|
|
@@ -8825,6 +8908,7 @@ var DaemonChannelBridge = class extends EventEmitter2 {
|
|
|
8825
8908
|
requestToSession = /* @__PURE__ */ new Map();
|
|
8826
8909
|
respondedRequestToSession = /* @__PURE__ */ new Map();
|
|
8827
8910
|
activePrompts = /* @__PURE__ */ new Set();
|
|
8911
|
+
taskOutputs = /* @__PURE__ */ new Map();
|
|
8828
8912
|
activePromptControllers = /* @__PURE__ */ new Map();
|
|
8829
8913
|
availableCommandsBySession = /* @__PURE__ */ new Map();
|
|
8830
8914
|
toolCallKindsBySession = /* @__PURE__ */ new Map();
|
|
@@ -8987,6 +9071,9 @@ var DaemonChannelBridge = class extends EventEmitter2 {
|
|
|
8987
9071
|
throw new Error(`Prompt already in flight for daemon session ${sessionId}`);
|
|
8988
9072
|
}
|
|
8989
9073
|
this.activePrompts.add(sessionId);
|
|
9074
|
+
const taskOutput = options?.outputMode === "per_task" ? {} : void 0;
|
|
9075
|
+
if (taskOutput)
|
|
9076
|
+
this.taskOutputs.set(sessionId, taskOutput);
|
|
8990
9077
|
const controller = new AbortController();
|
|
8991
9078
|
let controllers = this.activePromptControllers.get(sessionId);
|
|
8992
9079
|
if (!controllers) {
|
|
@@ -9103,6 +9190,7 @@ var DaemonChannelBridge = class extends EventEmitter2 {
|
|
|
9103
9190
|
prompt,
|
|
9104
9191
|
_meta: {
|
|
9105
9192
|
[CHANNEL_PROMPT_META_KEY]: true,
|
|
9193
|
+
...options?.outputMode === "per_task" ? { [CHANNEL_OUTPUT_MODE_META_KEY]: "per_task" } : {},
|
|
9106
9194
|
...promptAuthorization ? {
|
|
9107
9195
|
[CHANNEL_PROMPT_AUTHORIZATION_META_KEY]: promptAuthorization
|
|
9108
9196
|
} : {},
|
|
@@ -9121,7 +9209,13 @@ var DaemonChannelBridge = class extends EventEmitter2 {
|
|
|
9121
9209
|
turnBarrier,
|
|
9122
9210
|
new Promise((resolve3) => setTimeout(resolve3, 0))
|
|
9123
9211
|
]);
|
|
9124
|
-
|
|
9212
|
+
if (options?.outputMode === "per_task" && result.stopReason === "cancelled") {
|
|
9213
|
+
throw new ChannelPromptCancelledError();
|
|
9214
|
+
}
|
|
9215
|
+
if (taskOutput) {
|
|
9216
|
+
options?.onTaskResult?.({ partial: taskOutput.partial === true });
|
|
9217
|
+
}
|
|
9218
|
+
const textResult = taskOutput?.text || chunks.join("") || slashCommandOutput;
|
|
9125
9219
|
this.emit("promptComplete", {
|
|
9126
9220
|
sessionId,
|
|
9127
9221
|
text: textResult,
|
|
@@ -9135,6 +9229,9 @@ var DaemonChannelBridge = class extends EventEmitter2 {
|
|
|
9135
9229
|
this.off("responseBoundary", clearChunks);
|
|
9136
9230
|
this.off("sessionDied", onSessionDied);
|
|
9137
9231
|
this.activePrompts.delete(sessionId);
|
|
9232
|
+
if (this.taskOutputs.get(sessionId) === taskOutput) {
|
|
9233
|
+
this.taskOutputs.delete(sessionId);
|
|
9234
|
+
}
|
|
9138
9235
|
controllers.delete(controller);
|
|
9139
9236
|
if (controllers.size === 0 && this.activePromptControllers.get(sessionId) === controllers) {
|
|
9140
9237
|
this.activePromptControllers.delete(sessionId);
|
|
@@ -9322,6 +9419,8 @@ var DaemonChannelBridge = class extends EventEmitter2 {
|
|
|
9322
9419
|
this.dropSession(session.sessionId, this.getStringField(event.data, "error", "stream_error"));
|
|
9323
9420
|
break;
|
|
9324
9421
|
case "turn_complete":
|
|
9422
|
+
if (isRecord3(event.data) && event.data["backgroundTurn"])
|
|
9423
|
+
break;
|
|
9325
9424
|
this.resolveTurnBarrier(session.sessionId);
|
|
9326
9425
|
break;
|
|
9327
9426
|
case "turn_error":
|
|
@@ -9347,7 +9446,21 @@ var DaemonChannelBridge = class extends EventEmitter2 {
|
|
|
9347
9446
|
}
|
|
9348
9447
|
const text = getTextContent(update["content"]);
|
|
9349
9448
|
if (meta?.["qwenDiscreteMessage"] === true) {
|
|
9350
|
-
if (meta["source"] === "background_notification_response" && meta["rewritten"] !== true) {
|
|
9449
|
+
if (meta["source"] === "background_notification_response" && meta["rewritten"] !== true && meta[CHANNEL_TASK_OUTPUT_META_KEY] === true) {
|
|
9450
|
+
const taskOutput = this.taskOutputs.get(sessionId);
|
|
9451
|
+
if (taskOutput) {
|
|
9452
|
+
const context = parseBackgroundResponseContext(meta["backgroundTask"]);
|
|
9453
|
+
if (text?.trim()) {
|
|
9454
|
+
taskOutput.text = text;
|
|
9455
|
+
taskOutput.turnId = context?.turnId;
|
|
9456
|
+
taskOutput.partial = context?.partial === true;
|
|
9457
|
+
} else if (context?.turnComplete && context.turnId !== void 0 && context.turnId === taskOutput.turnId) {
|
|
9458
|
+
taskOutput.partial = context.partial === true;
|
|
9459
|
+
}
|
|
9460
|
+
}
|
|
9461
|
+
break;
|
|
9462
|
+
}
|
|
9463
|
+
if (meta["source"] === "background_notification_response" && meta["rewritten"] !== true && meta[CHANNEL_TASK_OUTPUT_META_KEY] !== true) {
|
|
9351
9464
|
const context = parseBackgroundResponseContext(meta["backgroundTask"]);
|
|
9352
9465
|
if (text || context?.turnComplete) {
|
|
9353
9466
|
this.emit("backgroundResponse", sessionId, text ?? "", context);
|
|
@@ -9810,6 +9923,620 @@ function isTerminalTaskLifecycleType(type) {
|
|
|
9810
9923
|
}
|
|
9811
9924
|
__name(isTerminalTaskLifecycleType, "isTerminalTaskLifecycleType");
|
|
9812
9925
|
|
|
9926
|
+
// packages/channels/base/dist/output-turn.js
|
|
9927
|
+
init_esbuild_shims();
|
|
9928
|
+
var ChannelOutputTurn = class {
|
|
9929
|
+
static {
|
|
9930
|
+
__name(this, "ChannelOutputTurn");
|
|
9931
|
+
}
|
|
9932
|
+
mode;
|
|
9933
|
+
lastOutput;
|
|
9934
|
+
finished = false;
|
|
9935
|
+
constructor(mode = DEFAULT_CHANNEL_OUTPUT_MODE) {
|
|
9936
|
+
this.mode = mode;
|
|
9937
|
+
}
|
|
9938
|
+
get latestOnly() {
|
|
9939
|
+
return this.mode === "per_turn" || this.mode === "per_task";
|
|
9940
|
+
}
|
|
9941
|
+
shouldPreview(text) {
|
|
9942
|
+
return !this.finished && text.trim() !== "";
|
|
9943
|
+
}
|
|
9944
|
+
close(text, reason) {
|
|
9945
|
+
if (this.finished)
|
|
9946
|
+
return { kind: "skip" };
|
|
9947
|
+
if (reason === "failed" || reason === "cancelled") {
|
|
9948
|
+
this.lastOutput = void 0;
|
|
9949
|
+
return { kind: reason };
|
|
9950
|
+
}
|
|
9951
|
+
if (!text.trim()) {
|
|
9952
|
+
if (reason === "response_boundary" || !this.latestOnly) {
|
|
9953
|
+
return { kind: "skip" };
|
|
9954
|
+
}
|
|
9955
|
+
text = this.lastOutput ?? "";
|
|
9956
|
+
if (!text.trim())
|
|
9957
|
+
return { kind: "skip" };
|
|
9958
|
+
}
|
|
9959
|
+
if (reason === "response_boundary" && this.mode !== "per_response") {
|
|
9960
|
+
this.lastOutput = text;
|
|
9961
|
+
return {
|
|
9962
|
+
kind: "preview",
|
|
9963
|
+
text
|
|
9964
|
+
};
|
|
9965
|
+
}
|
|
9966
|
+
this.lastOutput = void 0;
|
|
9967
|
+
return { kind: "complete", text, rotate: reason !== "completed" };
|
|
9968
|
+
}
|
|
9969
|
+
finish(terminal) {
|
|
9970
|
+
const output = terminal === "completed" ? this.lastOutput : void 0;
|
|
9971
|
+
this.lastOutput = void 0;
|
|
9972
|
+
this.finished = true;
|
|
9973
|
+
return output;
|
|
9974
|
+
}
|
|
9975
|
+
};
|
|
9976
|
+
|
|
9977
|
+
// packages/channels/base/dist/background-output-coordinator.js
|
|
9978
|
+
init_esbuild_shims();
|
|
9979
|
+
var BACKGROUND_OUTPUT_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
9980
|
+
var BACKGROUND_OUTPUT_RETRY_MS = 30 * 1e3;
|
|
9981
|
+
var BACKGROUND_OUTPUT_MAX_RETRIES = 3;
|
|
9982
|
+
var BackgroundOutputCoordinator = class {
|
|
9983
|
+
static {
|
|
9984
|
+
__name(this, "BackgroundOutputCoordinator");
|
|
9985
|
+
}
|
|
9986
|
+
options;
|
|
9987
|
+
backgroundResponseAggregations = /* @__PURE__ */ new Map();
|
|
9988
|
+
detachedBackgroundResponseAggregations = /* @__PURE__ */ new Set();
|
|
9989
|
+
pendingBackgroundResponseTerminals = /* @__PURE__ */ new Map();
|
|
9990
|
+
detachedPendingBackgroundResponseTerminals = /* @__PURE__ */ new Set();
|
|
9991
|
+
constructor(options) {
|
|
9992
|
+
this.options = options;
|
|
9993
|
+
}
|
|
9994
|
+
/** False leaves delivery to the adapter's immediate response path. */
|
|
9995
|
+
async dispatch(sessionId, text, context) {
|
|
9996
|
+
if (this.options.outputMode !== "per_turn" && this.options.outputMode !== "per_task" || !context || typeof context.turnComplete !== "boolean") {
|
|
9997
|
+
return false;
|
|
9998
|
+
}
|
|
9999
|
+
await this.collect(sessionId, text, context);
|
|
10000
|
+
return true;
|
|
10001
|
+
}
|
|
10002
|
+
async collect(sessionId, text, context) {
|
|
10003
|
+
const target = this.options.getTarget(sessionId);
|
|
10004
|
+
if (!target)
|
|
10005
|
+
return;
|
|
10006
|
+
const key = JSON.stringify([
|
|
10007
|
+
sessionId,
|
|
10008
|
+
context.kind,
|
|
10009
|
+
context.taskId,
|
|
10010
|
+
context.turnId
|
|
10011
|
+
]);
|
|
10012
|
+
let current = this.backgroundResponseAggregations.get(key);
|
|
10013
|
+
let parked = this.pendingBackgroundResponseTerminals.get(key);
|
|
10014
|
+
if (current?.turnComplete === true) {
|
|
10015
|
+
this.detachedBackgroundResponseAggregations.add(current);
|
|
10016
|
+
this.backgroundResponseAggregations.delete(key);
|
|
10017
|
+
current = void 0;
|
|
10018
|
+
}
|
|
10019
|
+
if (!current && (parked?.turnEnded === true || parked?.turnComplete === true && (parked.retryTimer || parked.retryInFlight || parked.resolvers > 0))) {
|
|
10020
|
+
if (!parked.turnEnded) {
|
|
10021
|
+
this.detachedPendingBackgroundResponseTerminals.add(parked);
|
|
10022
|
+
}
|
|
10023
|
+
parked = {
|
|
10024
|
+
sessionId,
|
|
10025
|
+
target,
|
|
10026
|
+
sourceLabel: this.options.getSourceLabel?.(sessionId),
|
|
10027
|
+
resolvers: 0,
|
|
10028
|
+
held: []
|
|
10029
|
+
};
|
|
10030
|
+
this.pendingBackgroundResponseTerminals.set(key, parked);
|
|
10031
|
+
}
|
|
10032
|
+
if (!current && text.trim().length === 0) {
|
|
10033
|
+
if (!parked || parked.resolvers === 0 && !parked.retryTimer && !parked.retryInFlight && !parked.resolutionDropped && !parked.turnComplete) {
|
|
10034
|
+
if (parked)
|
|
10035
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10036
|
+
return;
|
|
10037
|
+
}
|
|
10038
|
+
if (context.turnComplete) {
|
|
10039
|
+
parked.turnComplete = true;
|
|
10040
|
+
parked.status = context.status;
|
|
10041
|
+
parked.label = context.label ?? parked.label;
|
|
10042
|
+
parked.completionPartial = context.partial === true;
|
|
10043
|
+
if (parked.resolvers === 0 && !parked.retryTimer && !parked.retryInFlight && (parked.retryAttempts ?? 0) >= BACKGROUND_OUTPUT_MAX_RETRIES) {
|
|
10044
|
+
parked.turnEnded = true;
|
|
10045
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10046
|
+
}
|
|
10047
|
+
}
|
|
10048
|
+
return;
|
|
10049
|
+
}
|
|
10050
|
+
if (!current) {
|
|
10051
|
+
parked ??= {
|
|
10052
|
+
sessionId,
|
|
10053
|
+
target,
|
|
10054
|
+
sourceLabel: this.options.getSourceLabel?.(sessionId),
|
|
10055
|
+
resolvers: 0,
|
|
10056
|
+
held: []
|
|
10057
|
+
};
|
|
10058
|
+
this.pendingBackgroundResponseTerminals.set(key, parked);
|
|
10059
|
+
this.holdPendingBackgroundResponse(parked, text, context);
|
|
10060
|
+
parked.resolvers++;
|
|
10061
|
+
try {
|
|
10062
|
+
let delivery;
|
|
10063
|
+
try {
|
|
10064
|
+
delivery = await this.options.resolveDelivery(sessionId);
|
|
10065
|
+
} catch (error) {
|
|
10066
|
+
if (parked.resolvers === 1 && !this.backgroundResponseAggregations.has(key)) {
|
|
10067
|
+
this.scheduleBackgroundResponseResolutionRetry(key, sessionId, parked);
|
|
10068
|
+
} else {
|
|
10069
|
+
const existing = this.backgroundResponseAggregations.get(key);
|
|
10070
|
+
if (existing) {
|
|
10071
|
+
if (parked.held.length > 0) {
|
|
10072
|
+
this.applyHeldBackgroundResponses(existing, parked);
|
|
10073
|
+
}
|
|
10074
|
+
this.applyPendingBackgroundResponseTerminal(existing, parked);
|
|
10075
|
+
if (parked.resolvers === 1) {
|
|
10076
|
+
if (existing.turnComplete) {
|
|
10077
|
+
await this.completeBackgroundResponseAggregation(key, existing);
|
|
10078
|
+
} else {
|
|
10079
|
+
this.scheduleBackgroundResponseAggregationFlush(key, existing);
|
|
10080
|
+
}
|
|
10081
|
+
}
|
|
10082
|
+
}
|
|
10083
|
+
}
|
|
10084
|
+
throw error;
|
|
10085
|
+
}
|
|
10086
|
+
if (!delivery || this.options.getTarget(sessionId) !== delivery.target) {
|
|
10087
|
+
if (parked.resolvers === 1 && !this.backgroundResponseAggregations.has(key)) {
|
|
10088
|
+
this.scheduleBackgroundResponseResolutionRetry(key, sessionId, parked);
|
|
10089
|
+
} else {
|
|
10090
|
+
const existing = this.backgroundResponseAggregations.get(key);
|
|
10091
|
+
if (existing) {
|
|
10092
|
+
if (parked.held.length > 0) {
|
|
10093
|
+
this.applyHeldBackgroundResponses(existing, parked);
|
|
10094
|
+
}
|
|
10095
|
+
this.applyPendingBackgroundResponseTerminal(existing, parked);
|
|
10096
|
+
if (parked.resolvers === 1) {
|
|
10097
|
+
if (existing.turnComplete) {
|
|
10098
|
+
await this.completeBackgroundResponseAggregation(key, existing);
|
|
10099
|
+
} else {
|
|
10100
|
+
this.scheduleBackgroundResponseAggregationFlush(key, existing);
|
|
10101
|
+
}
|
|
10102
|
+
}
|
|
10103
|
+
}
|
|
10104
|
+
}
|
|
10105
|
+
return;
|
|
10106
|
+
}
|
|
10107
|
+
if (parked.retiring || parked.turnEnded === true || this.pendingBackgroundResponseTerminals.get(key) !== parked) {
|
|
10108
|
+
await this.flushDetachedBackgroundResponse(key, sessionId, parked, delivery);
|
|
10109
|
+
return;
|
|
10110
|
+
}
|
|
10111
|
+
parked.sourceLabel = delivery.sourceLabel;
|
|
10112
|
+
if (parked.retryTimer) {
|
|
10113
|
+
clearTimeout(parked.retryTimer);
|
|
10114
|
+
parked.retryTimer = void 0;
|
|
10115
|
+
}
|
|
10116
|
+
current = this.backgroundResponseAggregations.get(key) ?? this.createBackgroundResponseAggregation(key, sessionId, parked.held[0]?.context ?? context, delivery.target, delivery.sourceLabel);
|
|
10117
|
+
this.applyHeldBackgroundResponses(current, parked);
|
|
10118
|
+
this.applyPendingBackgroundResponseTerminal(current, parked);
|
|
10119
|
+
if (parked.resolutionDropped) {
|
|
10120
|
+
current.resolutionDropped = true;
|
|
10121
|
+
parked.resolutionDropped = void 0;
|
|
10122
|
+
}
|
|
10123
|
+
} finally {
|
|
10124
|
+
parked.resolvers--;
|
|
10125
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === parked && parked.resolvers === 0 && !parked.retryTimer && parked.held.length === 0 && (!parked.resolutionDropped || parked.turnEnded)) {
|
|
10126
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10127
|
+
}
|
|
10128
|
+
}
|
|
10129
|
+
if (!current)
|
|
10130
|
+
return;
|
|
10131
|
+
if (current.turnComplete && parked.resolvers > 0)
|
|
10132
|
+
return;
|
|
10133
|
+
if (!current.turnComplete) {
|
|
10134
|
+
this.scheduleBackgroundResponseAggregationFlush(key, current);
|
|
10135
|
+
} else {
|
|
10136
|
+
await this.completeBackgroundResponseAggregation(key, current);
|
|
10137
|
+
}
|
|
10138
|
+
return;
|
|
10139
|
+
}
|
|
10140
|
+
current.status = context.status;
|
|
10141
|
+
current.label = context.label ?? current.label;
|
|
10142
|
+
if (text.trim())
|
|
10143
|
+
current.text = text;
|
|
10144
|
+
if (context.turnComplete && parked && parked.resolvers > 0) {
|
|
10145
|
+
parked.turnComplete = true;
|
|
10146
|
+
parked.status = context.status;
|
|
10147
|
+
parked.label = context.label ?? parked.label;
|
|
10148
|
+
parked.completionPartial = context.partial === true;
|
|
10149
|
+
} else if (context.turnComplete) {
|
|
10150
|
+
current.turnComplete = true;
|
|
10151
|
+
current.completionPartial = context.partial === true;
|
|
10152
|
+
} else if (parked?.turnComplete && parked.resolvers === 0) {
|
|
10153
|
+
current.turnComplete = true;
|
|
10154
|
+
current.status = parked.status ?? current.status;
|
|
10155
|
+
current.label = parked.label ?? current.label;
|
|
10156
|
+
current.completionPartial = parked.completionPartial === true;
|
|
10157
|
+
}
|
|
10158
|
+
current.resolutionDropped ||= parked?.resolutionDropped;
|
|
10159
|
+
if (!current.turnComplete) {
|
|
10160
|
+
this.scheduleBackgroundResponseAggregationFlush(key, current);
|
|
10161
|
+
return;
|
|
10162
|
+
}
|
|
10163
|
+
await this.completeBackgroundResponseAggregation(key, current);
|
|
10164
|
+
}
|
|
10165
|
+
flushBackgroundResponseAggregation(key, aggregation) {
|
|
10166
|
+
if (aggregation.flushing)
|
|
10167
|
+
return Promise.resolve();
|
|
10168
|
+
const flushing = this.flushBackgroundResponseAggregationInner(key, aggregation).finally(() => {
|
|
10169
|
+
if (aggregation.flushing === flushing)
|
|
10170
|
+
aggregation.flushing = void 0;
|
|
10171
|
+
});
|
|
10172
|
+
aggregation.flushing = flushing;
|
|
10173
|
+
return flushing;
|
|
10174
|
+
}
|
|
10175
|
+
async flushBackgroundResponseAggregationInner(key, aggregation) {
|
|
10176
|
+
if (this.backgroundResponseAggregations.get(key) !== aggregation && !this.detachedBackgroundResponseAggregations.has(aggregation)) {
|
|
10177
|
+
return;
|
|
10178
|
+
}
|
|
10179
|
+
if (aggregation.retryTimer)
|
|
10180
|
+
clearTimeout(aggregation.retryTimer);
|
|
10181
|
+
aggregation.retryTimer = void 0;
|
|
10182
|
+
let delivery = aggregation.delivery;
|
|
10183
|
+
if (!delivery) {
|
|
10184
|
+
if (!aggregation.text) {
|
|
10185
|
+
if (!this.owesTerminalBackgroundResponse(aggregation)) {
|
|
10186
|
+
if (aggregation.retiring || aggregation.turnComplete) {
|
|
10187
|
+
this.removeBackgroundResponseAggregation(key, aggregation);
|
|
10188
|
+
} else {
|
|
10189
|
+
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
10190
|
+
}
|
|
10191
|
+
return;
|
|
10192
|
+
}
|
|
10193
|
+
}
|
|
10194
|
+
if (aggregation.timeoutTimer)
|
|
10195
|
+
clearTimeout(aggregation.timeoutTimer);
|
|
10196
|
+
aggregation.timeoutTimer = void 0;
|
|
10197
|
+
const text = aggregation.text;
|
|
10198
|
+
aggregation.text = "";
|
|
10199
|
+
delivery = {
|
|
10200
|
+
status: aggregation.status,
|
|
10201
|
+
kind: aggregation.kind,
|
|
10202
|
+
label: aggregation.label,
|
|
10203
|
+
text,
|
|
10204
|
+
partial: this.isPartialBackgroundResponseDelivery(aggregation, text.length > 0),
|
|
10205
|
+
attempts: 0,
|
|
10206
|
+
send: this.options.createDelivery(aggregation.sessionId, {
|
|
10207
|
+
target: aggregation.target,
|
|
10208
|
+
sourceLabel: aggregation.sourceLabel
|
|
10209
|
+
})
|
|
10210
|
+
};
|
|
10211
|
+
aggregation.delivery = delivery;
|
|
10212
|
+
}
|
|
10213
|
+
let error;
|
|
10214
|
+
let composedTurnComplete = false;
|
|
10215
|
+
try {
|
|
10216
|
+
const result = await delivery.send({
|
|
10217
|
+
status: delivery.status,
|
|
10218
|
+
kind: delivery.kind,
|
|
10219
|
+
label: delivery.label,
|
|
10220
|
+
text: delivery.text,
|
|
10221
|
+
partial: delivery.partial,
|
|
10222
|
+
turnComplete: aggregation.turnComplete === true
|
|
10223
|
+
});
|
|
10224
|
+
composedTurnComplete = result.turnComplete;
|
|
10225
|
+
} catch (caught) {
|
|
10226
|
+
error = caught;
|
|
10227
|
+
}
|
|
10228
|
+
if (error === void 0) {
|
|
10229
|
+
aggregation.delivery = void 0;
|
|
10230
|
+
aggregation.delivered = true;
|
|
10231
|
+
if (composedTurnComplete && aggregation.turnComplete && delivery.partial !== true && !aggregation.retiring) {
|
|
10232
|
+
aggregation.completionDelivered = true;
|
|
10233
|
+
}
|
|
10234
|
+
if (aggregation.retiring || aggregation.turnComplete) {
|
|
10235
|
+
await this.flushBackgroundResponseAggregationInner(key, aggregation);
|
|
10236
|
+
} else {
|
|
10237
|
+
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
10238
|
+
}
|
|
10239
|
+
return;
|
|
10240
|
+
}
|
|
10241
|
+
delivery.attempts++;
|
|
10242
|
+
this.options.log(`background response delivery failed (attempt ${delivery.attempts}): ${sanitizeLogText(error instanceof Error ? error.message : String(error), 300)}
|
|
10243
|
+
`);
|
|
10244
|
+
if (aggregation.retiring || delivery.attempts >= BACKGROUND_OUTPUT_MAX_RETRIES || // A permanently rejected send cannot
|
|
10245
|
+
// succeed later; retrying it only spends the chat's send quota.
|
|
10246
|
+
!this.options.isRetryableError(error)) {
|
|
10247
|
+
aggregation.delivery = void 0;
|
|
10248
|
+
aggregation.dropped = true;
|
|
10249
|
+
if (!aggregation.text) {
|
|
10250
|
+
if (aggregation.retiring || aggregation.turnComplete) {
|
|
10251
|
+
this.removeBackgroundResponseAggregation(key, aggregation);
|
|
10252
|
+
} else {
|
|
10253
|
+
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
10254
|
+
}
|
|
10255
|
+
} else if (aggregation.retiring || aggregation.turnComplete) {
|
|
10256
|
+
await this.flushBackgroundResponseAggregationInner(key, aggregation);
|
|
10257
|
+
} else {
|
|
10258
|
+
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
10259
|
+
}
|
|
10260
|
+
return;
|
|
10261
|
+
}
|
|
10262
|
+
aggregation.retryTimer = setTimeout(() => {
|
|
10263
|
+
aggregation.retryTimer = void 0;
|
|
10264
|
+
void this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10265
|
+
}, BACKGROUND_OUTPUT_RETRY_MS);
|
|
10266
|
+
aggregation.retryTimer.unref?.();
|
|
10267
|
+
}
|
|
10268
|
+
/**
|
|
10269
|
+
* A delivery is partial whenever it is not the turn's whole output: the
|
|
10270
|
+
* turn is still open, earlier text already went out (or was given up on),
|
|
10271
|
+
* or the turn itself ended early.
|
|
10272
|
+
*/
|
|
10273
|
+
isPartialBackgroundResponseDelivery(aggregation, hasText) {
|
|
10274
|
+
return hasText && (aggregation.delivered === true || aggregation.dropped === true || aggregation.resolutionDropped === true || aggregation.retiring === true || aggregation.completionPartial === true || aggregation.turnComplete !== true);
|
|
10275
|
+
}
|
|
10276
|
+
/**
|
|
10277
|
+
* If a turn outlives the bounded wait, its final empty marker still needs
|
|
10278
|
+
* a terminal delivery so recipients learn that the partial output finished.
|
|
10279
|
+
*/
|
|
10280
|
+
owesTerminalBackgroundResponse(aggregation) {
|
|
10281
|
+
return aggregation.turnComplete === true && aggregation.delivered === true && aggregation.completionDelivered !== true && aggregation.retiring !== true && aggregation.completionPartial !== true && aggregation.dropped !== true && aggregation.resolutionDropped !== true;
|
|
10282
|
+
}
|
|
10283
|
+
removeBackgroundResponseAggregation(key, aggregation) {
|
|
10284
|
+
if (this.backgroundResponseAggregations.get(key) === aggregation) {
|
|
10285
|
+
this.backgroundResponseAggregations.delete(key);
|
|
10286
|
+
}
|
|
10287
|
+
this.detachedBackgroundResponseAggregations.delete(aggregation);
|
|
10288
|
+
}
|
|
10289
|
+
drain(sessionId) {
|
|
10290
|
+
const flushes = [];
|
|
10291
|
+
for (const [key, pending] of this.pendingBackgroundResponseTerminals) {
|
|
10292
|
+
if (sessionId !== void 0 && pending.sessionId !== sessionId)
|
|
10293
|
+
continue;
|
|
10294
|
+
if (pending.retryTimer)
|
|
10295
|
+
clearTimeout(pending.retryTimer);
|
|
10296
|
+
pending.retryTimer = void 0;
|
|
10297
|
+
pending.retiring = true;
|
|
10298
|
+
pending.turnComplete = true;
|
|
10299
|
+
pending.completionPartial = true;
|
|
10300
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10301
|
+
this.detachedPendingBackgroundResponseTerminals.add(pending);
|
|
10302
|
+
}
|
|
10303
|
+
for (const pending of this.detachedPendingBackgroundResponseTerminals) {
|
|
10304
|
+
if (sessionId !== void 0 && pending.sessionId !== sessionId)
|
|
10305
|
+
continue;
|
|
10306
|
+
if (pending.retryTimer)
|
|
10307
|
+
clearTimeout(pending.retryTimer);
|
|
10308
|
+
pending.retryTimer = void 0;
|
|
10309
|
+
pending.retiring = true;
|
|
10310
|
+
pending.turnComplete = true;
|
|
10311
|
+
pending.completionPartial = true;
|
|
10312
|
+
if (pending.held.length > 0 && this.options.getTarget(pending.sessionId) === pending.target) {
|
|
10313
|
+
flushes.push(this.flushDetachedBackgroundResponse("", pending.sessionId, pending, {
|
|
10314
|
+
target: pending.target,
|
|
10315
|
+
sourceLabel: pending.sourceLabel
|
|
10316
|
+
}));
|
|
10317
|
+
} else if (pending.held.length > 0) {
|
|
10318
|
+
this.options.log(`background response target unavailable during drain; ${pending.held.length} buffered segment(s) discarded
|
|
10319
|
+
`);
|
|
10320
|
+
pending.held.length = 0;
|
|
10321
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10322
|
+
} else if (pending.held.length === 0) {
|
|
10323
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10324
|
+
}
|
|
10325
|
+
}
|
|
10326
|
+
const aggregations = /* @__PURE__ */ new Set([
|
|
10327
|
+
...this.backgroundResponseAggregations.values(),
|
|
10328
|
+
...this.detachedBackgroundResponseAggregations
|
|
10329
|
+
]);
|
|
10330
|
+
for (const aggregation of aggregations) {
|
|
10331
|
+
if (sessionId !== void 0 && aggregation.sessionId !== sessionId) {
|
|
10332
|
+
continue;
|
|
10333
|
+
}
|
|
10334
|
+
if (aggregation.timeoutTimer)
|
|
10335
|
+
clearTimeout(aggregation.timeoutTimer);
|
|
10336
|
+
if (aggregation.retryTimer)
|
|
10337
|
+
clearTimeout(aggregation.retryTimer);
|
|
10338
|
+
aggregation.timeoutTimer = void 0;
|
|
10339
|
+
aggregation.retryTimer = void 0;
|
|
10340
|
+
aggregation.retiring = true;
|
|
10341
|
+
aggregation.turnComplete = true;
|
|
10342
|
+
aggregation.completionPartial = true;
|
|
10343
|
+
flushes.push(aggregation.flushing ?? this.flushBackgroundResponseAggregation(aggregation.key, aggregation));
|
|
10344
|
+
}
|
|
10345
|
+
return Promise.allSettled(flushes).then((results) => {
|
|
10346
|
+
for (const result of results) {
|
|
10347
|
+
if (result.status === "rejected") {
|
|
10348
|
+
const error = result.reason;
|
|
10349
|
+
this.options.log(`background response delivery failed during drain: ${sanitizeLogText(error instanceof Error ? error.message : String(error), 300)}
|
|
10350
|
+
`);
|
|
10351
|
+
}
|
|
10352
|
+
}
|
|
10353
|
+
});
|
|
10354
|
+
}
|
|
10355
|
+
createBackgroundResponseAggregation(key, sessionId, context, target, sourceLabel) {
|
|
10356
|
+
const aggregation = {
|
|
10357
|
+
key,
|
|
10358
|
+
sessionId,
|
|
10359
|
+
target,
|
|
10360
|
+
sourceLabel,
|
|
10361
|
+
status: context.status,
|
|
10362
|
+
kind: context.kind,
|
|
10363
|
+
label: context.label,
|
|
10364
|
+
text: ""
|
|
10365
|
+
};
|
|
10366
|
+
this.backgroundResponseAggregations.set(key, aggregation);
|
|
10367
|
+
return aggregation;
|
|
10368
|
+
}
|
|
10369
|
+
scheduleBackgroundResponseResolutionRetry(key, sessionId, pending) {
|
|
10370
|
+
if (pending.retiring)
|
|
10371
|
+
return;
|
|
10372
|
+
if (pending.retryTimer)
|
|
10373
|
+
return;
|
|
10374
|
+
pending.retryAttempts = (pending.retryAttempts ?? 0) + 1;
|
|
10375
|
+
if (pending.retryAttempts >= BACKGROUND_OUTPUT_MAX_RETRIES) {
|
|
10376
|
+
this.options.log(`background response target unresolved after ${pending.retryAttempts} attempts; ${pending.held.length} buffered segment(s) discarded
|
|
10377
|
+
`);
|
|
10378
|
+
pending.resolutionDropped = true;
|
|
10379
|
+
pending.turnEnded = pending.turnComplete === true;
|
|
10380
|
+
pending.held.length = 0;
|
|
10381
|
+
pending.turnComplete = void 0;
|
|
10382
|
+
pending.status = void 0;
|
|
10383
|
+
pending.label = void 0;
|
|
10384
|
+
pending.completionPartial = void 0;
|
|
10385
|
+
if (pending.turnEnded) {
|
|
10386
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10387
|
+
}
|
|
10388
|
+
return;
|
|
10389
|
+
}
|
|
10390
|
+
pending.retryTimer = setTimeout(() => {
|
|
10391
|
+
pending.retryTimer = void 0;
|
|
10392
|
+
pending.retryInFlight = true;
|
|
10393
|
+
void this.retryBackgroundResponseResolution(key, sessionId, pending).catch((error) => {
|
|
10394
|
+
this.options.log(`background response target resolution failed: ${sanitizeLogText(error instanceof Error ? error.message : String(error), 300)}
|
|
10395
|
+
`);
|
|
10396
|
+
}).finally(() => {
|
|
10397
|
+
pending.retryInFlight = false;
|
|
10398
|
+
if (pending.retiring || !pending.retryTimer && !pending.resolutionDropped) {
|
|
10399
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10400
|
+
}
|
|
10401
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === pending && pending.resolvers === 0 && !pending.retryTimer && pending.held.length === 0 && (!pending.resolutionDropped || pending.turnEnded)) {
|
|
10402
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10403
|
+
}
|
|
10404
|
+
});
|
|
10405
|
+
}, BACKGROUND_OUTPUT_RETRY_MS);
|
|
10406
|
+
pending.retryTimer.unref?.();
|
|
10407
|
+
const active = this.pendingBackgroundResponseTerminals.get(key);
|
|
10408
|
+
if (!active || active === pending) {
|
|
10409
|
+
this.pendingBackgroundResponseTerminals.set(key, pending);
|
|
10410
|
+
}
|
|
10411
|
+
}
|
|
10412
|
+
async retryBackgroundResponseResolution(key, sessionId, pending) {
|
|
10413
|
+
let delivery;
|
|
10414
|
+
try {
|
|
10415
|
+
delivery = await this.options.resolveDelivery(sessionId);
|
|
10416
|
+
} catch (error) {
|
|
10417
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === pending && !this.backgroundResponseAggregations.has(key) || this.detachedPendingBackgroundResponseTerminals.has(pending)) {
|
|
10418
|
+
this.scheduleBackgroundResponseResolutionRetry(key, sessionId, pending);
|
|
10419
|
+
}
|
|
10420
|
+
throw error;
|
|
10421
|
+
}
|
|
10422
|
+
if (!delivery || this.options.getTarget(sessionId) !== delivery.target) {
|
|
10423
|
+
if (pending.retiring) {
|
|
10424
|
+
if (pending.held.length > 0) {
|
|
10425
|
+
this.options.log(`background response target unavailable during drain; ${pending.held.length} buffered segment(s) discarded
|
|
10426
|
+
`);
|
|
10427
|
+
}
|
|
10428
|
+
pending.held.length = 0;
|
|
10429
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10430
|
+
return;
|
|
10431
|
+
}
|
|
10432
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === pending && !this.backgroundResponseAggregations.has(key) || this.detachedPendingBackgroundResponseTerminals.has(pending)) {
|
|
10433
|
+
this.scheduleBackgroundResponseResolutionRetry(key, sessionId, pending);
|
|
10434
|
+
}
|
|
10435
|
+
return;
|
|
10436
|
+
}
|
|
10437
|
+
if (pending.retiring || this.pendingBackgroundResponseTerminals.get(key) !== pending || pending.turnComplete) {
|
|
10438
|
+
await this.flushDetachedBackgroundResponse(key, sessionId, pending, delivery);
|
|
10439
|
+
return;
|
|
10440
|
+
}
|
|
10441
|
+
const first = pending.held[0];
|
|
10442
|
+
if (!first)
|
|
10443
|
+
return;
|
|
10444
|
+
const aggregation = this.createBackgroundResponseAggregation(key, sessionId, first.context, delivery.target, delivery.sourceLabel);
|
|
10445
|
+
this.applyHeldBackgroundResponses(aggregation, pending);
|
|
10446
|
+
if (pending.resolutionDropped) {
|
|
10447
|
+
aggregation.resolutionDropped = true;
|
|
10448
|
+
pending.resolutionDropped = void 0;
|
|
10449
|
+
}
|
|
10450
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === pending) {
|
|
10451
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10452
|
+
}
|
|
10453
|
+
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
10454
|
+
}
|
|
10455
|
+
holdPendingBackgroundResponse(pending, text, context) {
|
|
10456
|
+
if (text.trim().length > 0)
|
|
10457
|
+
pending.held.push({ text, context });
|
|
10458
|
+
if (context.turnComplete) {
|
|
10459
|
+
pending.turnComplete = true;
|
|
10460
|
+
pending.status = context.status;
|
|
10461
|
+
pending.label = context.label ?? pending.label;
|
|
10462
|
+
pending.completionPartial = context.partial === true;
|
|
10463
|
+
}
|
|
10464
|
+
}
|
|
10465
|
+
applyHeldBackgroundResponses(aggregation, pending) {
|
|
10466
|
+
for (const { text, context } of pending.held.splice(0)) {
|
|
10467
|
+
aggregation.status = context.status;
|
|
10468
|
+
aggregation.label = context.label ?? aggregation.label;
|
|
10469
|
+
if (text.trim())
|
|
10470
|
+
aggregation.text = text;
|
|
10471
|
+
if (context.turnComplete) {
|
|
10472
|
+
aggregation.turnComplete = true;
|
|
10473
|
+
aggregation.completionPartial = context.partial === true;
|
|
10474
|
+
}
|
|
10475
|
+
}
|
|
10476
|
+
}
|
|
10477
|
+
applyPendingBackgroundResponseTerminal(aggregation, pending) {
|
|
10478
|
+
if (!pending.turnComplete)
|
|
10479
|
+
return;
|
|
10480
|
+
aggregation.turnComplete = true;
|
|
10481
|
+
aggregation.status = pending.status ?? aggregation.status;
|
|
10482
|
+
aggregation.label = pending.label ?? aggregation.label;
|
|
10483
|
+
aggregation.completionPartial = pending.completionPartial === true;
|
|
10484
|
+
pending.turnComplete = void 0;
|
|
10485
|
+
pending.status = void 0;
|
|
10486
|
+
pending.label = void 0;
|
|
10487
|
+
pending.completionPartial = void 0;
|
|
10488
|
+
}
|
|
10489
|
+
async completeBackgroundResponseAggregation(key, aggregation) {
|
|
10490
|
+
if (aggregation.delivery) {
|
|
10491
|
+
aggregation.delivery.status = aggregation.status;
|
|
10492
|
+
aggregation.delivery.label = aggregation.label ?? aggregation.delivery.label;
|
|
10493
|
+
aggregation.delivery.partial = this.isPartialBackgroundResponseDelivery(aggregation, aggregation.delivery.text.length > 0) || aggregation.text.length > 0;
|
|
10494
|
+
}
|
|
10495
|
+
if (aggregation.timeoutTimer)
|
|
10496
|
+
clearTimeout(aggregation.timeoutTimer);
|
|
10497
|
+
aggregation.timeoutTimer = void 0;
|
|
10498
|
+
await this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10499
|
+
}
|
|
10500
|
+
async flushDetachedBackgroundResponse(key, sessionId, pending, delivery) {
|
|
10501
|
+
const first = pending.held[0];
|
|
10502
|
+
if (!first) {
|
|
10503
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10504
|
+
return;
|
|
10505
|
+
}
|
|
10506
|
+
const aggregation = {
|
|
10507
|
+
key,
|
|
10508
|
+
sessionId,
|
|
10509
|
+
target: delivery.target,
|
|
10510
|
+
sourceLabel: delivery.sourceLabel,
|
|
10511
|
+
status: first.context.status,
|
|
10512
|
+
kind: first.context.kind,
|
|
10513
|
+
label: first.context.label,
|
|
10514
|
+
text: "",
|
|
10515
|
+
turnComplete: pending.turnComplete,
|
|
10516
|
+
completionPartial: pending.completionPartial,
|
|
10517
|
+
resolutionDropped: pending.resolutionDropped
|
|
10518
|
+
};
|
|
10519
|
+
this.applyHeldBackgroundResponses(aggregation, pending);
|
|
10520
|
+
aggregation.status = pending.status ?? aggregation.status;
|
|
10521
|
+
aggregation.label = pending.label ?? aggregation.label;
|
|
10522
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === pending) {
|
|
10523
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10524
|
+
}
|
|
10525
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10526
|
+
this.detachedBackgroundResponseAggregations.add(aggregation);
|
|
10527
|
+
await this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10528
|
+
}
|
|
10529
|
+
scheduleBackgroundResponseAggregationFlush(key, aggregation) {
|
|
10530
|
+
if (aggregation.timeoutTimer || aggregation.delivery)
|
|
10531
|
+
return;
|
|
10532
|
+
aggregation.timeoutTimer = setTimeout(() => {
|
|
10533
|
+
aggregation.timeoutTimer = void 0;
|
|
10534
|
+
void this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10535
|
+
}, BACKGROUND_OUTPUT_TIMEOUT_MS);
|
|
10536
|
+
aggregation.timeoutTimer.unref?.();
|
|
10537
|
+
}
|
|
10538
|
+
};
|
|
10539
|
+
|
|
9813
10540
|
export {
|
|
9814
10541
|
resolvePath,
|
|
9815
10542
|
getGlobalQwenDir,
|
|
@@ -9824,16 +10551,24 @@ export {
|
|
|
9824
10551
|
sanitizeDisplayText,
|
|
9825
10552
|
sanitizeLogText,
|
|
9826
10553
|
SessionRouter,
|
|
10554
|
+
CHANNEL_PROMPT_META_KEY,
|
|
10555
|
+
CHANNEL_OUTPUT_MODE_META_KEY,
|
|
10556
|
+
CHANNEL_TASK_RESULT_META_KEY,
|
|
10557
|
+
CHANNEL_TASK_RESULT_PARTIAL_META_KEY,
|
|
10558
|
+
CHANNEL_TASK_OUTPUT_META_KEY,
|
|
9827
10559
|
ChannelLoopScheduler,
|
|
9828
10560
|
ChannelBase,
|
|
9829
10561
|
PollingChannelBase,
|
|
9830
|
-
CHANNEL_PROMPT_META_KEY,
|
|
9831
10562
|
CHANNEL_LOOP_MCP_SERVER_NAME,
|
|
9832
10563
|
ACP_EVENT_LOOP_STALL_RESTART_MS,
|
|
9833
10564
|
AcpBridge,
|
|
9834
10565
|
DaemonChannelBridge,
|
|
9835
10566
|
ChannelLoopStore,
|
|
9836
|
-
isTerminalTaskLifecycleType
|
|
10567
|
+
isTerminalTaskLifecycleType,
|
|
10568
|
+
CHANNEL_OUTPUT_MODE_FIELD,
|
|
10569
|
+
parseChannelOutputMode,
|
|
10570
|
+
ChannelOutputTurn,
|
|
10571
|
+
BackgroundOutputCoordinator
|
|
9837
10572
|
};
|
|
9838
10573
|
/**
|
|
9839
10574
|
* @license
|