@qwen-code/qwen-code 0.21.6-preview.0 → 0.21.7
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/qc-helper/docs/configuration/settings.md +19 -9
- package/bundled/qc-helper/docs/features/channels/dingtalk.md +1 -1
- package/bundled/qc-helper/docs/features/channels/github.md +31 -19
- package/bundled/qc-helper/docs/features/code-review.md +30 -1
- package/bundled/qc-helper/docs/qwen-serve.md +1 -1
- package/bundled/review/SKILL.md +59 -22
- package/chunks/{MaxSizedBox-A3UYJS6B.js → MaxSizedBox-ANWZBPTS.js} +38 -38
- package/chunks/{StandaloneSessionPicker-NGLY26I4.js → StandaloneSessionPicker-XKS3VU3A.js} +56 -55
- package/chunks/{acp-startup-profiler-3RICG2YW.js → acp-startup-profiler-ORIQ2CCQ.js} +2 -2
- package/chunks/{acpAgent-V54T2EEL.js → acpAgent-KUAZ3GCZ.js} +1091 -150
- package/chunks/{agent-2P53VL2L.js → agent-T6PTGX5R.js} +35 -35
- package/chunks/{agent-headless-6X4GCFRD.js → agent-headless-PR7YCB7S.js} +35 -35
- package/chunks/{anthropicContentGenerator-3CAHEZBM.js → anthropicContentGenerator-DTMVEL5M.js} +7 -7
- package/chunks/{artifact-tool-RROCCJDA.js → artifact-tool-U4VOZIK5.js} +2 -2
- package/chunks/{askUserQuestion-2EPPBPUZ.js → askUserQuestion-XOBQLPFA.js} +2 -2
- package/chunks/{bridge-TCFMLKHR.js → bridge-NU6YEEHK.js} +41 -41
- package/chunks/{channel-management-service-5XPPTWUQ.js → channel-management-service-FSQ7SHYI.js} +1 -1
- package/chunks/{channel-settings-store-B4HNMNQV.js → channel-settings-store-35VQVUVV.js} +42 -42
- package/chunks/{channel-worker-group-SVGPDH2C.js → channel-worker-group-JWQK224X.js} +5 -5
- package/chunks/{channel-worker-manager-72ZK2GTS.js → channel-worker-manager-77E3OXRQ.js} +5 -5
- package/chunks/{channel-worker-supervisor-NUEDVHX4.js → channel-worker-supervisor-62YWUGP2.js} +3 -3
- package/chunks/{chunk-XC656O42.js → chunk-22NBYCPD.js} +3 -3
- package/chunks/{chunk-WXS647W5.js → chunk-23RZCH76.js} +3 -3
- package/chunks/{chunk-O656RSMC.js → chunk-2U3WZGZG.js} +18 -10
- package/chunks/chunk-2VSTGY6M.js +107 -0
- package/chunks/{chunk-AU3XNTMV.js → chunk-33ACCIIY.js} +3 -3
- package/chunks/{chunk-MBEMTXQT.js → chunk-3K7FH2KQ.js} +1 -32
- package/chunks/{chunk-CJBRIJ7W.js → chunk-3NB7TSE2.js} +3 -3
- package/chunks/{chunk-QYPT3QUD.js → chunk-3ULCB3NE.js} +3 -3
- package/chunks/{chunk-7FUVSN4D.js → chunk-55LYDVPU.js} +1 -1
- package/chunks/{chunk-3ZRS2XNY.js → chunk-5KH532V7.js} +1 -1
- package/chunks/{chunk-P7LKADIT.js → chunk-6EOI4HOK.js} +7 -7
- package/chunks/{chunk-X6DV3WKN.js → chunk-6GONZVLS.js} +1 -1
- package/chunks/{chunk-T4XY5CT4.js → chunk-6HVUFDS2.js} +7 -7
- package/chunks/{chunk-5L6CQ4ZU.js → chunk-6M26GBKX.js} +2 -2
- package/chunks/{chunk-SPUDIAHX.js → chunk-6UWFTUQL.js} +530 -388
- package/chunks/{chunk-EKWNNQQD.js → chunk-6XJMFJ4D.js} +16 -10
- package/chunks/{chunk-72DZPDH4.js → chunk-6XU3PH66.js} +10 -5
- package/chunks/{chunk-WIPQR44Y.js → chunk-72LNFGUY.js} +3 -3
- package/chunks/{chunk-33FNCQSY.js → chunk-7MH4J33A.js} +2 -2
- package/chunks/{chunk-2AGOQ7QO.js → chunk-7UFKAV7Y.js} +118 -6
- package/chunks/{chunk-HKNSU4WX.js → chunk-AE77C5ZU.js} +198 -35
- package/chunks/{chunk-JELIWHXD.js → chunk-AOHJKPKL.js} +1 -1
- package/chunks/{chunk-GLNBDYUX.js → chunk-AXMWHKXA.js} +6 -2
- package/chunks/{chunk-H36SETQS.js → chunk-B2GJNDTV.js} +1 -1
- package/chunks/{chunk-QMBEW7EW.js → chunk-BGG4MBYD.js} +2 -2
- package/chunks/{chunk-QL4TN4HS.js → chunk-BRVWYMKV.js} +1 -1
- package/chunks/{chunk-6WBWIPBF.js → chunk-BVWVWGLE.js} +2 -2
- package/chunks/{chunk-WPKIU4PA.js → chunk-CB2464BK.js} +6 -6
- package/chunks/{chunk-2UISUFHQ.js → chunk-CJXIIILK.js} +3 -3
- package/chunks/{chunk-WK4TJUEA.js → chunk-CKASRHZI.js} +1 -1
- package/chunks/{chunk-Z7JILXGX.js → chunk-CNIID3TV.js} +3 -3
- package/chunks/{chunk-6KEN3RIC.js → chunk-CSZEXZBE.js} +3 -3
- package/chunks/{chunk-KKN2IE7Q.js → chunk-CTJLZLB5.js} +1 -1
- package/chunks/{chunk-5CDI4UOY.js → chunk-CXE7E23H.js} +131 -48
- package/chunks/{chunk-URJHXOSO.js → chunk-CYR3HI5X.js} +3 -3
- package/chunks/{chunk-546CDN6D.js → chunk-DBOFL3LQ.js} +3 -3
- package/chunks/{chunk-4LKVQFHM.js → chunk-DREZZAZM.js} +2 -2
- package/chunks/{chunk-2U7GPHA6.js → chunk-E33LOKRA.js} +1 -1
- package/chunks/{chunk-2DNKEBXY.js → chunk-EI3HZX6C.js} +1 -1
- package/chunks/{chunk-U25CMJYY.js → chunk-EKPKKXY2.js} +1 -1
- package/chunks/{chunk-QG2ACINA.js → chunk-EORNAQDT.js} +1 -1
- package/chunks/{chunk-432XCUHF.js → chunk-EQL65XGA.js} +1 -1
- package/chunks/{chunk-TYERNYH4.js → chunk-EUNWC2VS.js} +2 -2
- package/chunks/{chunk-CDHNGCJI.js → chunk-EUQTXRKZ.js} +7 -7
- package/chunks/{chunk-UH7Z7Y45.js → chunk-FOGU3LJX.js} +1 -1
- package/chunks/{chunk-BU4BRCPX.js → chunk-FPM27XN4.js} +5 -5
- package/chunks/{chunk-E4WHKETF.js → chunk-FVKHVJZQ.js} +2 -49
- package/chunks/{chunk-NKST54XA.js → chunk-FZBZSYKU.js} +1 -1
- package/chunks/{chunk-XZCMQUOF.js → chunk-GDXET5XU.js} +31 -3387
- package/chunks/{chunk-A5YZ3FA2.js → chunk-GM463R2B.js} +1 -1
- package/chunks/{chunk-MOHAWIAW.js → chunk-GNPNYXJB.js} +2 -2
- package/chunks/{chunk-AFZTZLFB.js → chunk-GSS34377.js} +3 -3
- package/chunks/{chunk-MVLM6PJK.js → chunk-H2UQ2M5Z.js} +6 -2
- package/chunks/{chunk-BK2UNYWD.js → chunk-HIBNSEJE.js} +12 -0
- package/chunks/{chunk-CXYBX4AL.js → chunk-HQB2KUAN.js} +1 -1
- package/chunks/{chunk-ZQL73PPE.js → chunk-HYRDKNUY.js} +2 -2
- package/chunks/{chunk-D7D7RXIJ.js → chunk-IC4Z6LX6.js} +1 -1
- package/chunks/{chunk-HU5TUALO.js → chunk-IIJEYBNH.js} +3 -3
- package/chunks/{chunk-DTAPI453.js → chunk-IUFV6FYU.js} +2 -2
- package/chunks/{chunk-MISUEWB4.js → chunk-J6SZID63.js} +12 -8
- package/chunks/{chunk-OWAK7LMW.js → chunk-KGJGEEVR.js} +7 -0
- package/chunks/{chunk-BFHXDAR7.js → chunk-KKBPOU75.js} +1 -1
- package/chunks/{chunk-XOZ2R6XI.js → chunk-KKJJB5X6.js} +3578 -1487
- package/chunks/{chunk-PQTK2FVO.js → chunk-KR4ZSC7K.js} +4 -4
- package/chunks/{chunk-NAYPZ72V.js → chunk-KXSDEOFU.js} +1 -1
- package/chunks/{chunk-MGSSJT27.js → chunk-L4N6TIP7.js} +5 -3
- package/chunks/{chunk-4T6QMNX2.js → chunk-LA7YLSR6.js} +185 -12
- package/chunks/{chunk-4E5PO6R7.js → chunk-LEMXGVEP.js} +4 -4
- package/chunks/{chunk-WVAESIM6.js → chunk-LZC3B5N2.js} +4 -4
- package/chunks/{chunk-6O5DVH27.js → chunk-M6HMMKVG.js} +1 -1
- package/chunks/{chunk-Z5S6KH2B.js → chunk-MAJS7AT4.js} +6 -6
- package/chunks/{chunk-XNZBXQCG.js → chunk-MKVZE4ZJ.js} +1 -1
- package/chunks/{chunk-I7JDGNG6.js → chunk-MVUQRLOH.js} +9 -5
- package/chunks/{chunk-GLWP3FDB.js → chunk-MZSJ43WV.js} +31 -2
- package/chunks/{chunk-ZPPP6VCL.js → chunk-NG2R4N5O.js} +1 -1
- package/chunks/chunk-NKLP3DCK.js +22 -0
- package/chunks/{chunk-WIRAPZ62.js → chunk-NLREQJFK.js} +7 -1
- package/chunks/{chunk-N47ZM2KI.js → chunk-OFI7IGST.js} +12 -12
- package/chunks/{chunk-DBIEZC7T.js → chunk-OH2VKQXH.js} +42 -16
- package/chunks/{chunk-C4GRKMUL.js → chunk-OHJLEW5J.js} +5 -5
- package/chunks/{chunk-3RXUYQJI.js → chunk-OIVKILPI.js} +49 -0
- package/chunks/{chunk-VDLXPEI5.js → chunk-OMKQH5C5.js} +3 -3
- package/chunks/{chunk-LBWNSLJK.js → chunk-ONSZH6VM.js} +2 -2
- package/chunks/{chunk-DYA25Y7U.js → chunk-OWMAZHIX.js} +1 -1
- package/chunks/{chunk-WAOLM6SQ.js → chunk-P2AJ7FTI.js} +1 -1
- package/chunks/{chunk-MFBUJMQ3.js → chunk-P3LEG54R.js} +4 -4
- package/chunks/{chunk-WVRJKSIG.js → chunk-PJOBIWUG.js} +1 -1
- package/chunks/{chunk-YUVTZ4UH.js → chunk-PQBHU2IA.js} +114 -18
- package/chunks/{chunk-GTM6IHBB.js → chunk-Q3JQ7OSU.js} +2 -1
- package/chunks/{chunk-IISDPZ5X.js → chunk-QETYKPMG.js} +1 -1
- package/chunks/{chunk-UKZEXS6K.js → chunk-R574ATRM.js} +11 -0
- package/chunks/{chunk-DOICUTPO.js → chunk-RERATVSK.js} +11 -10
- package/chunks/chunk-RGSBTHSU.js +3381 -0
- package/chunks/{chunk-6D6V55ZQ.js → chunk-RMH5OWLD.js} +1 -1
- package/chunks/{chunk-AVDEBBMI.js → chunk-RNVQB725.js} +2 -2
- package/chunks/{chunk-QWUYFMAR.js → chunk-RUL4S3K3.js} +87 -67
- package/chunks/{chunk-RTWF7FF7.js → chunk-RZHU3ILK.js} +5 -5
- package/chunks/{chunk-3DTM3RPU.js → chunk-S7CV4KO6.js} +3 -3
- package/chunks/{chunk-ZH7G3A4U.js → chunk-SCI7K3GM.js} +4 -4
- package/chunks/{chunk-YAVY33G4.js → chunk-SEZ556DZ.js} +1 -1
- package/chunks/{chunk-6KZP75GT.js → chunk-SHZYHGQH.js} +1 -1
- package/chunks/chunk-SOORFWKY.js +155 -0
- package/chunks/{chunk-NYZAL2W2.js → chunk-SPMY6CX6.js} +4 -4
- package/chunks/{chunk-EHMN6SEG.js → chunk-TDXGKHDN.js} +4 -4
- package/chunks/{chunk-XKTCA6BW.js → chunk-TLV2IMHR.js} +5 -5
- package/chunks/{chunk-XSGQKR37.js → chunk-TRLYP7OF.js} +358 -20
- package/chunks/{chunk-DG563ZCS.js → chunk-TYKC75AX.js} +3 -3
- package/chunks/{chunk-KVUBYJDM.js → chunk-TZEZYNYD.js} +1 -1
- package/chunks/{chunk-XC2VAFVZ.js → chunk-UVX4Y6IN.js} +1 -1
- package/chunks/{chunk-IKXE3AAC.js → chunk-VOARQPTA.js} +2 -2
- package/chunks/{chunk-TVFC3XF5.js → chunk-W4B7UBUS.js} +7 -7
- package/chunks/{chunk-M744OFVE.js → chunk-W7U4ESW2.js} +1 -1
- package/chunks/{chunk-URN76TKR.js → chunk-WCG5O7IP.js} +2 -2
- package/chunks/{chunk-A6SX5TAH.js → chunk-XCWO3SMQ.js} +9 -5
- package/chunks/{chunk-FDV3CXTD.js → chunk-Y4EWSQF7.js} +3 -3
- package/chunks/{chunk-3PRJYMXC.js → chunk-Y4NGLFGJ.js} +1 -1
- package/chunks/{chunk-DOA7MCDY.js → chunk-Y7E5LNLO.js} +973 -892
- package/chunks/{chunk-3LGZEYOF.js → chunk-YHEEE624.js} +2 -2
- package/chunks/{chunk-Y5HIDFKZ.js → chunk-YJQCUTT2.js} +4 -4
- package/chunks/{chunk-QONSRAEV.js → chunk-YP5KH5Y7.js} +1 -1
- package/chunks/{chunk-SQ3ZJOYL.js → chunk-ZJ3VGYHK.js} +20 -20
- package/chunks/{chunk-7GYP5COR.js → chunk-ZXU5UHMI.js} +1 -1
- package/chunks/{computer-use-GTOP2CVH.js → computer-use-KEAPATUY.js} +35 -35
- package/chunks/{config-utils-LIRO7NSU.js → config-utils-K7SCOWHD.js} +2 -2
- package/chunks/{contextCommand-K6T6RRF3.js → contextCommand-ZJA6A5K5.js} +38 -38
- package/chunks/{core-runtime-D2626QQU.js → core-runtime-QMJPWHCI.js} +35 -35
- package/chunks/create-sub-session-DJE6XICH.js +772 -0
- package/chunks/{create-sub-session-6EWLAZD5.js → create-sub-session-E4PBYXV5.js} +2 -2
- package/chunks/{cron-create-CCRIULJE.js → cron-create-GRBWYMIJ.js} +4 -4
- package/chunks/{cron-delete-FCFW6BGP.js → cron-delete-4CMKBR2M.js} +4 -4
- package/chunks/{cron-list-QDBVCHRF.js → cron-list-W7K4ASOA.js} +4 -4
- package/chunks/{daemon-CCIX4BMG.js → daemon-SCTQMM7Z.js} +165 -5
- package/chunks/{daemon-status-provider-2EHRZZVF.js → daemon-status-provider-FSWDPE2G.js} +45 -45
- package/chunks/{daemon-trust-policy-B3EPDJDR.js → daemon-trust-policy-P5L5VFAY.js} +41 -41
- package/chunks/{daemon-trust-policy-monitor-MFM5X26G.js → daemon-trust-policy-monitor-73JYN6ET.js} +41 -41
- package/chunks/{deferred-core-runtime-KXN7HLN7.js → deferred-core-runtime-BWRCCFTE.js} +35 -35
- package/chunks/discovery-XLHITE74.js +220 -0
- package/chunks/{display-image-GUJA352B.js → display-image-O2XFPQTC.js} +4 -4
- package/chunks/{dist-A7H2KKUC.js → dist-K4WWQBHS.js} +277 -98
- package/chunks/{dist-IKGVITP3.js → dist-KS4O2NKE.js} +99 -6
- package/chunks/{earlyInputCapture-WUNYYFOS.js → earlyInputCapture-L5ST23A6.js} +36 -36
- package/chunks/{edit-DMFCBP2D.js → edit-LHHRFNFK.js} +35 -35
- package/chunks/{enter-worktree-5SVBCXFC.js → enter-worktree-6NXCRZPF.js} +35 -35
- package/chunks/{enterPlanMode-QUIZFQ4M.js → enterPlanMode-ZVQT4U7D.js} +35 -35
- package/chunks/{environment-U6QP23VJ.js → environment-GJ2HWJOS.js} +38 -38
- package/chunks/{errors-GZWFA6ON.js → errors-6RLH3XXC.js} +38 -38
- package/chunks/{exit-worktree-FUB44KAF.js → exit-worktree-I2YLUHHY.js} +35 -35
- package/chunks/{exitPlanMode-XSHHYR73.js → exitPlanMode-7CCWKO7I.js} +35 -35
- package/chunks/{fast-path-JHQJSIMZ.js → fast-path-DVFD4HQD.js} +2 -2
- package/chunks/{gemini-O44ETOKT.js → gemini-7FWGOYD4.js} +78 -78
- package/chunks/{geminiContentGenerator-TTM4TZJM.js → geminiContentGenerator-V2WVLIXU.js} +6 -6
- package/chunks/{glob-YECOWTRW.js → glob-3N6GGI75.js} +35 -35
- package/chunks/{goal-tools-3AZKX5WQ.js → goal-tools-APOW6UXL.js} +3 -3
- package/chunks/{grep-BZO4LOTA.js → grep-V43ILZVX.js} +35 -35
- package/chunks/{handleAutoUpdate-TOO52D6H.js → handleAutoUpdate-A5WFVWIA.js} +40 -40
- package/chunks/{i18n-ARJYXZQ5.js → i18n-PLVQ4FBZ.js} +37 -37
- package/chunks/{image-gen-J6Q2YBEU.js → image-gen-7C6IK6DC.js} +9 -9
- package/chunks/{initializer-CEZ4RPQV.js → initializer-CVAIKZYL.js} +42 -42
- package/chunks/{installationInfo-AEGIIQAT.js → installationInfo-J6QDHNTK.js} +36 -36
- package/chunks/{keychain-token-storage-7BT4TQ2A.js → keychain-token-storage-TVAMTNP7.js} +2 -2
- package/chunks/{list-7XLPV5GC.js → list-ZZ4OUUWV.js} +44 -44
- package/chunks/{list-agents-GC4BRET7.js → list-agents-KFFIIS2G.js} +2 -2
- package/chunks/{loadedSettingsAdapter-YK5SBHOT.js → loadedSettingsAdapter-QRYRJSWL.js} +41 -41
- package/chunks/{loggingContentGenerator-I7QDXS43.js → loggingContentGenerator-OJCO75HM.js} +17 -17
- package/chunks/{loop-wakeup-SQQSBMEY.js → loop-wakeup-TLMJPMMP.js} +5 -5
- package/chunks/{ls-63CC3NNX.js → ls-UVVE2XGE.js} +4 -4
- package/chunks/{lsp-P6NVJVNT.js → lsp-QMEA2VLB.js} +2 -2
- package/chunks/{managed-npm-update-YSL7PA7G.js → managed-npm-update-PCOSCP2N.js} +48 -39
- package/chunks/{mcp-RKFQZXP6.js → mcp-M3WKKWKY.js} +41 -41
- package/chunks/{monitor-QHHJIKGL.js → monitor-GN24FH6C.js} +35 -35
- package/chunks/{nonInteractiveCli-XEBIE7MG.js → nonInteractiveCli-KPTU3VSQ.js} +75 -75
- package/chunks/{notebook-edit-SG7X2EQA.js → notebook-edit-4YM65BBO.js} +35 -35
- package/chunks/{openaiContentGenerator-63CVR33K.js → openaiContentGenerator-EDQT6GTV.js} +19 -19
- package/chunks/{pidfile-I3CXJGQD.js → pidfile-JOIIRN2C.js} +36 -36
- package/chunks/{processUtils-LJ3DSANX.js → processUtils-5SV4MX3Q.js} +2 -2
- package/chunks/{qwenContentGenerator-JINBVCH6.js → qwenContentGenerator-ODRJSUGR.js} +40 -40
- package/chunks/{qwenOAuth2-SY2O3NRR.js → qwenOAuth2-NESCMZ47.js} +8 -8
- package/chunks/{read-file-PGTXF25I.js → read-file-HPSODLPK.js} +10 -10
- package/chunks/{read-mcp-resource-RTSSEER5.js → read-mcp-resource-2TNSJTC3.js} +2 -2
- package/chunks/{record-artifact-E6AWQU2Z.js → record-artifact-RAON52FC.js} +3 -3
- package/chunks/{resumeHistoryUtils-FB2NFVZ2.js → resumeHistoryUtils-TXCOFFMQ.js} +42 -41
- package/chunks/{ripGrep-IY3KGPM6.js → ripGrep-ZKQGTQAO.js} +35 -35
- package/chunks/{run-qwen-serve-UYEMGPKA.js → run-qwen-serve-ZPKPKECF.js} +516 -87
- package/chunks/{runtime-CG3BKRFE.js → runtime-2FLNNM36.js} +44 -44
- package/chunks/{scheduler-VFUVGDE5.js → scheduler-365PJHNR.js} +35 -35
- package/chunks/{sdk-exporters-http-IL2346MJ.js → sdk-exporters-http-KHAB5JSD.js} +2 -2
- package/chunks/{sdk-impl-SYKGVWOZ.js → sdk-impl-KD7FSTC3.js} +2 -2
- package/chunks/{send-message-TL6FIMMN.js → send-message-ZM7MRUGP.js} +5 -5
- package/chunks/{serve-ZCCQ2G2L.js → serve-QD2RNLKJ.js} +42 -42
- package/chunks/{server-WS7LWXPP.js → server-XLJVLTYM.js} +7952 -611
- package/chunks/{session-IQLCT32T.js → session-3VTUHH4Q.js} +78 -78
- package/chunks/{settings-NX4EUIE6.js → settings-KULVPCQC.js} +40 -40
- package/chunks/{shell-THDYM4CS.js → shell-3SWW22MH.js} +35 -35
- package/chunks/{skill-OXXZBNQB.js → skill-KDHWYS7W.js} +14 -14
- package/chunks/{skill-settings-T3JZ33T2.js → skill-settings-NMY4JEJC.js} +40 -40
- package/chunks/{spawnChannel-COLJMSA7.js → spawnChannel-ZKS4Q5OU.js} +37 -37
- package/chunks/{standalone-update-ICW7H5IF.js → standalone-update-7CXPGAQ4.js} +38 -38
- package/chunks/{startInteractiveUI-6BDRXSMF.js → startInteractiveUI-2QQLEKM6.js} +473 -233
- package/chunks/{stdioHelpers-HGIYTWAY.js → stdioHelpers-7A2EE64Z.js} +5 -3
- package/chunks/{syntheticOutput-BN7E626U.js → syntheticOutput-ZLCUTKO2.js} +3 -3
- package/chunks/{task-create-2X4UP4F3.js → task-create-CQP5UEA3.js} +9 -9
- package/chunks/{task-list-WOLJPZ64.js → task-list-XLEZOJXP.js} +5 -5
- package/chunks/{task-stop-TNXRNAL2.js → task-stop-7ZQM5CFF.js} +2 -2
- package/chunks/{task-update-VDUSN36E.js → task-update-JA75U2SN.js} +9 -9
- package/chunks/{team-create-BCSMDK4Z.js → team-create-2WTNGAOX.js} +35 -35
- package/chunks/{team-delete-D2VMSDOT.js → team-delete-MHY3UZGY.js} +5 -5
- package/chunks/{team-plan-approval-B5YRLJFV.js → team-plan-approval-LZTYLEG4.js} +35 -35
- package/chunks/{terminal-image-renderer-PW6Z6VFY.js → terminal-image-renderer-R5HHAFJN.js} +41 -36
- package/chunks/{theme-manager-CMVKD2JH.js → theme-manager-PAUCSJFF.js} +36 -36
- package/chunks/{todoWrite-MHWHO5UO.js → todoWrite-UPVOHYGD.js} +4 -4
- package/chunks/{tool-search-SQTUSG6P.js → tool-search-2BFCGLI6.js} +13 -13
- package/chunks/{total-session-admission-XAXOSE46.js → total-session-admission-MK4SINFK.js} +41 -41
- package/chunks/{trustedFolders-Z2UAEG2V.js → trustedFolders-TJ5S26N7.js} +37 -37
- package/chunks/{update-relaunch-JBLI6LJF.js → update-relaunch-N7AYLARF.js} +6 -6
- package/chunks/{updateCheck-FDAVGOFT.js → updateCheck-QRZ3DVT5.js} +39 -39
- package/chunks/{useAutoAcceptIndicator-PDZFIYRM.js → useAutoAcceptIndicator-DBJ7Y5AF.js} +44 -44
- package/chunks/{validateNonInterActiveAuth-Q4763ONQ.js → validateNonInterActiveAuth-6ZQWUDS3.js} +72 -72
- package/chunks/{version-C7MPCGWD.js → version-AJQGQWXC.js} +1 -1
- package/chunks/{web-fetch-L7RAPOJB.js → web-fetch-QWJYRXFL.js} +13 -13
- package/chunks/{web-search-IDOYUOWX.js → web-search-2AOXJGHU.js} +9 -9
- package/chunks/web-shell-static-O73YPVVC.js +33 -0
- package/chunks/{workflow-HXURUJB5.js → workflow-ERH3SJG2.js} +36 -36
- package/chunks/{workspace-providers-status-JZ3GPWNU.js → workspace-providers-status-HZ474RA4.js} +44 -44
- package/chunks/{workspace-registration-store-SM2PWB6L.js → workspace-registration-store-6EUP4JXG.js} +1 -1
- package/chunks/{workspace-registry-6W4ES7BJ.js → workspace-registry-R4APRRNC.js} +41 -41
- package/chunks/{workspace-service-V47ZFJRX.js → workspace-service-HFIFDMU7.js} +46 -46
- package/chunks/{workspace-skills-status-6ZQ45XKA.js → workspace-skills-status-HAHEIHGK.js} +42 -42
- package/chunks/{workspace-trust-reconciler-6V25LMCN.js → workspace-trust-reconciler-65GTAGDK.js} +50 -50
- package/chunks/{write-file-H2QOF25K.js → write-file-B34CDELV.js} +35 -35
- package/chunks/{zoom-image-JTUSS43N.js → zoom-image-HPRBZHSS.js} +10 -10
- package/cli.js +15 -15
- package/package.json +3 -3
- package/web-shell/assets/{arc-DtI1rZcQ.js → arc-Ip-FFDJ0.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-BPZwSVct.js → architectureDiagram-3BPJPVTR-CChqgwIb.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-BIQ03j4C.js → blockDiagram-GPEHLZMM-BHN-Tfss.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-CB0RyFGm.js → c4Diagram-AAUBKEIU-BhyjzDjN.js} +1 -1
- package/web-shell/assets/channel-Cu8qd6OB.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-B3WoS-4H.js → chunk-2J33WTMH-BB9eyHrx.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-C98xYZ1X.js → chunk-4BX2VUAB-BeV7ce_J.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-CbTIWRwQ.js → chunk-55IACEB6-DO7kXDiV.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-DWGnKTPu.js → chunk-727SXJPM-B27MPznD.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-4__QyCEX.js → chunk-AQP2D5EJ-DHIjqjD_.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-DFtG1YCW.js → chunk-FMBD7UC4-DabMqyN2.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-rvAhW51N.js → chunk-ND2GUHAM-Dw7Nnnxc.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-DfiU9pwZ.js → chunk-QZHKN3VN-DdaZew1Q.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-BI3KrXhq.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BI3KrXhq.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-Cc4EIdxu.js → cose-bilkent-S5V4N54A-CgBpCYH5.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-CZNj4dGW.js → dagre-BM42HDAG-BB4IU8G0.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-D5tiqQCr.js → diagram-2AECGRRQ-BcUTHU37.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-pwzw0jVO.js → diagram-5GNKFQAL-B6Lyihyv.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-4CWiM00x.js → diagram-KO2AKTUF-CRIJOjpG.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-Dd7rc7Qf.js → diagram-LMA3HP47-DdNiwWWT.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-_vzV52ml.js → diagram-OG6HWLK6-Dz4b32Do.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-CqbE2bx_.js → erDiagram-TEJ5UH35-D-8NGw77.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-CaxNr7w4.js → flowDiagram-I6XJVG4X-Dun26LyM.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-AGjrtfUA.js → ganttDiagram-6RSMTGT7-F10Hu1Gc.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-ADG2zSkc.js → gitGraphDiagram-PVQCEYII-Bf8Ez6-D.js} +1 -1
- package/web-shell/assets/{index-BOryKCqt.js → index-BXqw-nGq.js} +1 -1
- package/web-shell/assets/index-QQlUCJGg.css +5 -0
- package/web-shell/assets/index-hcgjV7vS.js +1768 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-CE3B_IoZ.js → infoDiagram-5YYISTIA-DVgTMLvj.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-CN-Frhoi.js → ishikawaDiagram-YF4QCWOH-uT-KepvK.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-CGgezS93.js → journeyDiagram-JHISSGLW-Vg_XadQf.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-BqWijky5.js → kanban-definition-UN3LZRKU-Dyv1ESBE.js} +1 -1
- package/web-shell/assets/{linear-D8sfpZf6.js → linear-BMIepYX3.js} +1 -1
- package/web-shell/assets/{mermaid.core-3PA4QrzM.js → mermaid.core-zA8pJ9ag.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-D9QxwiCY.js → mindmap-definition-RKZ34NQL-BCW_BZ_5.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-Bioaf6uE.js → pieDiagram-4H26LBE5-DseNEGp2.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-DBb2AS73.js → quadrantDiagram-W4KKPZXB-6Z7wr1Fi.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-DXOvZ3KB.js → requirementDiagram-4Y6WPE33-CVOlCRPf.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-D9qg09Dm.js → sankeyDiagram-5OEKKPKP-CGhgrUJZ.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-DSAUIfpw.js → sequenceDiagram-3UESZ5HK-dlqmpLuQ.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-BPZkzfQ3.js → stateDiagram-AJRCARHV-B9EW10Xb.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-CJTZJJ5X.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-UDaQp9sP.js → timeline-definition-PNZ67QCA-BBRh0mgZ.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-2ouhAnHO.js → vennDiagram-CIIHVFJN-B8Gs-REP.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-Cq_WEvTK.js → wardley-L42UT6IY-D_y80Ur7.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-Dt24aXOM.js → wardleyDiagram-YWT4CUSO-D-CNfHJ-.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-A5Xk2WCH.js → xychartDiagram-2RQKCTM6-DQ5CvELo.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/create-sub-session-MWUWNBM6.js +0 -401
- package/web-shell/assets/channel-vfbVFuM1.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-Cvr8atq3.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Cvr8atq3.js +0 -1
- package/web-shell/assets/index-Cb1LjsCv.css +0 -5
- package/web-shell/assets/index-CvJDaIy8.js +0 -1756
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DInOqnhZ.js +0 -1
|
@@ -0,0 +1,772 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import {
|
|
4
|
+
SessionNotFoundError
|
|
5
|
+
} from "./chunk-J26HHFI5.js";
|
|
6
|
+
import "./chunk-6PLDPT2C.js";
|
|
7
|
+
import {
|
|
8
|
+
SessionService,
|
|
9
|
+
stripTerminalControlSequences
|
|
10
|
+
} from "./chunk-Y7E5LNLO.js";
|
|
11
|
+
import "./chunk-GOFAQQZA.js";
|
|
12
|
+
import "./chunk-5M6IDOMF.js";
|
|
13
|
+
import "./chunk-TWPJO254.js";
|
|
14
|
+
import "./chunk-H6XPXXMH.js";
|
|
15
|
+
import "./chunk-CNIID3TV.js";
|
|
16
|
+
import "./chunk-MVUQRLOH.js";
|
|
17
|
+
import "./chunk-XCWO3SMQ.js";
|
|
18
|
+
import "./chunk-7MH4J33A.js";
|
|
19
|
+
import "./chunk-6PVPNMXU.js";
|
|
20
|
+
import "./chunk-RMH5OWLD.js";
|
|
21
|
+
import "./chunk-IRH27ZC2.js";
|
|
22
|
+
import "./chunk-QHWCP53L.js";
|
|
23
|
+
import "./chunk-GNPNYXJB.js";
|
|
24
|
+
import "./chunk-Y4NGLFGJ.js";
|
|
25
|
+
import "./chunk-O6GEWCJA.js";
|
|
26
|
+
import "./chunk-T26EAKDL.js";
|
|
27
|
+
import "./chunk-ZPJWUGCS.js";
|
|
28
|
+
import "./chunk-CPBF7KYF.js";
|
|
29
|
+
import "./chunk-J6SZID63.js";
|
|
30
|
+
import "./chunk-KRXPRVGL.js";
|
|
31
|
+
import "./chunk-GM463R2B.js";
|
|
32
|
+
import "./chunk-SEZ556DZ.js";
|
|
33
|
+
import "./chunk-CJXIIILK.js";
|
|
34
|
+
import "./chunk-3K7FH2KQ.js";
|
|
35
|
+
import "./chunk-BVWVWGLE.js";
|
|
36
|
+
import "./chunk-S6LOFUVP.js";
|
|
37
|
+
import "./chunk-LZC3B5N2.js";
|
|
38
|
+
import "./chunk-K623ENWT.js";
|
|
39
|
+
import {
|
|
40
|
+
escapeXml
|
|
41
|
+
} from "./chunk-AQ37AY7B.js";
|
|
42
|
+
import "./chunk-EQL65XGA.js";
|
|
43
|
+
import "./chunk-IIJEYBNH.js";
|
|
44
|
+
import "./chunk-22NBYCPD.js";
|
|
45
|
+
import "./chunk-NAVJD2PQ.js";
|
|
46
|
+
import "./chunk-3ULCB3NE.js";
|
|
47
|
+
import "./chunk-BGG4MBYD.js";
|
|
48
|
+
import "./chunk-DGEIYUC3.js";
|
|
49
|
+
import "./chunk-MPHPFVKK.js";
|
|
50
|
+
import "./chunk-AXMWHKXA.js";
|
|
51
|
+
import "./chunk-DJ2GSRLV.js";
|
|
52
|
+
import "./chunk-33ACCIIY.js";
|
|
53
|
+
import "./chunk-L4N6TIP7.js";
|
|
54
|
+
import "./chunk-2J3OJGTL.js";
|
|
55
|
+
import "./chunk-P3QQPMQA.js";
|
|
56
|
+
import "./chunk-M6HMMKVG.js";
|
|
57
|
+
import "./chunk-GLCZKT5V.js";
|
|
58
|
+
import "./chunk-EI3HZX6C.js";
|
|
59
|
+
import "./chunk-2U3WZGZG.js";
|
|
60
|
+
import "./chunk-WOJZWRAZ.js";
|
|
61
|
+
import "./chunk-VGC4I5JJ.js";
|
|
62
|
+
import "./chunk-FVKHVJZQ.js";
|
|
63
|
+
import "./chunk-NG2R4N5O.js";
|
|
64
|
+
import "./chunk-IC4Z6LX6.js";
|
|
65
|
+
import "./chunk-6EOI4HOK.js";
|
|
66
|
+
import "./chunk-46UV252V.js";
|
|
67
|
+
import "./chunk-ZBVS26BY.js";
|
|
68
|
+
import "./chunk-KKBPOU75.js";
|
|
69
|
+
import "./chunk-EUNWC2VS.js";
|
|
70
|
+
import "./chunk-FOGU3LJX.js";
|
|
71
|
+
import "./chunk-6M26GBKX.js";
|
|
72
|
+
import "./chunk-W4RQUHY3.js";
|
|
73
|
+
import "./chunk-LKRMNRSN.js";
|
|
74
|
+
import {
|
|
75
|
+
createDebugLogger
|
|
76
|
+
} from "./chunk-OIVKILPI.js";
|
|
77
|
+
import "./chunk-VOQXFAY5.js";
|
|
78
|
+
import {
|
|
79
|
+
writeStderrLine
|
|
80
|
+
} from "./chunk-KGJGEEVR.js";
|
|
81
|
+
import "./chunk-75DOP5OR.js";
|
|
82
|
+
import "./chunk-DMTGGOSA.js";
|
|
83
|
+
import "./chunk-YQ3U5MUC.js";
|
|
84
|
+
import "./chunk-AMDSOFFV.js";
|
|
85
|
+
import "./chunk-QUGAUQGJ.js";
|
|
86
|
+
import {
|
|
87
|
+
init_esbuild_shims
|
|
88
|
+
} from "./chunk-5O2XNYP6.js";
|
|
89
|
+
import {
|
|
90
|
+
__name
|
|
91
|
+
} from "./chunk-J2S4EL5Y.js";
|
|
92
|
+
|
|
93
|
+
// packages/cli/src/serve/create-sub-session.ts
|
|
94
|
+
init_esbuild_shims();
|
|
95
|
+
import { randomUUID } from "node:crypto";
|
|
96
|
+
var log = createDebugLogger("SUB_SESSION");
|
|
97
|
+
var MAX_CONCURRENT_SUB_SESSIONS_PER_CALLER = 16;
|
|
98
|
+
var MAX_CONCURRENT_SUB_SESSIONS_TOTAL = 24;
|
|
99
|
+
var FIRST_TURN_TIMEOUT_MS = 5 * 6e4;
|
|
100
|
+
var SENT_MODE_DRAIN_TIMEOUT_MS = 30 * 6e4;
|
|
101
|
+
var RECOVERED_PARENT_NOTIFICATION_TIMEOUT_MS = 30 * 6e4;
|
|
102
|
+
var SENT_COMPLETION_DELIVERY_RETRY_MS = 100;
|
|
103
|
+
var SENT_COMPLETION_DELIVERY_MAX_RETRY_MS = 3e4;
|
|
104
|
+
var MAX_RESULT_CHARS = 32e3;
|
|
105
|
+
var MAX_SENT_COMPLETION_MODEL_TEXT_CHARS = 32768;
|
|
106
|
+
var SENT_COMPLETION_RESULT_TRUNCATION_MARKER = "\n[\u2026result truncated]";
|
|
107
|
+
var MAX_NAME_LENGTH = 60;
|
|
108
|
+
var MAX_TRACKED_SPAWNED_SESSIONS = 1024;
|
|
109
|
+
var BIDI_CONTROL_MARKS = new RegExp(
|
|
110
|
+
"[\\u061C\\u200E\\u200F\\u202A-\\u202E\\u2066-\\u2069]",
|
|
111
|
+
"g"
|
|
112
|
+
);
|
|
113
|
+
function subSessionName(label) {
|
|
114
|
+
const cleaned = stripTerminalControlSequences(label).replace(BIDI_CONTROL_MARKS, "").trim().replace(/\s+/g, " ");
|
|
115
|
+
let short = cleaned;
|
|
116
|
+
if (cleaned.length > MAX_NAME_LENGTH) {
|
|
117
|
+
let cut = MAX_NAME_LENGTH - 1;
|
|
118
|
+
const boundary = cleaned.charCodeAt(cut - 1);
|
|
119
|
+
if (boundary >= 55296 && boundary <= 56319) cut -= 1;
|
|
120
|
+
short = `${cleaned.slice(0, cut)}\u2026`;
|
|
121
|
+
}
|
|
122
|
+
return `\u{1F9F5} ${short}`;
|
|
123
|
+
}
|
|
124
|
+
__name(subSessionName, "subSessionName");
|
|
125
|
+
function sentCompletionStatus(stopReason) {
|
|
126
|
+
if (stopReason === "end_turn") return "completed";
|
|
127
|
+
if (stopReason === "cancelled" || stopReason === "shutdown") {
|
|
128
|
+
return "cancelled";
|
|
129
|
+
}
|
|
130
|
+
return "failed";
|
|
131
|
+
}
|
|
132
|
+
__name(sentCompletionStatus, "sentCompletionStatus");
|
|
133
|
+
function truncateCodePoints(value, max) {
|
|
134
|
+
const codePoints = Array.from(value);
|
|
135
|
+
if (codePoints.length <= max) return value;
|
|
136
|
+
return `${codePoints.slice(0, Math.max(0, max - 1)).join("")}\u2026`;
|
|
137
|
+
}
|
|
138
|
+
__name(truncateCodePoints, "truncateCodePoints");
|
|
139
|
+
function escapeXmlWithinBudget(value, budget) {
|
|
140
|
+
if (budget <= 0) return "";
|
|
141
|
+
const escapedCodePoints = [];
|
|
142
|
+
let length = 0;
|
|
143
|
+
let truncated = false;
|
|
144
|
+
for (const codePoint of value) {
|
|
145
|
+
const escaped = escapeXml(codePoint);
|
|
146
|
+
if (length + escaped.length > budget) {
|
|
147
|
+
truncated = true;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
escapedCodePoints.push(escaped);
|
|
151
|
+
length += escaped.length;
|
|
152
|
+
}
|
|
153
|
+
if (!truncated) return escapedCodePoints.join("");
|
|
154
|
+
while (escapedCodePoints.length > 0 && length + SENT_COMPLETION_RESULT_TRUNCATION_MARKER.length > budget) {
|
|
155
|
+
length -= escapedCodePoints.pop().length;
|
|
156
|
+
}
|
|
157
|
+
return `${escapedCodePoints.join("")}${SENT_COMPLETION_RESULT_TRUNCATION_MARKER.length <= budget - length ? SENT_COMPLETION_RESULT_TRUNCATION_MARKER : ""}`;
|
|
158
|
+
}
|
|
159
|
+
__name(escapeXmlWithinBudget, "escapeXmlWithinBudget");
|
|
160
|
+
function buildSentCompletionNotification(sessionId, label, result, stopReason) {
|
|
161
|
+
const status = sentCompletionStatus(stopReason);
|
|
162
|
+
const boundedStopReason = truncateCodePoints(stopReason, 128);
|
|
163
|
+
const statusText = status === "completed" ? "completed" : status === "cancelled" ? "was cancelled" : `failed (${boundedStopReason})`;
|
|
164
|
+
const sessionLink = `[\u{1F9F5} ${sessionId.slice(0, 8)}](qwen-session://${sessionId})`;
|
|
165
|
+
const safeResult = result.trim() || `No text output (stopReason: ${stopReason}).`;
|
|
166
|
+
const modelSessionId = truncateCodePoints(sessionId, 256);
|
|
167
|
+
const modelLabel = truncateCodePoints(label, 256);
|
|
168
|
+
const modelTextPrefix = [
|
|
169
|
+
"<task-notification>",
|
|
170
|
+
`<task-id>${escapeXml(modelSessionId)}</task-id>`,
|
|
171
|
+
`<status>${status}</status>`,
|
|
172
|
+
`<summary>Sub-session "${escapeXml(modelLabel)}" ${escapeXml(statusText)}.</summary>`,
|
|
173
|
+
`<session-link>qwen-session://${escapeXml(modelSessionId)}</session-link>`,
|
|
174
|
+
"<result>"
|
|
175
|
+
].join("");
|
|
176
|
+
const modelTextSuffix = "</result></task-notification>";
|
|
177
|
+
const resultBudget = Math.max(
|
|
178
|
+
0,
|
|
179
|
+
MAX_SENT_COMPLETION_MODEL_TEXT_CHARS - modelTextPrefix.length - modelTextSuffix.length
|
|
180
|
+
);
|
|
181
|
+
const modelText = `${modelTextPrefix}${escapeXmlWithinBudget(
|
|
182
|
+
safeResult,
|
|
183
|
+
resultBudget
|
|
184
|
+
)}${modelTextSuffix}`;
|
|
185
|
+
return {
|
|
186
|
+
displayText: `Sub-session ${sessionLink} ${statusText}.`,
|
|
187
|
+
modelText,
|
|
188
|
+
taskId: sessionId,
|
|
189
|
+
status,
|
|
190
|
+
kind: "agent"
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
__name(buildSentCompletionNotification, "buildSentCompletionNotification");
|
|
194
|
+
function isBackgroundNotificationForTask(event, taskId) {
|
|
195
|
+
if (event.type !== "session_update") return false;
|
|
196
|
+
const update = event.data?.update;
|
|
197
|
+
return update?._meta?.source === "background_notification" && update._meta.backgroundTask?.taskId === taskId;
|
|
198
|
+
}
|
|
199
|
+
__name(isBackgroundNotificationForTask, "isBackgroundNotificationForTask");
|
|
200
|
+
async function awaitRecoveredParentNotification(bridge, sessionId, notification, lastEventId, eventEpoch, stopSignal) {
|
|
201
|
+
const timeoutAc = new AbortController();
|
|
202
|
+
const timer = setTimeout(
|
|
203
|
+
() => timeoutAc.abort(),
|
|
204
|
+
RECOVERED_PARENT_NOTIFICATION_TIMEOUT_MS
|
|
205
|
+
);
|
|
206
|
+
if (typeof timer.unref === "function") timer.unref();
|
|
207
|
+
const signal = AbortSignal.any([stopSignal, timeoutAc.signal]);
|
|
208
|
+
let observedOwnNotification = false;
|
|
209
|
+
try {
|
|
210
|
+
for await (const event of bridge.subscribeEvents(sessionId, {
|
|
211
|
+
lastEventId,
|
|
212
|
+
epoch: eventEpoch,
|
|
213
|
+
signal
|
|
214
|
+
})) {
|
|
215
|
+
if (isBackgroundNotificationForTask(event, notification.taskId)) {
|
|
216
|
+
observedOwnNotification = true;
|
|
217
|
+
} else if (observedOwnNotification && event.type === "background_notification_turn_complete") {
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
} finally {
|
|
222
|
+
clearTimeout(timer);
|
|
223
|
+
timeoutAc.abort();
|
|
224
|
+
}
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
__name(awaitRecoveredParentNotification, "awaitRecoveredParentNotification");
|
|
228
|
+
async function waitForSentCompletionRetry(signal, attempt) {
|
|
229
|
+
if (signal.aborted) throw signal.reason;
|
|
230
|
+
const delay = Math.min(
|
|
231
|
+
SENT_COMPLETION_DELIVERY_RETRY_MS * 2 ** attempt,
|
|
232
|
+
SENT_COMPLETION_DELIVERY_MAX_RETRY_MS
|
|
233
|
+
);
|
|
234
|
+
await new Promise((resolve, reject) => {
|
|
235
|
+
const onAbort = /* @__PURE__ */ __name(() => {
|
|
236
|
+
clearTimeout(timer);
|
|
237
|
+
reject(signal.reason);
|
|
238
|
+
}, "onAbort");
|
|
239
|
+
const timer = setTimeout(() => {
|
|
240
|
+
signal.removeEventListener("abort", onAbort);
|
|
241
|
+
resolve();
|
|
242
|
+
}, delay);
|
|
243
|
+
if (typeof timer.unref === "function") timer.unref();
|
|
244
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
__name(waitForSentCompletionRetry, "waitForSentCompletionRetry");
|
|
248
|
+
async function awaitSentCompletionAcceptance(bridge, parentSessionId, notification, stopSignal, deadline) {
|
|
249
|
+
let lastError;
|
|
250
|
+
let attempt = 0;
|
|
251
|
+
while (!stopSignal.aborted) {
|
|
252
|
+
try {
|
|
253
|
+
const acknowledgement = await bridge.enqueueBackgroundNotification(
|
|
254
|
+
parentSessionId,
|
|
255
|
+
notification
|
|
256
|
+
);
|
|
257
|
+
if (acknowledgement.accepted) return "accepted";
|
|
258
|
+
} catch (error) {
|
|
259
|
+
if (error instanceof SessionNotFoundError) return "missing";
|
|
260
|
+
lastError = error;
|
|
261
|
+
}
|
|
262
|
+
if (Date.now() >= deadline) {
|
|
263
|
+
throw new Error(
|
|
264
|
+
`Parent ${parentSessionId} did not durably accept completion for sub-session ${notification.taskId}.`,
|
|
265
|
+
lastError === void 0 ? void 0 : { cause: lastError }
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
await waitForSentCompletionRetry(stopSignal, attempt);
|
|
269
|
+
attempt += 1;
|
|
270
|
+
}
|
|
271
|
+
throw stopSignal.reason;
|
|
272
|
+
}
|
|
273
|
+
__name(awaitSentCompletionAcceptance, "awaitSentCompletionAcceptance");
|
|
274
|
+
async function deliverSentCompletion(bridge, boundWorkspace, parentSessionId, notification, stopSignal, isolatedWorkspace) {
|
|
275
|
+
const deadline = Date.now() + RECOVERED_PARENT_NOTIFICATION_TIMEOUT_MS;
|
|
276
|
+
const initialDelivery = await awaitSentCompletionAcceptance(
|
|
277
|
+
bridge,
|
|
278
|
+
parentSessionId,
|
|
279
|
+
notification,
|
|
280
|
+
stopSignal,
|
|
281
|
+
deadline
|
|
282
|
+
);
|
|
283
|
+
if (initialDelivery === "accepted") return;
|
|
284
|
+
let restoredParent;
|
|
285
|
+
const isolatedCwd = isolatedWorkspace ? await isolatedWorkspace.materializeDirectory(parentSessionId) : void 0;
|
|
286
|
+
let materializedDirectoryUnused = isolatedCwd !== void 0;
|
|
287
|
+
try {
|
|
288
|
+
restoredParent = await bridge.resumeSession({
|
|
289
|
+
sessionId: parentSessionId,
|
|
290
|
+
workspaceCwd: boundWorkspace
|
|
291
|
+
});
|
|
292
|
+
if (isolatedCwd !== void 0) {
|
|
293
|
+
if (restoredParent.hasActivePrompt === true && restoredParent.currentCwd !== isolatedCwd) {
|
|
294
|
+
throw new Error(
|
|
295
|
+
"Active restored parent is outside its isolated conversation directory."
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
if (restoredParent.hasActivePrompt === true) {
|
|
299
|
+
materializedDirectoryUnused = false;
|
|
300
|
+
}
|
|
301
|
+
if (restoredParent.hasActivePrompt !== true) {
|
|
302
|
+
materializedDirectoryUnused = false;
|
|
303
|
+
const changed = await bridge.changeSessionCwd(parentSessionId, {
|
|
304
|
+
path: isolatedCwd,
|
|
305
|
+
allowedRoots: [boundWorkspace],
|
|
306
|
+
managedRelocation: "live-conversation"
|
|
307
|
+
});
|
|
308
|
+
if (changed.newCwd !== isolatedCwd) {
|
|
309
|
+
materializedDirectoryUnused = true;
|
|
310
|
+
throw new Error(
|
|
311
|
+
"Restored parent workspace directory relocation was rejected."
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
restoredParent.currentCwd = changed.newCwd;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
const lastEventId = bridge.getSessionLastEventId(parentSessionId);
|
|
318
|
+
const eventEpoch = bridge.getSessionEventEpoch(parentSessionId);
|
|
319
|
+
const recoveredDelivery = await awaitSentCompletionAcceptance(
|
|
320
|
+
bridge,
|
|
321
|
+
parentSessionId,
|
|
322
|
+
notification,
|
|
323
|
+
stopSignal,
|
|
324
|
+
deadline
|
|
325
|
+
);
|
|
326
|
+
if (recoveredDelivery === "missing") {
|
|
327
|
+
throw new SessionNotFoundError(parentSessionId);
|
|
328
|
+
}
|
|
329
|
+
void awaitRecoveredParentNotification(
|
|
330
|
+
bridge,
|
|
331
|
+
parentSessionId,
|
|
332
|
+
notification,
|
|
333
|
+
lastEventId,
|
|
334
|
+
eventEpoch,
|
|
335
|
+
stopSignal
|
|
336
|
+
).then(
|
|
337
|
+
(continuationCompleted) => {
|
|
338
|
+
if (!continuationCompleted && !stopSignal.aborted) {
|
|
339
|
+
writeStderrLine(
|
|
340
|
+
`qwen serve: restored parent ${parentSessionId} accepted completion for sub-session ${notification.taskId}, but its automatic continuation did not reach an end-turn boundary; leaving recovery attachment for the idle reaper`
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
(error) => {
|
|
345
|
+
if (!stopSignal.aborted) {
|
|
346
|
+
writeStderrLine(
|
|
347
|
+
`qwen serve: restored parent ${parentSessionId} accepted completion for sub-session ${notification.taskId}, but its automatic continuation could not be observed: ${error instanceof Error ? error.message : String(error)}`
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
);
|
|
352
|
+
} catch (error) {
|
|
353
|
+
let recoveredParentClosed = false;
|
|
354
|
+
if (restoredParent !== void 0) {
|
|
355
|
+
try {
|
|
356
|
+
if (restoredParent.hasActivePrompt === true) {
|
|
357
|
+
if (restoredParent.clientId) {
|
|
358
|
+
await bridge.detachClient(
|
|
359
|
+
restoredParent.sessionId,
|
|
360
|
+
restoredParent.clientId
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
} else if (restoredParent.attached) {
|
|
364
|
+
if (restoredParent.clientId) {
|
|
365
|
+
await bridge.detachClient(
|
|
366
|
+
restoredParent.sessionId,
|
|
367
|
+
restoredParent.clientId
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
} else {
|
|
371
|
+
recoveredParentClosed = await bridge.killSession(
|
|
372
|
+
restoredParent.sessionId,
|
|
373
|
+
{ requireZeroAttaches: true }
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
} catch {
|
|
377
|
+
recoveredParentClosed = false;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
if (isolatedWorkspace && isolatedCwd !== void 0 && (recoveredParentClosed || materializedDirectoryUnused)) {
|
|
381
|
+
await isolatedWorkspace.discardEmptyDirectory(parentSessionId).catch(() => {
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
throw error;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
__name(deliverSentCompletion, "deliverSentCompletion");
|
|
388
|
+
async function awaitFirstTurn(bridge, sessionId, promptId, lastEventId, timeoutMs, stopSignal) {
|
|
389
|
+
const ac = new AbortController();
|
|
390
|
+
let timedOut = false;
|
|
391
|
+
const timer = setTimeout(() => {
|
|
392
|
+
timedOut = true;
|
|
393
|
+
ac.abort();
|
|
394
|
+
}, timeoutMs);
|
|
395
|
+
if (typeof timer.unref === "function") timer.unref();
|
|
396
|
+
const composed = stopSignal ? AbortSignal.any([ac.signal, stopSignal]) : ac.signal;
|
|
397
|
+
let acc = "";
|
|
398
|
+
let truncated = false;
|
|
399
|
+
let stopReason;
|
|
400
|
+
const appendChunk = /* @__PURE__ */ __name((text) => {
|
|
401
|
+
if (truncated) return;
|
|
402
|
+
if (acc.length + text.length > MAX_RESULT_CHARS) {
|
|
403
|
+
let cut = Math.max(0, MAX_RESULT_CHARS - acc.length);
|
|
404
|
+
if (cut > 0) {
|
|
405
|
+
const code = text.charCodeAt(cut - 1);
|
|
406
|
+
if (code >= 55296 && code <= 56319) cut -= 1;
|
|
407
|
+
}
|
|
408
|
+
acc += text.slice(0, cut);
|
|
409
|
+
truncated = true;
|
|
410
|
+
} else {
|
|
411
|
+
acc += text;
|
|
412
|
+
}
|
|
413
|
+
}, "appendChunk");
|
|
414
|
+
try {
|
|
415
|
+
for await (const e of bridge.subscribeEvents(sessionId, {
|
|
416
|
+
lastEventId,
|
|
417
|
+
signal: composed
|
|
418
|
+
})) {
|
|
419
|
+
if (e.type === "session_update") {
|
|
420
|
+
const d = e.data;
|
|
421
|
+
if (d?.update?.sessionUpdate === "agent_message_chunk" && typeof d.update.content?.text === "string") {
|
|
422
|
+
appendChunk(d.update.content.text);
|
|
423
|
+
}
|
|
424
|
+
} else if (e.type === "turn_complete") {
|
|
425
|
+
const d = e.data;
|
|
426
|
+
if (d?.promptId === promptId) {
|
|
427
|
+
stopReason = d.stopReason ?? "end_turn";
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
} else if (e.type === "turn_error") {
|
|
431
|
+
const d = e.data;
|
|
432
|
+
if (d?.promptId === promptId) {
|
|
433
|
+
stopReason = "error";
|
|
434
|
+
if (d.message && !truncated) {
|
|
435
|
+
const suffix = `${acc ? "\n" : ""}[turn error] ${d.message}`;
|
|
436
|
+
if (acc.length + suffix.length <= MAX_RESULT_CHARS) {
|
|
437
|
+
acc += suffix;
|
|
438
|
+
} else {
|
|
439
|
+
truncated = true;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
break;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
} finally {
|
|
447
|
+
clearTimeout(timer);
|
|
448
|
+
ac.abort();
|
|
449
|
+
}
|
|
450
|
+
if (stopReason === void 0) {
|
|
451
|
+
stopReason = stopSignal?.aborted ? "shutdown" : timedOut ? "timeout" : "incomplete";
|
|
452
|
+
}
|
|
453
|
+
if (truncated) acc += "\n[\u2026output truncated]";
|
|
454
|
+
return { result: acc, stopReason };
|
|
455
|
+
}
|
|
456
|
+
__name(awaitFirstTurn, "awaitFirstTurn");
|
|
457
|
+
function createSubSessionLauncher(opts) {
|
|
458
|
+
const {
|
|
459
|
+
getBridge,
|
|
460
|
+
boundWorkspace,
|
|
461
|
+
notifySentCompletion = false,
|
|
462
|
+
isolatedWorkspace
|
|
463
|
+
} = opts;
|
|
464
|
+
const firstTurnTimeoutMs = opts.firstTurnTimeoutMs ?? FIRST_TURN_TIMEOUT_MS;
|
|
465
|
+
const sentModeDrainTimeoutMs = opts.sentModeDrainTimeoutMs ?? SENT_MODE_DRAIN_TIMEOUT_MS;
|
|
466
|
+
const maxConcurrentPerCaller = opts.maxConcurrentPerCaller ?? MAX_CONCURRENT_SUB_SESSIONS_PER_CALLER;
|
|
467
|
+
const maxConcurrentTotal = Math.min(
|
|
468
|
+
opts.maxConcurrentTotal ?? MAX_CONCURRENT_SUB_SESSIONS_TOTAL,
|
|
469
|
+
MAX_TRACKED_SPAWNED_SESSIONS
|
|
470
|
+
);
|
|
471
|
+
const inflight = /* @__PURE__ */ new Map();
|
|
472
|
+
const spawnedSessionIds = /* @__PURE__ */ new Set();
|
|
473
|
+
const stopAc = new AbortController();
|
|
474
|
+
let inflightTotal = 0;
|
|
475
|
+
const release = /* @__PURE__ */ __name((key) => {
|
|
476
|
+
const n = (inflight.get(key) ?? 1) - 1;
|
|
477
|
+
if (n <= 0) inflight.delete(key);
|
|
478
|
+
else inflight.set(key, n);
|
|
479
|
+
inflightTotal = Math.max(0, inflightTotal - 1);
|
|
480
|
+
}, "release");
|
|
481
|
+
const rememberSpawned = /* @__PURE__ */ __name((sessionId) => {
|
|
482
|
+
spawnedSessionIds.add(sessionId);
|
|
483
|
+
while (spawnedSessionIds.size > MAX_TRACKED_SPAWNED_SESSIONS) {
|
|
484
|
+
const oldest = spawnedSessionIds.values().next().value;
|
|
485
|
+
if (oldest === void 0) break;
|
|
486
|
+
spawnedSessionIds.delete(oldest);
|
|
487
|
+
}
|
|
488
|
+
}, "rememberSpawned");
|
|
489
|
+
const launch = /* @__PURE__ */ __name(async (info) => {
|
|
490
|
+
if (stopAc.signal.aborted) {
|
|
491
|
+
throw new Error(
|
|
492
|
+
"The daemon is shutting down; cannot create a sub-session."
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
const bridge = getBridge();
|
|
496
|
+
if (!bridge) {
|
|
497
|
+
throw new Error("Session bridge is not available.");
|
|
498
|
+
}
|
|
499
|
+
const caller = bridge.getSessionSummary(info.callerSessionId);
|
|
500
|
+
if (spawnedSessionIds.has(info.callerSessionId) || caller.parentSessionId !== void 0) {
|
|
501
|
+
throw new Error(
|
|
502
|
+
"A sub-session cannot create further sub-sessions (nesting is capped at one level)."
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
const key = info.callerSessionId;
|
|
506
|
+
const current = inflight.get(key) ?? 0;
|
|
507
|
+
if (current >= maxConcurrentPerCaller) {
|
|
508
|
+
throw new Error(
|
|
509
|
+
`Too many concurrent sub-sessions for this session (cap ${maxConcurrentPerCaller}); wait for one to finish.`
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
if (inflightTotal >= maxConcurrentTotal) {
|
|
513
|
+
throw new Error(
|
|
514
|
+
`Too many concurrent sub-sessions in this workspace (cap ${maxConcurrentTotal}); wait for one to finish.`
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
inflight.set(key, current + 1);
|
|
518
|
+
inflightTotal += 1;
|
|
519
|
+
let released = false;
|
|
520
|
+
const releaseOnce = /* @__PURE__ */ __name(() => {
|
|
521
|
+
if (released) return;
|
|
522
|
+
released = true;
|
|
523
|
+
release(key);
|
|
524
|
+
}, "releaseOnce");
|
|
525
|
+
let spawnedSession;
|
|
526
|
+
let promptDispatched = false;
|
|
527
|
+
try {
|
|
528
|
+
const sub = await bridge.spawnOrAttach({
|
|
529
|
+
workspaceCwd: boundWorkspace,
|
|
530
|
+
sessionScope: "thread",
|
|
531
|
+
// force a fresh top-level session, never attach
|
|
532
|
+
// Record the caller as the sub-session's parent so the UI can link it
|
|
533
|
+
// back. Persisted into the sub-session's transcript at spawn time.
|
|
534
|
+
parentSessionId: info.callerSessionId,
|
|
535
|
+
...info.model ? { modelServiceId: info.model } : {}
|
|
536
|
+
});
|
|
537
|
+
spawnedSession = sub;
|
|
538
|
+
const sessionId = sub.sessionId;
|
|
539
|
+
if (isolatedWorkspace) {
|
|
540
|
+
const isolatedCwd = await isolatedWorkspace.materializeDirectory(sessionId);
|
|
541
|
+
const changed = await bridge.changeSessionCwd(sessionId, {
|
|
542
|
+
path: isolatedCwd,
|
|
543
|
+
allowedRoots: [boundWorkspace],
|
|
544
|
+
managedRelocation: "live-conversation"
|
|
545
|
+
});
|
|
546
|
+
if (changed.newCwd !== isolatedCwd) {
|
|
547
|
+
throw new Error(
|
|
548
|
+
"Sub-session workspace directory relocation was rejected."
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
rememberSpawned(sessionId);
|
|
553
|
+
try {
|
|
554
|
+
bridge.updateSessionMetadata(sessionId, {
|
|
555
|
+
displayName: subSessionName(info.name ?? info.prompt)
|
|
556
|
+
});
|
|
557
|
+
} catch (err) {
|
|
558
|
+
log.debug("sub-session: updateSessionMetadata failed", sessionId, err);
|
|
559
|
+
}
|
|
560
|
+
const lastEventId = bridge.getSessionLastEventId(sessionId);
|
|
561
|
+
const promptId = randomUUID();
|
|
562
|
+
const turn = bridge.sendPrompt(
|
|
563
|
+
sessionId,
|
|
564
|
+
{
|
|
565
|
+
sessionId,
|
|
566
|
+
prompt: [{ type: "text", text: info.prompt }]
|
|
567
|
+
},
|
|
568
|
+
void 0,
|
|
569
|
+
{ promptId }
|
|
570
|
+
);
|
|
571
|
+
promptDispatched = true;
|
|
572
|
+
void turn.catch((err) => {
|
|
573
|
+
log.debug("sub-session: sendPrompt rejected", sessionId, String(err));
|
|
574
|
+
});
|
|
575
|
+
if (info.completion === "sent") {
|
|
576
|
+
const drainAc = new AbortController();
|
|
577
|
+
const drainSignal = AbortSignal.any([stopAc.signal, drainAc.signal]);
|
|
578
|
+
void (async () => {
|
|
579
|
+
try {
|
|
580
|
+
let notification;
|
|
581
|
+
try {
|
|
582
|
+
const turnError = turn.then(
|
|
583
|
+
() => new Promise(() => {
|
|
584
|
+
}),
|
|
585
|
+
(err) => Promise.reject(
|
|
586
|
+
new Error(
|
|
587
|
+
`sub-session dispatch failed: ${err instanceof Error ? err.message : String(err)}`
|
|
588
|
+
)
|
|
589
|
+
)
|
|
590
|
+
);
|
|
591
|
+
const completion = await Promise.race([
|
|
592
|
+
awaitFirstTurn(
|
|
593
|
+
bridge,
|
|
594
|
+
sessionId,
|
|
595
|
+
promptId,
|
|
596
|
+
lastEventId,
|
|
597
|
+
sentModeDrainTimeoutMs,
|
|
598
|
+
drainSignal
|
|
599
|
+
),
|
|
600
|
+
turnError
|
|
601
|
+
]);
|
|
602
|
+
if (stopAc.signal.aborted) return;
|
|
603
|
+
if (completion.stopReason === "timeout") {
|
|
604
|
+
writeStderrLine(
|
|
605
|
+
`qwen serve: sub-session ${sessionId} drain timed out after ${Math.round(sentModeDrainTimeoutMs / 6e4)}min; releasing its concurrency slot (the sub-session may still be running)`
|
|
606
|
+
);
|
|
607
|
+
}
|
|
608
|
+
if (notifySentCompletion) {
|
|
609
|
+
notification = buildSentCompletionNotification(
|
|
610
|
+
sessionId,
|
|
611
|
+
subSessionName(info.name ?? info.prompt),
|
|
612
|
+
completion.result,
|
|
613
|
+
completion.stopReason
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
} catch (err) {
|
|
617
|
+
if (stopAc.signal.aborted) return;
|
|
618
|
+
if (!notifySentCompletion) return;
|
|
619
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
620
|
+
notification = buildSentCompletionNotification(
|
|
621
|
+
sessionId,
|
|
622
|
+
subSessionName(info.name ?? info.prompt),
|
|
623
|
+
message,
|
|
624
|
+
"error"
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
if (!notification) return;
|
|
628
|
+
try {
|
|
629
|
+
await deliverSentCompletion(
|
|
630
|
+
bridge,
|
|
631
|
+
boundWorkspace,
|
|
632
|
+
info.callerSessionId,
|
|
633
|
+
notification,
|
|
634
|
+
stopAc.signal,
|
|
635
|
+
isolatedWorkspace
|
|
636
|
+
);
|
|
637
|
+
} catch (notificationError) {
|
|
638
|
+
if (!stopAc.signal.aborted) {
|
|
639
|
+
writeStderrLine(
|
|
640
|
+
`qwen serve: sub-session ${sessionId} completion could not be returned to parent ${info.callerSessionId}: ${notificationError instanceof Error ? notificationError.message : String(notificationError)}`
|
|
641
|
+
);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
} finally {
|
|
645
|
+
drainAc.abort();
|
|
646
|
+
releaseOnce();
|
|
647
|
+
}
|
|
648
|
+
})();
|
|
649
|
+
return {
|
|
650
|
+
sessionId,
|
|
651
|
+
...sub.parentSessionPersisted !== void 0 ? { parentSessionPersisted: sub.parentSessionPersisted } : {}
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
try {
|
|
655
|
+
const turnError = turn.then(
|
|
656
|
+
() => new Promise(() => {
|
|
657
|
+
}),
|
|
658
|
+
// never resolves on success
|
|
659
|
+
(err) => Promise.reject(
|
|
660
|
+
new Error(
|
|
661
|
+
`sub-session dispatch failed: ${err instanceof Error ? err.message : String(err)}`
|
|
662
|
+
)
|
|
663
|
+
)
|
|
664
|
+
);
|
|
665
|
+
const firstTurn = awaitFirstTurn(
|
|
666
|
+
bridge,
|
|
667
|
+
sessionId,
|
|
668
|
+
promptId,
|
|
669
|
+
lastEventId,
|
|
670
|
+
firstTurnTimeoutMs,
|
|
671
|
+
stopAc.signal
|
|
672
|
+
);
|
|
673
|
+
const { result, stopReason } = await Promise.race([
|
|
674
|
+
firstTurn,
|
|
675
|
+
turnError
|
|
676
|
+
]);
|
|
677
|
+
return {
|
|
678
|
+
sessionId,
|
|
679
|
+
result,
|
|
680
|
+
stopReason,
|
|
681
|
+
...sub.parentSessionPersisted !== void 0 ? { parentSessionPersisted: sub.parentSessionPersisted } : {}
|
|
682
|
+
};
|
|
683
|
+
} finally {
|
|
684
|
+
releaseOnce();
|
|
685
|
+
}
|
|
686
|
+
} catch (err) {
|
|
687
|
+
releaseOnce();
|
|
688
|
+
if (spawnedSession !== void 0 && isolatedWorkspace) {
|
|
689
|
+
let sessionClosed = false;
|
|
690
|
+
try {
|
|
691
|
+
if (spawnedSession.attached) {
|
|
692
|
+
if (spawnedSession.clientId) {
|
|
693
|
+
await bridge.detachClient(
|
|
694
|
+
spawnedSession.sessionId,
|
|
695
|
+
spawnedSession.clientId
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
} else {
|
|
699
|
+
sessionClosed = await bridge.killSession(spawnedSession.sessionId, {
|
|
700
|
+
requireZeroAttaches: true
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
} catch (cleanupError) {
|
|
704
|
+
log.debug(
|
|
705
|
+
"sub-session: isolated session rollback failed",
|
|
706
|
+
spawnedSession.sessionId,
|
|
707
|
+
cleanupError
|
|
708
|
+
);
|
|
709
|
+
}
|
|
710
|
+
if (sessionClosed) {
|
|
711
|
+
if (!promptDispatched) {
|
|
712
|
+
try {
|
|
713
|
+
await new SessionService(boundWorkspace).removeSession(
|
|
714
|
+
spawnedSession.sessionId
|
|
715
|
+
);
|
|
716
|
+
} catch (cleanupError) {
|
|
717
|
+
log.debug(
|
|
718
|
+
"sub-session: isolated transcript cleanup failed",
|
|
719
|
+
spawnedSession.sessionId,
|
|
720
|
+
cleanupError
|
|
721
|
+
);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
try {
|
|
725
|
+
await isolatedWorkspace.discardEmptyDirectory(
|
|
726
|
+
spawnedSession.sessionId
|
|
727
|
+
);
|
|
728
|
+
} catch (cleanupError) {
|
|
729
|
+
log.debug(
|
|
730
|
+
"sub-session: isolated workspace cleanup failed",
|
|
731
|
+
spawnedSession.sessionId,
|
|
732
|
+
cleanupError
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
} else if (spawnedSession !== void 0) {
|
|
737
|
+
try {
|
|
738
|
+
void bridge.closeSession(spawnedSession.sessionId).catch(() => {
|
|
739
|
+
});
|
|
740
|
+
} catch (closeErr) {
|
|
741
|
+
log.debug(
|
|
742
|
+
"sub-session: closeSession threw",
|
|
743
|
+
spawnedSession.sessionId,
|
|
744
|
+
closeErr
|
|
745
|
+
);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
writeStderrLine(
|
|
749
|
+
`qwen serve: create_sub_session failed: ${err instanceof Error ? err.message : String(err)}`
|
|
750
|
+
);
|
|
751
|
+
throw err instanceof Error ? err : new Error(String(err));
|
|
752
|
+
}
|
|
753
|
+
}, "launch");
|
|
754
|
+
return {
|
|
755
|
+
launch,
|
|
756
|
+
stop: /* @__PURE__ */ __name(() => {
|
|
757
|
+
stopAc.abort();
|
|
758
|
+
}, "stop")
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
__name(createSubSessionLauncher, "createSubSessionLauncher");
|
|
762
|
+
export {
|
|
763
|
+
MAX_CONCURRENT_SUB_SESSIONS_PER_CALLER,
|
|
764
|
+
MAX_CONCURRENT_SUB_SESSIONS_TOTAL,
|
|
765
|
+
MAX_TRACKED_SPAWNED_SESSIONS,
|
|
766
|
+
createSubSessionLauncher
|
|
767
|
+
};
|
|
768
|
+
/**
|
|
769
|
+
* @license
|
|
770
|
+
* Copyright 2025 Qwen Team
|
|
771
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
772
|
+
*/
|