@qwen-code/qwen-code 0.21.0 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/qc-helper/docs/configuration/model-providers.md +2 -0
- package/bundled/qc-helper/docs/configuration/settings.md +38 -28
- package/bundled/qc-helper/docs/features/channels/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/channels/github.md +107 -0
- package/bundled/qc-helper/docs/features/channels/overview.md +61 -6
- package/bundled/qc-helper/docs/features/code-review.md +1 -1
- package/bundled/qc-helper/docs/features/hooks.md +52 -15
- package/bundled/qc-helper/docs/features/mcp.md +9 -1
- package/bundled/qc-helper/docs/features/scheduled-tasks.md +3 -1
- package/bundled/qc-helper/docs/features/sub-agents.md +20 -0
- package/bundled/qc-helper/docs/qwen-serve.md +4 -2
- package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +2 -2
- package/bundled/qc-helper/docs/support/troubleshooting.md +2 -1
- package/bundled/review/DESIGN.md +19 -0
- package/bundled/review/SKILL.md +120 -61
- package/chunks/MaxSizedBox-VI3ROJJA.js +84 -0
- package/chunks/{StandaloneSessionPicker-BIRMPLRD.js → StandaloneSessionPicker-LYXKD2EV.js} +67 -68
- package/chunks/{acp-startup-profiler-RV3IV562.js → acp-startup-profiler-DFVPFQ6C.js} +2 -2
- package/chunks/{acpAgent-6J2U72PQ.js → acpAgent-WN5SRDQO.js} +1373 -553
- package/chunks/agent-K6ECSM64.js +80 -0
- package/chunks/agent-headless-NO4Y2HOE.js +74 -0
- package/chunks/{anthropicContentGenerator-75BKLTSP.js → anthropicContentGenerator-V2QOGVYD.js} +79 -27
- package/chunks/{artifact-tool-Y5T7GG7F.js → artifact-tool-6K6U7XYJ.js} +4 -4
- package/chunks/{askUserQuestion-2H6747FR.js → askUserQuestion-GD2IJJ7I.js} +4 -4
- package/chunks/bridge-3KJEWDNE.js +90 -0
- package/chunks/{build-RV63TIRH.js → build-S6DO7LMM.js} +1 -1
- package/chunks/{ca-25EDXPFZ.js → ca-6W3SK7OQ.js} +6 -1
- package/chunks/channel-management-service-XR7GZSWF.js +403 -0
- package/chunks/channel-settings-store-HW4FXXUA.js +87 -0
- package/chunks/{channel-worker-group-2ZD7TVAT.js → channel-worker-group-XDPTDWTX.js} +11 -6
- package/chunks/{channel-worker-manager-4OA4BCGB.js → channel-worker-manager-YYEHVRRE.js} +11 -6
- package/chunks/{channel-worker-supervisor-V7KCFJTS.js → channel-worker-supervisor-74HTWA2G.js} +7 -5
- package/chunks/{chunk-M5JM7OSF.js → chunk-2DN4J57Y.js} +2 -3
- package/chunks/{chunk-ETSW4KLJ.js → chunk-2FAK6PNM.js} +2 -2
- package/chunks/{chunk-BPJSQIJX.js → chunk-2J3OJGTL.js} +0 -2
- package/chunks/{chunk-EPDRMGT4.js → chunk-2LKVPASC.js} +4 -28
- package/chunks/{chunk-PWTZEM3C.js → chunk-2LQTH543.js} +3 -37
- package/chunks/{chunk-LH2BYDQ5.js → chunk-2N7CODY5.js} +18 -12
- package/chunks/{chunk-4WIZGAH3.js → chunk-2XSLTRFZ.js} +6 -58
- package/chunks/{chunk-FSITMZJH.js → chunk-3EFXSQCM.js} +18 -9
- package/chunks/{chunk-HIJQF5B5.js → chunk-3L2SPEBH.js} +1 -1
- package/chunks/{chunk-BIQWWWJN.js → chunk-4G2BISNC.js} +1 -1
- package/chunks/{chunk-PWVFN2LF.js → chunk-52ZSWYEG.js} +1 -1
- package/chunks/{chunk-ZJHVAS7M.js → chunk-5KTQXHPY.js} +4 -5
- package/chunks/{chunk-PC6JANNU.js → chunk-5MKRTI4T.js} +4 -4
- package/chunks/{chunk-DHHOYAPR.js → chunk-5TBMQLGG.js} +7 -7
- package/chunks/{chunk-A4UCTEB5.js → chunk-5WV5S2GT.js} +0 -1
- package/chunks/chunk-5YKDXHUY.js +463 -0
- package/chunks/chunk-5ZF5XXTS.js +363 -0
- package/chunks/{chunk-K4XWPEWB.js → chunk-64LQLPL7.js} +4 -33
- package/chunks/{chunk-YPE6A4GC.js → chunk-657BH7VM.js} +2 -2
- package/chunks/{chunk-R5AFZNQW.js → chunk-65PQENQP.js} +14 -7
- package/chunks/{chunk-RIBKPMRP.js → chunk-6PE7N3A4.js} +18 -7
- package/chunks/{chunk-JZA3JUDJ.js → chunk-6QIGFD5W.js} +1 -1
- package/chunks/{chunk-JVPM2ULZ.js → chunk-6RPMI2AB.js} +6 -6
- package/chunks/{chunk-OHNBB4XR.js → chunk-75GFAX4R.js} +1 -1
- package/chunks/{chunk-NIBLUX3Y.js → chunk-75MIQ3LV.js} +148 -21
- package/chunks/{chunk-U7M2DMGW.js → chunk-7AEJDLRA.js} +130 -5
- package/chunks/{chunk-TPRQ7RZH.js → chunk-7BAU433D.js} +2293 -945
- package/chunks/{chunk-M4FMGVY4.js → chunk-7DXQIJID.js} +3 -3
- package/chunks/{chunk-RWTEFFPU.js → chunk-7I5GTCT4.js} +620 -383
- package/chunks/{chunk-A5L3JMUA.js → chunk-7XATOOE7.js} +18 -4
- package/chunks/{chunk-Y34KJKDC.js → chunk-A2D5BAVP.js} +1 -1
- package/chunks/{chunk-5I2IWRSH.js → chunk-A3NDJ5SB.js} +2 -2
- package/chunks/{chunk-OFDOK3VM.js → chunk-A4COXFB3.js} +8 -13
- package/chunks/{chunk-JLU636DO.js → chunk-ALMR3E6Q.js} +1 -0
- package/chunks/{chunk-Q4M4MDQ4.js → chunk-AQIDMUGU.js} +1 -1
- package/chunks/{chunk-PJIZUQVC.js → chunk-AZQ3DT76.js} +2 -2
- package/chunks/{chunk-UH3WSE5L.js → chunk-B4AJNNOL.js} +1 -6
- package/chunks/{chunk-BJX6ZSUK.js → chunk-BCZFQXWK.js} +2 -2
- package/chunks/{chunk-MB4MZHMJ.js → chunk-BGTQCTQW.js} +211 -522
- package/chunks/{chunk-MZAXJAUM.js → chunk-BMFALVGQ.js} +1 -1
- package/chunks/{chunk-PSOO6YXD.js → chunk-BNWB5CYE.js} +9 -7
- package/chunks/{chunk-BKHWX6I2.js → chunk-BPZKP57P.js} +11 -3
- package/chunks/{chunk-H4SBPHSA.js → chunk-CAPPWD3X.js} +3 -3
- package/chunks/{chunk-LQIW3YFY.js → chunk-CQL64ESB.js} +7 -7
- package/chunks/{chunk-TOFQCPDC.js → chunk-CVHIL5IG.js} +4 -5
- package/chunks/{chunk-XVNQMZ2I.js → chunk-DGEIYUC3.js} +0 -1
- package/chunks/{chunk-BPZALHVR.js → chunk-DI35ZN7T.js} +1 -1
- package/chunks/chunk-DZLYR4U3.js +1252 -0
- package/chunks/{chunk-TEHGS6UP.js → chunk-EIF3FXTB.js} +117 -24
- package/chunks/{chunk-2SCDWPXI.js → chunk-EJGJIBRS.js} +5 -5
- package/chunks/{chunk-7MVVZO4N.js → chunk-EVKE2FZL.js} +4 -4
- package/chunks/{chunk-OKY7HXPG.js → chunk-FNMZK765.js} +2 -2
- package/chunks/{chunk-VIA5XA4U.js → chunk-FTD6DP4T.js} +3 -1
- package/chunks/chunk-FYJ7W2PI.js +194 -0
- package/chunks/{chunk-L5UHQJTJ.js → chunk-GATT5TKW.js} +1 -1
- package/chunks/{chunk-X5XDDSSH.js → chunk-GEBV2JGB.js} +28 -5
- package/chunks/{chunk-VAK25FTU.js → chunk-GKX7E4CO.js} +1 -1
- package/chunks/{chunk-LS77BEZP.js → chunk-GLCZKT5V.js} +1 -5
- package/chunks/{chunk-5NBDS5S6.js → chunk-GNR2RNMP.js} +162 -7
- package/chunks/{chunk-YH6G52F2.js → chunk-GXIJHV66.js} +4 -4
- package/chunks/chunk-GZ3RCT54.js +76 -0
- package/chunks/{chunk-2X55UKQE.js → chunk-HMRM2A3U.js} +3 -3
- package/chunks/chunk-HV26XH34.js +319 -0
- package/chunks/{chunk-LB6DUZ26.js → chunk-J7OACQDE.js} +229 -172
- package/chunks/{chunk-K36B6G2O.js → chunk-JFMA7Y5M.js} +5 -5
- package/chunks/{chunk-55DJUCI2.js → chunk-JHNRZMHI.js} +53 -43
- package/chunks/{chunk-63P4EL5V.js → chunk-JMONIXMJ.js} +1 -1
- package/chunks/{chunk-L26JL52R.js → chunk-JSD33JG6.js} +47 -64
- package/chunks/{chunk-YBL3QUDD.js → chunk-JTV5K7NH.js} +1 -1
- package/chunks/{chunk-RZIX2G32.js → chunk-JX27F6QS.js} +1 -1
- package/chunks/chunk-JYBU6YUE.js +378 -0
- package/chunks/{chunk-7JURR4JT.js → chunk-KAMYKP7E.js} +167 -81
- package/chunks/{chunk-KMQ33DO4.js → chunk-KCO4FLFJ.js} +4 -4
- package/chunks/{chunk-2W3OOD4W.js → chunk-L55JWS76.js} +6 -3
- package/chunks/{chunk-RHLZR4E5.js → chunk-LGAOC3ZS.js} +1 -1
- package/chunks/{chunk-EBJQ6AXW.js → chunk-LO4ROVP4.js} +262 -16
- package/chunks/{chunk-NH6KE4JX.js → chunk-LW3RFMG7.js} +3 -3
- package/chunks/{chunk-J56UI34H.js → chunk-M7OONWYU.js} +2 -2
- package/chunks/{chunk-2NH6DYI4.js → chunk-MHAIJPTD.js} +12 -12
- package/chunks/{chunk-FODK6UMO.js → chunk-MPHPFVKK.js} +0 -2
- package/chunks/{chunk-VRYUBFMC.js → chunk-MR5EAQ5M.js} +1 -1
- package/chunks/{chunk-JESCGQM3.js → chunk-NAVJD2PQ.js} +8 -7
- package/chunks/{chunk-H5FFA6TH.js → chunk-NOKIVHOL.js} +16 -3
- package/chunks/{chunk-6OUGMXDC.js → chunk-NWNEANAT.js} +7 -7
- package/chunks/{chunk-SQCQ4KO2.js → chunk-OCESJA77.js} +393 -330
- package/chunks/chunk-OCPBI7J5.js +18 -0
- package/chunks/{chunk-E5TUC6CA.js → chunk-OKF7JF3R.js} +3 -3
- package/chunks/{chunk-TGILQ3YH.js → chunk-P4WOAOJW.js} +141 -64
- package/chunks/{chunk-ZFDTEDCF.js → chunk-PB3MBFKG.js} +6 -6
- package/chunks/{chunk-3RN6GBKS.js → chunk-PLDQBIO6.js} +1 -1
- package/chunks/{chunk-FNQ6T3CV.js → chunk-PONHVBRT.js} +10 -7
- package/chunks/{chunk-CIKQ7KKO.js → chunk-PT722TDT.js} +271 -376
- package/chunks/chunk-Q43KPN7X.js +2196 -0
- package/chunks/{chunk-VDDGDZMA.js → chunk-QHWCP53L.js} +14 -7
- package/chunks/{chunk-MVSUYZDT.js → chunk-QIZKCVM3.js} +4 -4
- package/chunks/{chunk-QAF7NMK7.js → chunk-RCUQIPTN.js} +1 -1
- package/chunks/{chunk-6FGBXPWM.js → chunk-RPLGZJV2.js} +38 -44
- package/chunks/{chunk-GSN55ZRI.js → chunk-S4WJVPZW.js} +19 -7
- package/chunks/{chunk-6AM5D4ME.js → chunk-S6LOFUVP.js} +0 -12
- package/chunks/{chunk-BULDBTYC.js → chunk-S7W2GKIO.js} +1 -28
- package/chunks/{chunk-MUP3T3AD.js → chunk-SGFT55XI.js} +1 -35
- package/chunks/{chunk-VYPFXUCB.js → chunk-SZ3KHTDR.js} +1 -1
- package/chunks/chunk-T26EAKDL.js +13 -0
- package/chunks/{chunk-UDX5OBWR.js → chunk-T2QMKU3R.js} +80 -2
- package/chunks/{chunk-IKYJHJNF.js → chunk-T3O2B4XO.js} +3 -3
- package/chunks/{chunk-RF3EXIHJ.js → chunk-T4TXDL7G.js} +32 -21
- package/chunks/{chunk-J24WCGIN.js → chunk-TBBV36Y4.js} +4 -4
- package/chunks/{chunk-LKEJ26GS.js → chunk-TCIFAA7K.js} +16 -11
- package/chunks/{chunk-JXJFVC6E.js → chunk-TDL6LB4K.js} +46 -11
- package/chunks/{chunk-7ZCNENPP.js → chunk-TFRMVU6R.js} +1 -1
- package/chunks/{chunk-VULLI6WQ.js → chunk-TV64SXKD.js} +6 -6
- package/chunks/{chunk-FQK6JAFG.js → chunk-U3E3UQAA.js} +4 -4
- package/chunks/{chunk-LK7CHLVP.js → chunk-U4VTUMMK.js} +0 -60
- package/chunks/{chunk-ACY3A37B.js → chunk-UBEPNVDI.js} +23 -18
- package/chunks/{chunk-NL7LTRLR.js → chunk-UHUSJ6X7.js} +29 -68
- package/chunks/{chunk-ZOIFNCKL.js → chunk-UPUG4GXM.js} +3 -23
- package/chunks/{chunk-6GMVPFB2.js → chunk-UWMLWVCA.js} +19 -6
- package/chunks/{chunk-IKCX4CCL.js → chunk-VCPIZRYH.js} +118 -95
- package/chunks/{chunk-ZNAUOR2I.js → chunk-VWOOBLTY.js} +2 -2
- package/chunks/{chunk-YX324OPW.js → chunk-VYOXCEPJ.js} +1 -1
- package/chunks/{chunk-USTWD7QV.js → chunk-W4MIWP6M.js} +26 -16
- package/chunks/{chunk-HTR4WV6U.js → chunk-W4RQUHY3.js} +31 -1
- package/chunks/{chunk-DLWL3Z7A.js → chunk-WBSMNTSV.js} +3 -3
- package/chunks/{chunk-IO3IX5Q4.js → chunk-WUZ7H6DP.js} +1 -1
- package/chunks/{chunk-2JZBVYTU.js → chunk-WZRWHXFE.js} +1 -8
- package/chunks/{chunk-PHOF65IG.js → chunk-X5WNMMIA.js} +23553 -34321
- package/chunks/chunk-XBYYDKAZ.js +80 -0
- package/chunks/{chunk-COH43MRJ.js → chunk-XCGIMOLN.js} +27 -1
- package/chunks/{chunk-WCXCRJYB.js → chunk-XFZYFU3I.js} +1 -1
- package/chunks/{chunk-3QMGYBFN.js → chunk-XWWKIXVD.js} +1 -80
- package/chunks/{chunk-3SJ43L4W.js → chunk-XZC5VLBZ.js} +2 -0
- package/chunks/{chunk-UUUTRMI2.js → chunk-Y4IHBGBP.js} +1 -1
- package/chunks/{chunk-PR75REBZ.js → chunk-Y6AXW2OG.js} +12 -82
- package/chunks/{chunk-IPUUTYMV.js → chunk-YDLJGZHL.js} +1 -1
- package/chunks/{chunk-IJTOWOD7.js → chunk-YGF33UXG.js} +82 -8
- package/chunks/chunk-Z4X5MTRT.js +133 -0
- package/chunks/{chunk-UW5EOVUN.js → chunk-ZBVS26BY.js} +4 -4
- package/chunks/{chunk-ZD6UTE4A.js → chunk-ZHBO7WVX.js} +1 -1
- package/chunks/{chunk-HTO4JFDZ.js → chunk-ZPJWUGCS.js} +0 -1
- package/chunks/{chunk-KIM5GUMA.js → chunk-ZURDMIDR.js} +368 -156
- package/chunks/{computer-use-SOQ4E3VX.js → computer-use-ZTIDHMMA.js} +49 -50
- package/chunks/{config-utils-7V7GGIW6.js → config-utils-NYSXDMEQ.js} +4 -3
- package/chunks/contextCommand-2PIEU37Z.js +79 -0
- package/chunks/core-runtime-3XEYLQFK.js +133 -0
- package/chunks/{create-sub-session-QRJLW5BV.js → create-sub-session-R76FVXCI.js} +46 -47
- package/chunks/{create-sub-session-IWW2IZ2T.js → create-sub-session-SBYUMSSS.js} +3 -3
- package/chunks/{cron-create-YIID5XAW.js → cron-create-2QK6TCEC.js} +6 -6
- package/chunks/{cron-delete-ZVHYCEP2.js → cron-delete-FDCDFYMG.js} +5 -5
- package/chunks/{cron-list-XEGS463Q.js → cron-list-XN3WVBTP.js} +6 -6
- package/chunks/{daemon-YO6433NF.js → daemon-Q2AB5Z23.js} +356 -15
- package/chunks/daemon-status-provider-3XJI6CAL.js +89 -0
- package/chunks/daemon-trust-policy-ILUDTLHD.js +84 -0
- package/chunks/daemon-trust-policy-monitor-HS3PKKRO.js +171 -0
- package/chunks/{de-HGRCYDEJ.js → de-SY6O76BF.js} +6 -1
- package/chunks/deferred-core-runtime-X4QV662U.js +88 -0
- package/chunks/dist-BSTVRPMT.js +4227 -0
- package/chunks/{dist-46NQKLTW.js → dist-DOLYHMXE.js} +2 -2
- package/chunks/{dist-AIKFMUKK.js → dist-HVRQ2CFL.js} +271 -11
- package/chunks/{dist-WEAHOXDM.js → dist-IXQEQWRG.js} +2 -1
- package/chunks/{dist-BBLXMS3N.js → dist-SSU66DM4.js} +3 -3
- package/chunks/{dist-F6IBUDR4.js → dist-SV7Q3AWJ.js} +1 -1
- package/chunks/{dist-YFNEUWSE.js → dist-YGBBMK3Z.js} +1 -1
- package/chunks/earlyInputCapture-XKLZT7ZD.js +81 -0
- package/chunks/{edit-OBDSQURM.js → edit-HHGIOTQ2.js} +47 -48
- package/chunks/{en-MTWBNGDO.js → en-NBK3JKCE.js} +9 -1
- package/chunks/{enter-worktree-U6MRPQ2P.js → enter-worktree-ZN7PUQ46.js} +47 -48
- package/chunks/{enterPlanMode-BC5QUZZ2.js → enterPlanMode-EIFIDSIV.js} +47 -48
- package/chunks/{environment-W5UFC2CH.js → environment-XXQ75D2Q.js} +48 -49
- package/chunks/errors-4GMVU7CK.js +87 -0
- package/chunks/esm-K5FARBNI.js +5548 -0
- package/chunks/{exit-worktree-DGNYMECB.js → exit-worktree-GXMI4ATY.js} +47 -48
- package/chunks/exitPlanMode-34UVY7M6.js +72 -0
- package/chunks/{fast-path-JJZFJANL.js → fast-path-VPIVA7L6.js} +16 -6
- package/chunks/{fr-45RLL55O.js → fr-4KG5V7UT.js} +6 -1
- package/chunks/{gemini-QS36EBZV.js → gemini-4BWIK4WD.js} +102 -99
- package/chunks/{geminiContentGenerator-AG4KB6CV.js → geminiContentGenerator-3XVV5MSS.js} +40 -11
- package/chunks/{getMachineId-bsd-V7W3GODC.js → getMachineId-bsd-FG7IUY6U.js} +1 -1
- package/chunks/{getMachineId-darwin-TDO75DQP.js → getMachineId-darwin-GLCJI2RA.js} +1 -1
- package/chunks/{getMachineId-linux-TF43WQT2.js → getMachineId-linux-O6OPPAKO.js} +1 -1
- package/chunks/{getMachineId-unsupported-ZGUO3TXT.js → getMachineId-unsupported-S6CKYVGC.js} +1 -1
- package/chunks/{getMachineId-win-ECFYZZFQ.js → getMachineId-win-X5SRNEH7.js} +1 -1
- package/chunks/{glob-V7R3PSK3.js → glob-TZ2ABCJG.js} +47 -48
- package/chunks/{grep-QYPSK7OP.js → grep-BEF463NA.js} +49 -49
- package/chunks/handleAutoUpdate-L6ERF36Y.js +80 -0
- package/chunks/i18n-FMM5FDXR.js +96 -0
- package/chunks/{image-gen-Z3VPGKRC.js → image-gen-HHVLF7HS.js} +12 -12
- package/chunks/initializer-625TIAIO.js +85 -0
- package/chunks/installationInfo-6AM4I2Y3.js +79 -0
- package/chunks/{ja-B7DF7DFG.js → ja-F3GSQXMF.js} +6 -1
- package/chunks/{keychain-token-storage-MDTG3WRM.js → keychain-token-storage-72IYCAZV.js} +3 -3
- package/chunks/lib-RUF3WZA6.js +9 -0
- package/chunks/list-L2GA674Y.js +88 -0
- package/chunks/{list-agents-5KJJHR6I.js → list-agents-R6KDXQR3.js} +3 -3
- package/chunks/loadedSettingsAdapter-SPUTNKAV.js +82 -0
- package/chunks/{loggingContentGenerator-HS3S5H3Q.js → loggingContentGenerator-LKOF7XI7.js} +78 -113
- package/chunks/{loop-wakeup-FXKNNYSY.js → loop-wakeup-3IQKCYAH.js} +7 -7
- package/chunks/{ls-NTK6VOQJ.js → ls-DKZ37A7N.js} +5 -5
- package/chunks/{lsp-2JI24STP.js → lsp-QNWN7KN3.js} +3 -3
- package/chunks/{managed-npm-update-JYEMMXA3.js → managed-npm-update-ACQGGIN5.js} +47 -48
- package/chunks/mcp-SZLHKFJW.js +82 -0
- package/chunks/{monitor-R3ODH5U6.js → monitor-DF52UVHI.js} +47 -48
- package/chunks/nonInteractiveCli-5T7KYKLK.js +144 -0
- package/chunks/{notebook-edit-BNOK452R.js → notebook-edit-FCWS4XVN.js} +47 -48
- package/chunks/{openaiContentGenerator-WMCU3O2H.js → openaiContentGenerator-7LDK3DCJ.js} +26 -27
- package/chunks/pidfile-6ERW3DF4.js +85 -0
- package/chunks/process-registry-2CHQBXH5.js +157 -0
- package/chunks/{processUtils-RT7UNCC2.js → processUtils-COKZAMUP.js} +2 -2
- package/chunks/{pt-22Q3FP73.js → pt-EQ33KWEN.js} +6 -1
- package/chunks/{qwenContentGenerator-HHCRK4SX.js → qwenContentGenerator-TKWUMR7N.js} +52 -53
- package/chunks/{qwenOAuth2-OWLB5AKH.js → qwenOAuth2-7HMU47SF.js} +10 -10
- package/chunks/read-file-X6DRC574.js +29 -0
- package/chunks/{read-mcp-resource-4DKQWGHD.js → read-mcp-resource-GFTWYXMK.js} +4 -4
- package/chunks/{record-artifact-RQKFYO5B.js → record-artifact-XAMSFSW4.js} +3 -3
- package/chunks/resumeHistoryUtils-PFPM2GWM.js +90 -0
- package/chunks/ripGrep-OWV2IVJC.js +72 -0
- package/chunks/{ru-FZCNZHDC.js → ru-7OZAUKGG.js} +6 -1
- package/chunks/{run-qwen-serve-FU6HEM4J.js → run-qwen-serve-TSTCO4XE.js} +953 -249
- package/chunks/{runtime-XXRRTNP6.js → runtime-DAUPSUKI.js} +56 -56
- package/chunks/{scheduler-G2ZS2Z7E.js → scheduler-KMADMT26.js} +46 -47
- package/chunks/{sdk-exporters-grpc-AK3LGHNO.js → sdk-exporters-grpc-54L4LS5L.js} +4 -4
- package/chunks/{sdk-exporters-http-FYBSUCPD.js → sdk-exporters-http-WO556XNU.js} +7 -7
- package/chunks/{sdk-impl-GMVPB7NB.js → sdk-impl-LPAVACSF.js} +14 -14
- package/chunks/{send-message-Q6OOR6BR.js → send-message-SAWK4DZX.js} +6 -6
- package/chunks/serve-NNRWS6F4.js +88 -0
- package/chunks/{server-4UMH7OIZ.js → server-WEH7DVCH.js} +3691 -823
- package/chunks/{session-K3O3Q2SV.js → session-WXC56V2I.js} +98 -95
- package/chunks/{settings-CR2EWTBA.js → settings-DJDXFDZ3.js} +55 -56
- package/chunks/shell-JN5VRQXD.js +82 -0
- package/chunks/{skill-I3SDA4MB.js → skill-SGXPKJCS.js} +20 -21
- package/chunks/skill-settings-VJ5PDMZI.js +90 -0
- package/chunks/spawnChannel-ETMJW7YX.js +81 -0
- package/chunks/standalone-update-MK3Z7KBI.js +91 -0
- package/chunks/{startInteractiveUI-SLZGHRPH.js → startInteractiveUI-ZCGIXPGT.js} +724 -383
- package/chunks/{syntheticOutput-I3757IWH.js → syntheticOutput-355CB6CJ.js} +4 -4
- package/chunks/{task-create-N7WQSGYA.js → task-create-INGWNUG4.js} +10 -10
- package/chunks/{task-list-FOPULZEP.js → task-list-5XNNGTF4.js} +7 -7
- package/chunks/{task-stop-H6RHXFVQ.js → task-stop-4ROAOBXH.js} +3 -3
- package/chunks/{task-update-M57TFZJT.js → task-update-CRK5VWWZ.js} +10 -10
- package/chunks/{team-create-YJALH5D2.js → team-create-QQGAJG7P.js} +49 -50
- package/chunks/{team-delete-QE2UXJL7.js → team-delete-S2RCXA4P.js} +7 -7
- package/chunks/{team-plan-approval-34QFYKGN.js → team-plan-approval-RT7Q5R6O.js} +47 -48
- package/chunks/theme-manager-EEWIQJ7J.js +76 -0
- package/chunks/{todoWrite-VQ7FKOHL.js → todoWrite-7WM3VDMY.js} +7 -7
- package/chunks/{tool-search-NF7GB6LE.js → tool-search-Z3Z4AYKP.js} +19 -21
- package/chunks/total-session-admission-44JKRWQD.js +84 -0
- package/chunks/trustedFolders-X2JEIO57.js +94 -0
- package/chunks/{update-relaunch-WBUZJC5O.js → update-relaunch-VWNPYDIP.js} +5 -5
- package/chunks/updateCheck-KAQH67DV.js +91 -0
- package/chunks/useAutoAcceptIndicator-JH6BCF7S.js +92 -0
- package/chunks/{validateNonInterActiveAuth-3R223G3R.js → validateNonInterActiveAuth-GIUJ2UFS.js} +93 -90
- package/chunks/{version-HS7YSFHV.js → version-BGLYIJUY.js} +1 -1
- package/chunks/{web-fetch-NKCSG7ZE.js → web-fetch-OTDU4VQF.js} +19 -21
- package/chunks/{web-search-S62WAP4S.js → web-search-FP6SIHPR.js} +13 -13
- package/chunks/{workflow-QAGU5RU4.js → workflow-YCIVBYSB.js} +48 -49
- package/chunks/workspace-providers-status-S35YAIUS.js +85 -0
- package/chunks/{workspace-registration-store-24JMHDGF.js → workspace-registration-store-OTMS3H4C.js} +1 -1
- package/chunks/workspace-registry-O63R6IZ4.js +92 -0
- package/chunks/workspace-service-M6LLHKJ5.js +99 -0
- package/chunks/workspace-skills-status-C2V7BAIS.js +85 -0
- package/chunks/workspace-trust-reconciler-IBUPOUJN.js +345 -0
- package/chunks/write-file-3BZC3EAE.js +72 -0
- package/chunks/xterm-headless-NTYVIBT3.js +3475 -0
- package/chunks/{zh-LUIGBD55.js → zh-H3YDK5QW.js} +9 -1
- package/chunks/{zh-TW-F5KG2IYD.js → zh-TW-JYCP7XUA.js} +9 -1
- package/chunks/zoom-image-TZ6S2O57.js +351 -0
- package/cli.js +13 -13
- package/locales/ca.js +7 -2
- package/locales/de.js +7 -2
- package/locales/en.js +10 -2
- package/locales/fr.js +7 -2
- package/locales/ja.js +7 -2
- package/locales/pt.js +7 -2
- package/locales/ru.js +7 -2
- package/locales/zh-TW.js +10 -2
- package/locales/zh.js +10 -2
- package/package.json +5 -4
- package/web-shell/assets/{arc-DcbWnB9T.js → arc-75-Wdeo3.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-kMMF5sud.js → architectureDiagram-3BPJPVTR-FKeXQbyP.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-Htl9vTJS.js → blockDiagram-GPEHLZMM-CY0vc-A3.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-BnZnm0mQ.js → c4Diagram-AAUBKEIU-CNP-A-8u.js} +1 -1
- package/web-shell/assets/channel-DPYMT76A.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-DziB7kDG.js → chunk-2J33WTMH-GybS4Gii.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-CmkD8daw.js → chunk-4BX2VUAB-02H91V8v.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-CHAd9A_U.js → chunk-55IACEB6-D3M-2VT6.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-Dqaam3fE.js → chunk-727SXJPM-CCu29u4H.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-D_-saBYM.js → chunk-AQP2D5EJ-CaFKWgrn.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-B9r_veWD.js → chunk-FMBD7UC4-ZZpPqIwQ.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-B3EaCSpL.js → chunk-ND2GUHAM-D22DqGs8.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-CYq8x9mn.js → chunk-QZHKN3VN-Bu85S0fw.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK--JstsIgL.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2--JstsIgL.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-D0ng4uiB.js → cose-bilkent-S5V4N54A-f1CK1Gwe.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-DCZollQv.js → dagre-BM42HDAG-D0Ow8F_n.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-Dfk2pWS0.js → diagram-2AECGRRQ-BPrmTWp8.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-kX38ltWR.js → diagram-5GNKFQAL-HccuFAzy.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-CJz2vsXh.js → diagram-KO2AKTUF-BrS76mbA.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-BvMLZm_7.js → diagram-LMA3HP47-V7T9lU-5.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-l7kfStkO.js → diagram-OG6HWLK6-DKidyJMR.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-BSVa8GGT.js → erDiagram-TEJ5UH35-DBadZIkp.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-CoawKIXH.js → flowDiagram-I6XJVG4X-BymfqdNJ.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-DFUDH0zF.js → ganttDiagram-6RSMTGT7-DOw340jf.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-Y2pvpT4e.js → gitGraphDiagram-PVQCEYII-_8EiD8sl.js} +1 -1
- package/web-shell/assets/{index-D0GX0zZf.js → index-CKIadvET.js} +1 -1
- package/web-shell/assets/index-D1eXNRHe.js +1389 -0
- package/web-shell/assets/index-DVLD4CQq.css +5 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-CU8_zLiX.js → infoDiagram-5YYISTIA-D61KYQBu.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-AVQiV0DU.js → ishikawaDiagram-YF4QCWOH-CsiXSpNx.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-DQ0VSKa3.js → journeyDiagram-JHISSGLW-Sdfionyh.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-BqnWqsE_.js → kanban-definition-UN3LZRKU-C3WI3Cnl.js} +1 -1
- package/web-shell/assets/{linear-BkoihsaA.js → linear-Dpigcc62.js} +1 -1
- package/web-shell/assets/{mermaid.core-5RJs-31j.js → mermaid.core-Ct97pqgW.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-D33Bxnpd.js → mindmap-definition-RKZ34NQL-BzeaN0rB.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-BuEAw3BH.js → pieDiagram-4H26LBE5-CvjgcbVD.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-Kox_usEq.js → quadrantDiagram-W4KKPZXB-BUzgTNdH.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-CNjeUif0.js → requirementDiagram-4Y6WPE33-B7zKlgUQ.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-BCd2OL_U.js → sankeyDiagram-5OEKKPKP-Bb9CQgrT.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CF2ZTsz0.js → sequenceDiagram-3UESZ5HK-DJ6V7itG.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-qenSzHtm.js → stateDiagram-AJRCARHV-IImflERY.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-CYI_YoNR.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-B5DyWdgs.js → timeline-definition-PNZ67QCA-6Q_uWHKh.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-DqP4I_o_.js → vennDiagram-CIIHVFJN-TmyKyjwv.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-CJe2e4mg.js → wardley-L42UT6IY-CRh9uiPv.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BMDSw-Rr.js → wardleyDiagram-YWT4CUSO-59TKAW8w.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-BTVZYkxD.js → xychartDiagram-2RQKCTM6-GCSUIK2L.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/MaxSizedBox-5DPPWPGT.js +0 -85
- package/chunks/agent-6ODUANDO.js +0 -81
- package/chunks/agent-headless-7BYQTMHW.js +0 -75
- package/chunks/bridge-ZUB64FAE.js +0 -90
- package/chunks/chunk-LEH5C7FV.js +0 -232
- package/chunks/chunk-SZRN75WQ.js +0 -29
- package/chunks/chunk-UGYMA4EI.js +0 -219
- package/chunks/chunk-Z2BC6UJ5.js +0 -8575
- package/chunks/contextCommand-JLHYA34Z.js +0 -80
- package/chunks/daemon-status-provider-2233Q37D.js +0 -89
- package/chunks/earlyInputCapture-A7NDU3PF.js +0 -82
- package/chunks/errors-M7CLORXH.js +0 -88
- package/chunks/exitPlanMode-GXTBWQAR.js +0 -403
- package/chunks/handleAutoUpdate-6DBEZYPV.js +0 -81
- package/chunks/i18n-VUJJZIMU.js +0 -97
- package/chunks/initializer-UWAK5U5O.js +0 -86
- package/chunks/installationInfo-6O2YAA52.js +0 -80
- package/chunks/list-GB4ESM3T.js +0 -89
- package/chunks/loadedSettingsAdapter-OT6JVQ7U.js +0 -83
- package/chunks/mcp-6DBDJPFU.js +0 -83
- package/chunks/nonInteractiveCli-MOYCYBBU.js +0 -141
- package/chunks/pidfile-TFRZZZIO.js +0 -86
- package/chunks/read-file-APMO3PSX.js +0 -31
- package/chunks/resumeHistoryUtils-6KRYEAWZ.js +0 -91
- package/chunks/ripGrep-BEJDEDXW.js +0 -73
- package/chunks/serve-7BSTXJ4T.js +0 -89
- package/chunks/shell-HH3PF3A2.js +0 -83
- package/chunks/spawnChannel-RWNDBXGA.js +0 -82
- package/chunks/src-GE4TTTML.js +0 -3147
- package/chunks/standalone-update-Q6WFRZZQ.js +0 -92
- package/chunks/theme-manager-SWRILQHI.js +0 -77
- package/chunks/total-session-admission-DLHHHLD3.js +0 -84
- package/chunks/trustedFolders-KHXHY6PY.js +0 -93
- package/chunks/updateCheck-RKL6M5XN.js +0 -92
- package/chunks/useAutoAcceptIndicator-CFQ5BUJL.js +0 -93
- package/chunks/workspace-providers-status-QSVZUETE.js +0 -86
- package/chunks/workspace-registry-UT4RBNBM.js +0 -88
- package/chunks/workspace-service-JFWRUS4V.js +0 -98
- package/chunks/workspace-skills-status-ZBBKJOI2.js +0 -85
- package/chunks/write-file-VHIXW5M7.js +0 -73
- package/web-shell/assets/channel-Cq7YKtfC.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-CQ9aC1Tg.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CQ9aC1Tg.js +0 -1
- package/web-shell/assets/index-D9haPt0X.css +0 -5
- package/web-shell/assets/index-ckX9Pq5k.js +0 -1230
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-B7W4zlCr.js +0 -1
- package/chunks/{chunk-TARRHLLG.js → chunk-QUGAUQGJ.js} +25 -25
- package/chunks/{chunk-U7ZFW55U.js → chunk-VOQXFAY5.js} +977 -977
- /package/chunks/{chunk-LXXMOYPL.js → chunk-VXZBKKQR.js} +0 -0
|
@@ -35,55 +35,63 @@ import {
|
|
|
35
35
|
require_express,
|
|
36
36
|
resolveWebShellDir,
|
|
37
37
|
setDeferredRuntimeRequestTiming
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-YGF33UXG.js";
|
|
39
39
|
import {
|
|
40
40
|
isLoopbackBind
|
|
41
41
|
} from "./chunk-RXFQM6FQ.js";
|
|
42
42
|
import {
|
|
43
43
|
DEFAULT_COMPACTED_REPLAY_MAX_BYTES,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
DEFAULT_MAX_JOURNAL_BYTES,
|
|
45
|
+
DEFAULT_MAX_JOURNAL_EVENTS,
|
|
46
|
+
normalizeCompactedReplayMaxBytes,
|
|
47
|
+
normalizeMaxJournalBytes,
|
|
48
|
+
normalizeMaxJournalEvents
|
|
49
|
+
} from "./chunk-XCGIMOLN.js";
|
|
49
50
|
import "./chunk-WBL3FJEU.js";
|
|
50
|
-
import "./chunk-T2NCM2ET.js";
|
|
51
51
|
import {
|
|
52
52
|
resolveChannelCwd
|
|
53
|
-
} from "./chunk-
|
|
54
|
-
import {
|
|
55
|
-
loadServeFastPathSettings,
|
|
56
|
-
preResolveServeFastPathHomeEnvOverrides
|
|
57
|
-
} from "./chunk-D3UEZIQH.js";
|
|
53
|
+
} from "./chunk-TFRMVU6R.js";
|
|
58
54
|
import {
|
|
59
55
|
MAX_REGISTERED_WORKSPACES,
|
|
60
56
|
resolveWorkspaceInputs,
|
|
61
57
|
workspaceRegistrationId
|
|
62
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-AQIDMUGU.js";
|
|
59
|
+
import "./chunk-T2QMKU3R.js";
|
|
60
|
+
import {
|
|
61
|
+
LOAD_REPLAY_META_KEY
|
|
62
|
+
} from "./chunk-XZC5VLBZ.js";
|
|
63
|
+
import "./chunk-B4AJNNOL.js";
|
|
63
64
|
import {
|
|
64
65
|
canonicalizeWorkspace,
|
|
65
66
|
translateAndCheckAbsoluteWorkspacePath
|
|
66
67
|
} from "./chunk-2RFKHEXL.js";
|
|
67
|
-
import "./chunk-
|
|
68
|
-
import "./chunk-
|
|
68
|
+
import "./chunk-GNR2RNMP.js";
|
|
69
|
+
import "./chunk-FYJ7W2PI.js";
|
|
69
70
|
import {
|
|
70
71
|
ChannelDeliveryError,
|
|
71
72
|
ChannelWebhookEnqueueError,
|
|
72
73
|
QWEN_SERVER_TOKEN_ENV,
|
|
73
|
-
isChannelDeliveryError
|
|
74
|
+
isChannelDeliveryError
|
|
75
|
+
} from "./chunk-U4VTUMMK.js";
|
|
76
|
+
import {
|
|
74
77
|
normalizeWorkerDiagnostic,
|
|
75
78
|
sanitizeWorkerDiagnostic
|
|
76
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-GZ3RCT54.js";
|
|
77
80
|
import {
|
|
78
81
|
channelSelectionNames
|
|
79
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-ALMR3E6Q.js";
|
|
80
83
|
import "./chunk-BK2UNYWD.js";
|
|
81
84
|
import "./chunk-M5GB774H.js";
|
|
85
|
+
import "./chunk-5HBA2Z7V.js";
|
|
86
|
+
import "./chunk-T2NCM2ET.js";
|
|
82
87
|
import {
|
|
83
88
|
sanitizeLogText
|
|
84
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-7I5GTCT4.js";
|
|
85
90
|
import "./chunk-UDXSXLER.js";
|
|
86
|
-
import
|
|
91
|
+
import {
|
|
92
|
+
loadServeFastPathSettings,
|
|
93
|
+
preResolveServeFastPathHomeEnvOverrides
|
|
94
|
+
} from "./chunk-D3UEZIQH.js";
|
|
87
95
|
import "./chunk-GOXKNSDZ.js";
|
|
88
96
|
import {
|
|
89
97
|
getGlobalQwenDirLite,
|
|
@@ -92,7 +100,7 @@ import {
|
|
|
92
100
|
import "./chunk-6PEXNQTX.js";
|
|
93
101
|
import {
|
|
94
102
|
getCliVersion
|
|
95
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-VYOXCEPJ.js";
|
|
96
104
|
import "./chunk-VJNBRRZG.js";
|
|
97
105
|
import "./chunk-ALGGS7UH.js";
|
|
98
106
|
import {
|
|
@@ -102,9 +110,9 @@ import {
|
|
|
102
110
|
writeStderrLine,
|
|
103
111
|
writeStdoutLine
|
|
104
112
|
} from "./chunk-OWAK7LMW.js";
|
|
105
|
-
import "./chunk-5M6IDOMF.js";
|
|
106
113
|
import "./chunk-TWPJO254.js";
|
|
107
114
|
import "./chunk-H6XPXXMH.js";
|
|
115
|
+
import "./chunk-5M6IDOMF.js";
|
|
108
116
|
import {
|
|
109
117
|
require_proper_lockfile
|
|
110
118
|
} from "./chunk-KRXPRVGL.js";
|
|
@@ -2492,6 +2500,13 @@ function formatHostForUrl(host) {
|
|
|
2492
2500
|
return host;
|
|
2493
2501
|
}
|
|
2494
2502
|
__name(formatHostForUrl, "formatHostForUrl");
|
|
2503
|
+
function workspaceRuntimeEffectiveEnv(runtime, daemonEnv) {
|
|
2504
|
+
if (runtime.env.mode === "runtime-overlay") {
|
|
2505
|
+
return runtime.env.effectiveEnv ?? {};
|
|
2506
|
+
}
|
|
2507
|
+
return runtime.env.effectiveEnv ?? daemonEnv;
|
|
2508
|
+
}
|
|
2509
|
+
__name(workspaceRuntimeEffectiveEnv, "workspaceRuntimeEffectiveEnv");
|
|
2495
2510
|
function formatChannelWorkerDaemonUrl(host, port) {
|
|
2496
2511
|
const normalized = host.trim().toLowerCase();
|
|
2497
2512
|
if (normalized === "" || normalized === "0.0.0.0" || normalized === "::" || normalized === "[::]") {
|
|
@@ -2529,15 +2544,16 @@ function withSettingsLock(workspace, fn) {
|
|
|
2529
2544
|
return next;
|
|
2530
2545
|
}
|
|
2531
2546
|
__name(withSettingsLock, "withSettingsLock");
|
|
2547
|
+
var retryableChannelWorkerShutdownErrors = /* @__PURE__ */ new WeakSet();
|
|
2532
2548
|
var channelWorkerRuntimePromise;
|
|
2533
2549
|
async function loadChannelWorkerRuntime() {
|
|
2534
2550
|
channelWorkerRuntimePromise ??= Promise.all([
|
|
2535
|
-
import("./channel-worker-supervisor-
|
|
2536
|
-
import("./pidfile-
|
|
2537
|
-
import("./runtime-
|
|
2551
|
+
import("./channel-worker-supervisor-74HTWA2G.js"),
|
|
2552
|
+
import("./pidfile-6ERW3DF4.js"),
|
|
2553
|
+
import("./runtime-DAUPSUKI.js"),
|
|
2538
2554
|
import("./cli-entry-path-4VJ3Y6T2.js"),
|
|
2539
|
-
import("./channel-worker-group-
|
|
2540
|
-
import("./channel-worker-manager-
|
|
2555
|
+
import("./channel-worker-group-XDPTDWTX.js"),
|
|
2556
|
+
import("./channel-worker-manager-YYEHVRRE.js")
|
|
2541
2557
|
]).then(
|
|
2542
2558
|
([
|
|
2543
2559
|
supervisor,
|
|
@@ -2642,7 +2658,7 @@ function shouldPreheatBridge(deps) {
|
|
|
2642
2658
|
__name(shouldPreheatBridge, "shouldPreheatBridge");
|
|
2643
2659
|
var coreRuntimePromise;
|
|
2644
2660
|
function loadCoreRuntime() {
|
|
2645
|
-
coreRuntimePromise ??= import("./
|
|
2661
|
+
coreRuntimePromise ??= import("./core-runtime-3XEYLQFK.js");
|
|
2646
2662
|
return coreRuntimePromise;
|
|
2647
2663
|
}
|
|
2648
2664
|
__name(loadCoreRuntime, "loadCoreRuntime");
|
|
@@ -2672,10 +2688,10 @@ __name(resolveDaemonLogBaseDirForRun, "resolveDaemonLogBaseDirForRun");
|
|
|
2672
2688
|
var settingsRuntimePromise;
|
|
2673
2689
|
function loadSettingsRuntimeModules() {
|
|
2674
2690
|
settingsRuntimePromise ??= Promise.all([
|
|
2675
|
-
import("./settings-
|
|
2676
|
-
import("./environment-
|
|
2677
|
-
import("./loadedSettingsAdapter-
|
|
2678
|
-
import("./trustedFolders-
|
|
2691
|
+
import("./settings-DJDXFDZ3.js"),
|
|
2692
|
+
import("./environment-XXQ75D2Q.js"),
|
|
2693
|
+
import("./loadedSettingsAdapter-SPUTNKAV.js"),
|
|
2694
|
+
import("./trustedFolders-X2JEIO57.js")
|
|
2679
2695
|
]).then(([settings, environment, loadedSettingsAdapter, trustedFolders]) => ({
|
|
2680
2696
|
settings,
|
|
2681
2697
|
environment,
|
|
@@ -2688,8 +2704,8 @@ __name(loadSettingsRuntimeModules, "loadSettingsRuntimeModules");
|
|
|
2688
2704
|
var channelWebhookConfigRuntimePromise;
|
|
2689
2705
|
function loadChannelWebhookConfigRuntime() {
|
|
2690
2706
|
channelWebhookConfigRuntimePromise ??= Promise.all([
|
|
2691
|
-
import("./runtime-
|
|
2692
|
-
import("./config-utils-
|
|
2707
|
+
import("./runtime-DAUPSUKI.js"),
|
|
2708
|
+
import("./config-utils-NYSXDMEQ.js")
|
|
2693
2709
|
]).then(([channelRuntime, configUtils]) => ({
|
|
2694
2710
|
loadChannelsConfig: channelRuntime.loadChannelsConfig,
|
|
2695
2711
|
parseChannelWebhookConfig: configUtils.parseChannelWebhookConfig
|
|
@@ -2705,6 +2721,7 @@ async function loadServeRuntimeModules() {
|
|
|
2705
2721
|
serverModule,
|
|
2706
2722
|
bridgeModule,
|
|
2707
2723
|
spawnChannelModule,
|
|
2724
|
+
processRegistryModule,
|
|
2708
2725
|
workspaceModule,
|
|
2709
2726
|
workspaceTypesModule,
|
|
2710
2727
|
daemonStatusProviderModule,
|
|
@@ -2713,16 +2730,17 @@ async function loadServeRuntimeModules() {
|
|
|
2713
2730
|
totalSessionAdmissionModule,
|
|
2714
2731
|
workspaceRegistryModule
|
|
2715
2732
|
] = await Promise.all([
|
|
2716
|
-
import("./server-
|
|
2717
|
-
import("./bridge-
|
|
2718
|
-
import("./spawnChannel-
|
|
2719
|
-
import("./
|
|
2733
|
+
import("./server-WEH7DVCH.js"),
|
|
2734
|
+
import("./bridge-3KJEWDNE.js"),
|
|
2735
|
+
import("./spawnChannel-ETMJW7YX.js"),
|
|
2736
|
+
import("./process-registry-2CHQBXH5.js"),
|
|
2737
|
+
import("./workspace-service-M6LLHKJ5.js"),
|
|
2720
2738
|
import("./types-ML3TRJQ5.js"),
|
|
2721
|
-
import("./daemon-status-provider-
|
|
2722
|
-
import("./workspace-providers-status-
|
|
2723
|
-
import("./workspace-skills-status-
|
|
2724
|
-
import("./total-session-admission-
|
|
2725
|
-
import("./workspace-registry-
|
|
2739
|
+
import("./daemon-status-provider-3XJI6CAL.js"),
|
|
2740
|
+
import("./workspace-providers-status-S35YAIUS.js"),
|
|
2741
|
+
import("./workspace-skills-status-C2V7BAIS.js"),
|
|
2742
|
+
import("./total-session-admission-44JKRWQD.js"),
|
|
2743
|
+
import("./workspace-registry-O63R6IZ4.js")
|
|
2726
2744
|
]);
|
|
2727
2745
|
return {
|
|
2728
2746
|
createServeApp: serverModule.createServeApp,
|
|
@@ -2731,6 +2749,7 @@ async function loadServeRuntimeModules() {
|
|
|
2731
2749
|
resolveBridgeFsFactory: serverModule.resolveBridgeFsFactory,
|
|
2732
2750
|
createAcpSessionBridge: bridgeModule.createAcpSessionBridge,
|
|
2733
2751
|
createSpawnChannelFactory: spawnChannelModule.createSpawnChannelFactory,
|
|
2752
|
+
ProcessRegistry: processRegistryModule.ProcessRegistry,
|
|
2734
2753
|
createDaemonWorkspaceService: workspaceModule.createDaemonWorkspaceService,
|
|
2735
2754
|
WorkspaceSettingsPartialPersistError: workspaceTypesModule.WorkspaceSettingsPartialPersistError,
|
|
2736
2755
|
WorkspaceSkillNotToggleableError: workspaceTypesModule.WorkspaceSkillNotToggleableError,
|
|
@@ -2739,7 +2758,8 @@ async function loadServeRuntimeModules() {
|
|
|
2739
2758
|
createWorkspaceSkillsStatusProvider: workspaceSkillsStatusModule.createWorkspaceSkillsStatusProvider,
|
|
2740
2759
|
createTotalSessionAdmissionController: totalSessionAdmissionModule.createTotalSessionAdmissionController,
|
|
2741
2760
|
createWorkspaceRegistry: workspaceRegistryModule.createWorkspaceRegistry,
|
|
2742
|
-
createWorkspaceSessionOwnerIndex: workspaceRegistryModule.createWorkspaceSessionOwnerIndex
|
|
2761
|
+
createWorkspaceSessionOwnerIndex: workspaceRegistryModule.createWorkspaceSessionOwnerIndex,
|
|
2762
|
+
createWorkspaceGenerationGuard: workspaceRegistryModule.createWorkspaceGenerationGuard
|
|
2743
2763
|
};
|
|
2744
2764
|
}
|
|
2745
2765
|
__name(loadServeRuntimeModules, "loadServeRuntimeModules");
|
|
@@ -2779,6 +2799,7 @@ function currentServeFeaturesForRunQwenServe(opts, sessionShellCommandEnabled, s
|
|
|
2779
2799
|
reloadAvailable: true,
|
|
2780
2800
|
channelReloadAvailable: opts.channelSelection !== void 0,
|
|
2781
2801
|
channelControlAvailable: true,
|
|
2802
|
+
channelManagementAvailable: true,
|
|
2782
2803
|
persistentWorkspaceRegistrationAvailable: true,
|
|
2783
2804
|
workspaceRuntimeRemovalAvailable: true,
|
|
2784
2805
|
// Advertise the same WS feature flags as the runtime path (serve-features.ts)
|
|
@@ -3087,6 +3108,8 @@ function createBootstrapServeApp(input) {
|
|
|
3087
3108
|
listenerMaxConnections: listenerMaxConnections(opts.maxConnections),
|
|
3088
3109
|
eventRingSize: opts.eventRingSize ?? DEFAULT_EVENT_RING_SIZE,
|
|
3089
3110
|
compactedReplayMaxBytes: opts.compactedReplayMaxBytes ?? DEFAULT_COMPACTED_REPLAY_MAX_BYTES,
|
|
3111
|
+
maxJournalEvents: opts.maxJournalEvents ?? DEFAULT_MAX_JOURNAL_EVENTS,
|
|
3112
|
+
maxJournalBytes: opts.maxJournalBytes ?? DEFAULT_MAX_JOURNAL_BYTES,
|
|
3090
3113
|
promptDeadlineMs: positiveFiniteOrNull(opts.promptDeadlineMs),
|
|
3091
3114
|
writerIdleTimeoutMs: positiveFiniteOrNull(opts.writerIdleTimeoutMs),
|
|
3092
3115
|
channelIdleTimeoutMs: channelIdleTimeoutMs(opts.channelIdleTimeoutMs),
|
|
@@ -3610,7 +3633,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
3610
3633
|
}
|
|
3611
3634
|
let workspaceRegistrationStore = deps.workspaceRegistrationStore;
|
|
3612
3635
|
if (workspaceRegistrationStore === void 0 && process.env["QWEN_SERVE_NO_PERSISTENT_REGISTRATION"] !== "1") {
|
|
3613
|
-
const { WorkspaceRegistrationStore } = await import("./workspace-registration-store-
|
|
3636
|
+
const { WorkspaceRegistrationStore } = await import("./workspace-registration-store-OTMS3H4C.js");
|
|
3614
3637
|
workspaceRegistrationStore = new WorkspaceRegistrationStore(boundWorkspace);
|
|
3615
3638
|
}
|
|
3616
3639
|
if (workspaceRegistrationStore) {
|
|
@@ -3765,6 +3788,12 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
3765
3788
|
if (opts.compactedReplayMaxBytes !== void 0) {
|
|
3766
3789
|
normalizeCompactedReplayMaxBytes(opts.compactedReplayMaxBytes);
|
|
3767
3790
|
}
|
|
3791
|
+
if (opts.maxJournalEvents !== void 0) {
|
|
3792
|
+
normalizeMaxJournalEvents(opts.maxJournalEvents);
|
|
3793
|
+
}
|
|
3794
|
+
if (opts.maxJournalBytes !== void 0) {
|
|
3795
|
+
normalizeMaxJournalBytes(opts.maxJournalBytes);
|
|
3796
|
+
}
|
|
3768
3797
|
if (opts.writerIdleTimeoutMs !== void 0) {
|
|
3769
3798
|
if (!isPositiveIntegerMs(opts.writerIdleTimeoutMs)) {
|
|
3770
3799
|
throw new TypeError(
|
|
@@ -3849,6 +3878,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
3849
3878
|
let runtimeApp;
|
|
3850
3879
|
let runtimeAppForCleanup;
|
|
3851
3880
|
let bridgeRef = deps.bridge;
|
|
3881
|
+
let managedProcessRegistry;
|
|
3852
3882
|
const internalRuntimeBridgesForCleanup = [];
|
|
3853
3883
|
let daemonEventLoopMonitor;
|
|
3854
3884
|
let daemonMetricsSampler;
|
|
@@ -4015,6 +4045,19 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4015
4045
|
const disposedRuntimeApps = /* @__PURE__ */ new WeakSet();
|
|
4016
4046
|
const stoppedRuntimeAppProducers = /* @__PURE__ */ new WeakSet();
|
|
4017
4047
|
const stoppedExtensionReconcilers = /* @__PURE__ */ new WeakSet();
|
|
4048
|
+
const stoppedTrustPolicyMonitors = /* @__PURE__ */ new WeakSet();
|
|
4049
|
+
const stopTrustPolicyMonitor = /* @__PURE__ */ __name((app2) => {
|
|
4050
|
+
if (!app2 || stoppedTrustPolicyMonitors.has(app2)) return;
|
|
4051
|
+
stoppedTrustPolicyMonitors.add(app2);
|
|
4052
|
+
const stop = app2.locals?.["stopTrustPolicyMonitor"];
|
|
4053
|
+
try {
|
|
4054
|
+
stop?.();
|
|
4055
|
+
} catch (err) {
|
|
4056
|
+
daemonLog.warn(
|
|
4057
|
+
`trust policy monitor dispose error: ${err instanceof Error ? err.message : String(err)}`
|
|
4058
|
+
);
|
|
4059
|
+
}
|
|
4060
|
+
}, "stopTrustPolicyMonitor");
|
|
4018
4061
|
const stopExtensionReconciler = /* @__PURE__ */ __name((app2) => {
|
|
4019
4062
|
if (!app2 || stoppedExtensionReconcilers.has(app2)) return;
|
|
4020
4063
|
stoppedExtensionReconcilers.add(app2);
|
|
@@ -4042,6 +4085,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4042
4085
|
}, "stopSafely");
|
|
4043
4086
|
stopSafely("scheduled-task keepalive", locals.stopScheduledTaskKeepalive);
|
|
4044
4087
|
stopSafely("workspace git state", locals.stopWorkspaceGitState);
|
|
4088
|
+
stopTrustPolicyMonitor(app2);
|
|
4045
4089
|
for (const stop of locals.subSessionStoppers ?? []) {
|
|
4046
4090
|
stopSafely("sub-session launcher", stop);
|
|
4047
4091
|
}
|
|
@@ -4095,13 +4139,23 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4095
4139
|
return [...new Set(bridges)];
|
|
4096
4140
|
}, "getRuntimeBridgesForCleanup");
|
|
4097
4141
|
const buildRuntime = /* @__PURE__ */ __name(async () => {
|
|
4098
|
-
const [runtime, core, settingsRuntime, resolvedCliVersion] = await Promise.all([
|
|
4142
|
+
const [runtime, core, settingsRuntime, resolvedCliVersion, trustPolicy] = await Promise.all([
|
|
4099
4143
|
loadServeRuntimeModules(),
|
|
4100
4144
|
loadCoreRuntime(),
|
|
4101
4145
|
loadSettingsRuntimeModules(),
|
|
4102
|
-
cliVersionPromise
|
|
4146
|
+
cliVersionPromise,
|
|
4147
|
+
import("./daemon-trust-policy-ILUDTLHD.js")
|
|
4103
4148
|
]);
|
|
4104
4149
|
cliVersion = resolvedCliVersion;
|
|
4150
|
+
settingsRuntime.environment.preResolveHomeEnvOverrides();
|
|
4151
|
+
const bootTrustSnapshot = await trustPolicy.readDaemonTrustPolicySnapshot();
|
|
4152
|
+
let latestTrustPolicySnapshot = bootTrustSnapshot;
|
|
4153
|
+
const bootPrimaryTrustDecision = trustPolicy.evaluateDaemonWorkspaceTrust(
|
|
4154
|
+
bootTrustSnapshot,
|
|
4155
|
+
boundWorkspace
|
|
4156
|
+
);
|
|
4157
|
+
const trustedWorkspace = deps.trustedWorkspace ?? bootPrimaryTrustDecision.targetTrusted;
|
|
4158
|
+
const workspaceTrustHotReloadAvailable = deps.trustedWorkspace === void 0 && deps.bridge === void 0 && deps.fsFactory === void 0;
|
|
4105
4159
|
let managedScratchRoot;
|
|
4106
4160
|
try {
|
|
4107
4161
|
managedScratchRoot = prepareManagedScratchRoot(
|
|
@@ -4115,16 +4169,19 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4115
4169
|
}
|
|
4116
4170
|
let runtimeBootSettings;
|
|
4117
4171
|
try {
|
|
4118
|
-
runtimeBootSettings = settingsRuntime.settings.loadSettings(
|
|
4172
|
+
runtimeBootSettings = settingsRuntime.settings.loadSettings(
|
|
4173
|
+
boundWorkspace,
|
|
4174
|
+
{
|
|
4175
|
+
skipLoadEnvironment: true,
|
|
4176
|
+
skipWorkspaceSettings: !trustedWorkspace,
|
|
4177
|
+
workspaceTrusted: trustedWorkspace
|
|
4178
|
+
}
|
|
4179
|
+
);
|
|
4119
4180
|
} catch (err) {
|
|
4120
4181
|
writeStderrLine(
|
|
4121
4182
|
`qwen serve: could not read full settings for runtime startup (${err instanceof Error ? err.message : String(err)}); falling back to defaults.`
|
|
4122
4183
|
);
|
|
4123
4184
|
}
|
|
4124
|
-
const trustedWorkspace = deps.trustedWorkspace ?? (runtimeBootSettings ? settingsRuntime.trustedFolders.getWorkspaceTrustStatus(
|
|
4125
|
-
runtimeBootSettings.merged,
|
|
4126
|
-
boundWorkspace
|
|
4127
|
-
).effective.state === "trusted" : true);
|
|
4128
4185
|
if (deps.trustedWorkspace === void 0 && runtimeBootSettings && !trustedWorkspace) {
|
|
4129
4186
|
daemonLog.warn(
|
|
4130
4187
|
"workspace file writes are disabled because the bound workspace is not trusted",
|
|
@@ -4134,7 +4191,8 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4134
4191
|
const runtimeEnvSnapshot = runtimeBootSettings ? settingsRuntime.environment.buildRuntimeEnvironment(
|
|
4135
4192
|
runtimeBootSettings.merged,
|
|
4136
4193
|
boundWorkspace,
|
|
4137
|
-
daemonRuntimeBaseEnv
|
|
4194
|
+
daemonRuntimeBaseEnv,
|
|
4195
|
+
trustedWorkspace
|
|
4138
4196
|
) : {
|
|
4139
4197
|
effectiveEnv: { ...daemonRuntimeBaseEnv },
|
|
4140
4198
|
overlayKeys: Object.freeze([]),
|
|
@@ -4305,17 +4363,10 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4305
4363
|
void 0,
|
|
4306
4364
|
(workspace, index) => {
|
|
4307
4365
|
if (index === 0) return true;
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
"excluding secondary workspace root because trust settings are unavailable",
|
|
4311
|
-
{ workspace }
|
|
4312
|
-
);
|
|
4313
|
-
return false;
|
|
4314
|
-
}
|
|
4315
|
-
const trustedSecondary = settingsRuntime.trustedFolders.getWorkspaceTrustStatus(
|
|
4316
|
-
runtimeBootSettings.merged,
|
|
4366
|
+
const trustedSecondary = trustPolicy.evaluateDaemonWorkspaceTrust(
|
|
4367
|
+
bootTrustSnapshot,
|
|
4317
4368
|
workspace
|
|
4318
|
-
).
|
|
4369
|
+
).targetTrusted;
|
|
4319
4370
|
if (!trustedSecondary) {
|
|
4320
4371
|
daemonLog.warn(
|
|
4321
4372
|
"excluding untrusted secondary workspace root from file-system access",
|
|
@@ -4330,7 +4381,16 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4330
4381
|
secondary: boundWorkspaces.slice(1),
|
|
4331
4382
|
ideEnvPresent: !!process.env["QWEN_CODE_IDE_WORKSPACE_PATH"]
|
|
4332
4383
|
});
|
|
4384
|
+
const primaryGenerationGuard = runtime.createWorkspaceGenerationGuard();
|
|
4385
|
+
const primaryTrustMaterialization = JSON.stringify({
|
|
4386
|
+
trusted: trustedWorkspace,
|
|
4387
|
+
boundWorkspaces: [...boundWorkspaces].sort()
|
|
4388
|
+
});
|
|
4333
4389
|
const sharedPathLocks = new PathMutexRegistry();
|
|
4390
|
+
const workspaceTrustOperationGate = new PathMutexRegistry();
|
|
4391
|
+
const runWorkspaceTrustOperation = /* @__PURE__ */ __name((operation) => workspaceTrustOperationGate.runExclusive("runtime-topology", operation), "runWorkspaceTrustOperation");
|
|
4392
|
+
const processRegistry = new runtime.ProcessRegistry();
|
|
4393
|
+
managedProcessRegistry = processRegistry;
|
|
4334
4394
|
const fsFactory = runtime.resolveBridgeFsFactory({
|
|
4335
4395
|
// Secondary roots share a write-capable factory only after their own
|
|
4336
4396
|
// folder trust check passes; untrusted secondary roots stay outside.
|
|
@@ -4339,6 +4399,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4339
4399
|
trusted: trustedWorkspace,
|
|
4340
4400
|
emit: deps.fsAuditEmit,
|
|
4341
4401
|
pathLocks: sharedPathLocks,
|
|
4402
|
+
generationGuard: primaryGenerationGuard,
|
|
4342
4403
|
...customIgnoreFiles !== void 0 ? { customIgnoreFiles } : {}
|
|
4343
4404
|
});
|
|
4344
4405
|
const routeFsFactory = runtime.resolveBridgeFsFactory({
|
|
@@ -4348,9 +4409,11 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4348
4409
|
trusted: trustedWorkspace,
|
|
4349
4410
|
emit: deps.fsAuditEmit,
|
|
4350
4411
|
pathLocks: sharedPathLocks,
|
|
4412
|
+
generationGuard: primaryGenerationGuard,
|
|
4351
4413
|
...customIgnoreFiles !== void 0 ? { customIgnoreFiles } : {}
|
|
4352
4414
|
});
|
|
4353
4415
|
const channelFactory = runtime.createSpawnChannelFactory({
|
|
4416
|
+
processRegistry,
|
|
4354
4417
|
sourceEnv: runtimeEffectiveEnv,
|
|
4355
4418
|
onDiagnosticLine: diagnosticSink,
|
|
4356
4419
|
pipeHooks: {
|
|
@@ -4368,9 +4431,12 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4368
4431
|
env: runtimeEffectiveEnv
|
|
4369
4432
|
});
|
|
4370
4433
|
const workspaceProvidersStatusProvider = runtime.createWorkspaceProvidersStatusProvider({
|
|
4371
|
-
env: runtimeEffectiveEnv
|
|
4434
|
+
env: runtimeEffectiveEnv,
|
|
4435
|
+
workspaceTrusted: trustedWorkspace
|
|
4436
|
+
});
|
|
4437
|
+
const workspaceSkillsStatusProvider = runtime.createWorkspaceSkillsStatusProvider({
|
|
4438
|
+
workspaceTrusted: trustedWorkspace
|
|
4372
4439
|
});
|
|
4373
|
-
const workspaceSkillsStatusProvider = runtime.createWorkspaceSkillsStatusProvider();
|
|
4374
4440
|
const clientMcpSenderRegistry = new ClientMcpSenderRegistry();
|
|
4375
4441
|
const runtimeBridges = [];
|
|
4376
4442
|
const totalSessionAdmission = runtime.createTotalSessionAdmissionController(
|
|
@@ -4380,84 +4446,108 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4380
4446
|
}
|
|
4381
4447
|
);
|
|
4382
4448
|
const sessionOwnerIndex = runtime.createWorkspaceSessionOwnerIndex();
|
|
4383
|
-
const
|
|
4384
|
-
|
|
4449
|
+
const workspaceRegistryForPersistence = { current: void 0 };
|
|
4450
|
+
const isWorkspaceTrustedForPersistence = /* @__PURE__ */ __name((workspace) => workspaceRegistryForPersistence.current?.getByWorkspaceCwd(workspace)?.trusted ?? (workspaceRegistryForPersistence.current === void 0 && workspace === boundWorkspace && trustedWorkspace), "isWorkspaceTrustedForPersistence");
|
|
4451
|
+
const loadSettingsForPersistence = /* @__PURE__ */ __name((workspace) => {
|
|
4452
|
+
const trusted = isWorkspaceTrustedForPersistence(workspace);
|
|
4453
|
+
return settingsRuntime.settings.loadSettings(workspace, {
|
|
4454
|
+
skipLoadEnvironment: true,
|
|
4455
|
+
skipWorkspaceSettings: !trusted,
|
|
4456
|
+
workspaceTrusted: trusted
|
|
4457
|
+
});
|
|
4458
|
+
}, "loadSettingsForPersistence");
|
|
4459
|
+
const persistDisabledToolsFn = /* @__PURE__ */ __name((workspace, toolName, enabled, assertGenerationOpen) => withSettingsLock(workspace, async () => {
|
|
4460
|
+
assertGenerationOpen?.();
|
|
4461
|
+
const fresh = loadSettingsForPersistence(workspace);
|
|
4385
4462
|
const wsScope = fresh.forScope(WORKSPACE_SETTING_SCOPE).settings;
|
|
4386
4463
|
const wsDisabled = wsScope.tools?.disabled;
|
|
4387
4464
|
const current = Array.isArray(wsDisabled) ? wsDisabled.filter((v) => typeof v === "string") : [];
|
|
4388
4465
|
const next = new Set(current);
|
|
4389
4466
|
if (enabled) next.delete(toolName);
|
|
4390
4467
|
else next.add(toolName);
|
|
4468
|
+
assertGenerationOpen?.();
|
|
4391
4469
|
fresh.setValue(
|
|
4392
4470
|
WORKSPACE_SETTING_SCOPE,
|
|
4393
4471
|
"tools.disabled",
|
|
4394
|
-
[...next].sort()
|
|
4472
|
+
[...next].sort(),
|
|
4473
|
+
assertGenerationOpen
|
|
4395
4474
|
);
|
|
4396
4475
|
}), "persistDisabledToolsFn");
|
|
4397
|
-
const persistDisabledSkillsFn = /* @__PURE__ */ __name((workspace, skillName, enabled) => withSettingsLock(workspace, async () => {
|
|
4398
|
-
|
|
4476
|
+
const persistDisabledSkillsFn = /* @__PURE__ */ __name((workspace, skillName, enabled, assertGenerationOpen) => withSettingsLock(workspace, async () => {
|
|
4477
|
+
assertGenerationOpen?.();
|
|
4478
|
+
const {
|
|
4479
|
+
resolveSkillSettings,
|
|
4480
|
+
skillSettingStrings,
|
|
4481
|
+
updateWorkspaceSkillSettingLists
|
|
4482
|
+
} = await import("./skill-settings-VJ5PDMZI.js");
|
|
4483
|
+
const fresh = loadSettingsForPersistence(workspace);
|
|
4399
4484
|
const normalizedName = skillName.trim().toLowerCase();
|
|
4400
|
-
const
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
for (const [scope, names] of lockedScopes) {
|
|
4409
|
-
if (disabledNames(names).some(
|
|
4410
|
-
(name) => name.trim().toLowerCase() === normalizedName
|
|
4411
|
-
)) {
|
|
4412
|
-
throw new runtime.WorkspaceSkillNotToggleableError(
|
|
4413
|
-
skillName,
|
|
4414
|
-
"locked",
|
|
4415
|
-
scope
|
|
4416
|
-
);
|
|
4417
|
-
}
|
|
4485
|
+
const resolved = resolveSkillSettings(fresh);
|
|
4486
|
+
const disablement = resolved.disablements.get(normalizedName);
|
|
4487
|
+
if (disablement?.reason === "hard" && disablement.lockedScope) {
|
|
4488
|
+
throw new runtime.WorkspaceSkillNotToggleableError(
|
|
4489
|
+
skillName,
|
|
4490
|
+
"locked",
|
|
4491
|
+
disablement.lockedScope
|
|
4492
|
+
);
|
|
4418
4493
|
}
|
|
4419
|
-
const workspaceDisabled =
|
|
4420
|
-
fresh
|
|
4494
|
+
const workspaceDisabled = skillSettingStrings(
|
|
4495
|
+
fresh,
|
|
4496
|
+
WORKSPACE_SETTING_SCOPE,
|
|
4497
|
+
"disabled"
|
|
4421
4498
|
);
|
|
4422
|
-
const
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
}
|
|
4439
|
-
changed = true;
|
|
4440
|
-
}
|
|
4499
|
+
const workspaceEnabled = skillSettingStrings(
|
|
4500
|
+
fresh,
|
|
4501
|
+
WORKSPACE_SETTING_SCOPE,
|
|
4502
|
+
"enabled"
|
|
4503
|
+
);
|
|
4504
|
+
const next = updateWorkspaceSkillSettingLists(
|
|
4505
|
+
{ disabled: workspaceDisabled, enabled: workspaceEnabled },
|
|
4506
|
+
skillName,
|
|
4507
|
+
enabled,
|
|
4508
|
+
resolved.defaultDisabledNames.has(normalizedName) && !resolved.enabledNames.has(normalizedName)
|
|
4509
|
+
);
|
|
4510
|
+
const settingsChanges = [];
|
|
4511
|
+
if (JSON.stringify(next.disabled) !== JSON.stringify(workspaceDisabled)) {
|
|
4512
|
+
settingsChanges.push({
|
|
4513
|
+
key: "skills.disabled",
|
|
4514
|
+
value: next.disabled.length > 0 ? next.disabled : void 0
|
|
4515
|
+
});
|
|
4441
4516
|
}
|
|
4442
|
-
if (
|
|
4443
|
-
|
|
4444
|
-
|
|
4517
|
+
if (JSON.stringify(next.enabled) !== JSON.stringify(workspaceEnabled)) {
|
|
4518
|
+
settingsChanges.push({
|
|
4519
|
+
key: "skills.enabled",
|
|
4520
|
+
value: next.enabled.length > 0 ? next.enabled : void 0
|
|
4521
|
+
});
|
|
4445
4522
|
}
|
|
4446
|
-
if (
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4523
|
+
if (settingsChanges.length === 0) {
|
|
4524
|
+
return { changed: false, disabled: workspaceDisabled };
|
|
4525
|
+
}
|
|
4526
|
+
assertGenerationOpen?.();
|
|
4527
|
+
fresh.setValues(
|
|
4528
|
+
settingsChanges.map((change) => ({
|
|
4529
|
+
scope: WORKSPACE_SETTING_SCOPE,
|
|
4530
|
+
...change
|
|
4531
|
+
})),
|
|
4532
|
+
void 0,
|
|
4533
|
+
assertGenerationOpen
|
|
4451
4534
|
);
|
|
4452
|
-
return {
|
|
4535
|
+
return {
|
|
4536
|
+
changed: true,
|
|
4537
|
+
disabled: next.disabled,
|
|
4538
|
+
settingsChanges
|
|
4539
|
+
};
|
|
4453
4540
|
}), "persistDisabledSkillsFn");
|
|
4454
|
-
const persistSettingFn = /* @__PURE__ */ __name((workspace, scope, key, value) => withSettingsLock(workspace, async () => {
|
|
4455
|
-
|
|
4456
|
-
fresh
|
|
4541
|
+
const persistSettingFn = /* @__PURE__ */ __name((workspace, scope, key, value, assertGenerationOpen) => withSettingsLock(workspace, async () => {
|
|
4542
|
+
assertGenerationOpen?.();
|
|
4543
|
+
const fresh = loadSettingsForPersistence(workspace);
|
|
4544
|
+
assertGenerationOpen?.();
|
|
4545
|
+
fresh.setValue(scope, key, value, assertGenerationOpen);
|
|
4457
4546
|
return fresh;
|
|
4458
4547
|
}), "persistSettingFn");
|
|
4459
|
-
const persistSettingsFn = /* @__PURE__ */ __name((workspace, writes) => withSettingsLock(workspace, async () => {
|
|
4460
|
-
|
|
4548
|
+
const persistSettingsFn = /* @__PURE__ */ __name((workspace, writes, assertGenerationOpen) => withSettingsLock(workspace, async () => {
|
|
4549
|
+
assertGenerationOpen?.();
|
|
4550
|
+
const fresh = loadSettingsForPersistence(workspace);
|
|
4461
4551
|
const writesByScope = /* @__PURE__ */ new Map();
|
|
4462
4552
|
for (const write of writes) {
|
|
4463
4553
|
writesByScope.set(
|
|
@@ -4468,10 +4558,15 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4468
4558
|
const committedScopes = /* @__PURE__ */ new Set();
|
|
4469
4559
|
let committed = 0;
|
|
4470
4560
|
try {
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4561
|
+
assertGenerationOpen?.();
|
|
4562
|
+
fresh.setValues(
|
|
4563
|
+
writes,
|
|
4564
|
+
(scope) => {
|
|
4565
|
+
committedScopes.add(scope);
|
|
4566
|
+
committed += writesByScope.get(scope) ?? 0;
|
|
4567
|
+
},
|
|
4568
|
+
assertGenerationOpen
|
|
4569
|
+
);
|
|
4475
4570
|
} catch (err) {
|
|
4476
4571
|
const failedWrite = writes.find((write) => !committedScopes.has(write.scope)) ?? writes[committed];
|
|
4477
4572
|
const message = `persistSettings partial failure (workspace=${workspace}, committed=${committed}/${writes.length}, failedKey=${failedWrite?.key ?? "<unknown>"}, failedScope=${failedWrite?.scope ?? "<unknown>"}): ${err instanceof Error ? err.message : String(err)}`;
|
|
@@ -4483,7 +4578,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4483
4578
|
);
|
|
4484
4579
|
}
|
|
4485
4580
|
}), "persistSettingsFn");
|
|
4486
|
-
const { createSubSessionLauncher } = await import("./create-sub-session-
|
|
4581
|
+
const { createSubSessionLauncher } = await import("./create-sub-session-R76FVXCI.js");
|
|
4487
4582
|
const subSessionLauncher = createSubSessionLauncher({
|
|
4488
4583
|
getBridge: /* @__PURE__ */ __name(() => bridgeRef, "getBridge"),
|
|
4489
4584
|
boundWorkspace
|
|
@@ -4502,10 +4597,17 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4502
4597
|
),
|
|
4503
4598
|
maxSessions: opts.maxSessions,
|
|
4504
4599
|
freshSessionAdmission: totalSessionAdmission.admit,
|
|
4505
|
-
sessionLifecycle:
|
|
4600
|
+
sessionLifecycle: /* @__PURE__ */ __name((event) => {
|
|
4601
|
+
if (event.type === "registered" && primaryGenerationGuard.closed) {
|
|
4602
|
+
return;
|
|
4603
|
+
}
|
|
4604
|
+
sessionOwnerIndex.handleBridgeSessionLifecycle(event);
|
|
4605
|
+
}, "sessionLifecycle"),
|
|
4506
4606
|
...opts.maxPendingPromptsPerSession !== void 0 ? { maxPendingPromptsPerSession: opts.maxPendingPromptsPerSession } : {},
|
|
4507
4607
|
...opts.eventRingSize !== void 0 ? { eventRingSize: opts.eventRingSize } : {},
|
|
4508
4608
|
...opts.compactedReplayMaxBytes !== void 0 ? { compactedReplayMaxBytes: opts.compactedReplayMaxBytes } : {},
|
|
4609
|
+
...opts.maxJournalEvents !== void 0 ? { maxJournalEvents: opts.maxJournalEvents } : {},
|
|
4610
|
+
...opts.maxJournalBytes !== void 0 ? { maxJournalBytes: opts.maxJournalBytes } : {},
|
|
4509
4611
|
...opts.channelIdleTimeoutMs !== void 0 ? { channelIdleTimeoutMs: opts.channelIdleTimeoutMs } : {},
|
|
4510
4612
|
...opts.initializeTimeoutMs !== void 0 ? { initializeTimeoutMs: opts.initializeTimeoutMs } : {},
|
|
4511
4613
|
...opts.sessionReapIntervalMs !== void 0 ? { sessionReapIntervalMs: opts.sessionReapIntervalMs } : {},
|
|
@@ -4523,8 +4625,23 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4523
4625
|
statusProvider,
|
|
4524
4626
|
fileSystem: createBridgeFileSystemAdapter(fsFactory),
|
|
4525
4627
|
persistApprovalMode: /* @__PURE__ */ __name((workspace, mode) => withSettingsLock(workspace, async () => {
|
|
4526
|
-
|
|
4527
|
-
|
|
4628
|
+
primaryGenerationGuard.assertOpen();
|
|
4629
|
+
if (!trustedWorkspace) {
|
|
4630
|
+
throw new Error(
|
|
4631
|
+
"Cannot persist approval mode for an untrusted workspace."
|
|
4632
|
+
);
|
|
4633
|
+
}
|
|
4634
|
+
const fresh = settingsRuntime.settings.loadSettings(workspace, {
|
|
4635
|
+
skipLoadEnvironment: true,
|
|
4636
|
+
workspaceTrusted: trustedWorkspace
|
|
4637
|
+
});
|
|
4638
|
+
primaryGenerationGuard.assertOpen();
|
|
4639
|
+
fresh.setValue(
|
|
4640
|
+
WORKSPACE_SETTING_SCOPE,
|
|
4641
|
+
"tools.approvalMode",
|
|
4642
|
+
mode,
|
|
4643
|
+
() => primaryGenerationGuard.assertOpen()
|
|
4644
|
+
);
|
|
4528
4645
|
}), "persistApprovalMode")
|
|
4529
4646
|
});
|
|
4530
4647
|
if (!deps.bridge) {
|
|
@@ -4536,6 +4653,8 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4536
4653
|
}, "invalidatePrimaryServeFeaturesCache");
|
|
4537
4654
|
const workspaceService = runtime.createDaemonWorkspaceService({
|
|
4538
4655
|
boundWorkspace,
|
|
4656
|
+
isWorkspaceTrusted: /* @__PURE__ */ __name(() => trustedWorkspace, "isWorkspaceTrusted"),
|
|
4657
|
+
assertGenerationOpen: /* @__PURE__ */ __name(() => primaryGenerationGuard.assertOpen(), "assertGenerationOpen"),
|
|
4539
4658
|
contextFilename: contextFilenameForInit ?? "QWEN.md",
|
|
4540
4659
|
statusProvider,
|
|
4541
4660
|
workspaceProvidersStatusProvider,
|
|
@@ -4548,13 +4667,18 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4548
4667
|
persistSetting: persistSettingFn,
|
|
4549
4668
|
persistSettings: persistSettingsFn,
|
|
4550
4669
|
preheatAcpChild: /* @__PURE__ */ __name(() => bridge.preheat(), "preheatAcpChild"),
|
|
4551
|
-
reloadDaemonEnv: /* @__PURE__ */ __name((workspace) => withSettingsLock(workspace, async () => {
|
|
4670
|
+
reloadDaemonEnv: /* @__PURE__ */ __name((workspace, assertGenerationOpen) => withSettingsLock(workspace, async () => {
|
|
4671
|
+
assertGenerationOpen?.();
|
|
4552
4672
|
const fresh = settingsRuntime.settings.loadSettings(workspace, {
|
|
4553
|
-
skipLoadEnvironment: true
|
|
4673
|
+
skipLoadEnvironment: true,
|
|
4674
|
+
skipWorkspaceSettings: !trustedWorkspace,
|
|
4675
|
+
workspaceTrusted: trustedWorkspace
|
|
4554
4676
|
});
|
|
4677
|
+
assertGenerationOpen?.();
|
|
4555
4678
|
const result = settingsRuntime.settings.reloadEnvironment(
|
|
4556
4679
|
fresh.merged,
|
|
4557
|
-
workspace
|
|
4680
|
+
workspace,
|
|
4681
|
+
trustedWorkspace
|
|
4558
4682
|
);
|
|
4559
4683
|
let refreshedRuntimeEnv;
|
|
4560
4684
|
let fallbackReason;
|
|
@@ -4562,7 +4686,8 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4562
4686
|
refreshedRuntimeEnv = settingsRuntime.environment.buildRuntimeEnvironment(
|
|
4563
4687
|
fresh.merged,
|
|
4564
4688
|
workspace,
|
|
4565
|
-
daemonRuntimeBaseEnv
|
|
4689
|
+
daemonRuntimeBaseEnv,
|
|
4690
|
+
trustedWorkspace
|
|
4566
4691
|
);
|
|
4567
4692
|
} catch (err) {
|
|
4568
4693
|
fallbackReason = err instanceof Error ? err.message : String(err);
|
|
@@ -4630,14 +4755,17 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4630
4755
|
bridge,
|
|
4631
4756
|
workspaceService,
|
|
4632
4757
|
routeFileSystemFactory: routeFsFactory,
|
|
4633
|
-
clientMcpSenderRegistry
|
|
4758
|
+
clientMcpSenderRegistry,
|
|
4759
|
+
generationGuard: primaryGenerationGuard,
|
|
4760
|
+
trustMaterialization: primaryTrustMaterialization
|
|
4634
4761
|
}
|
|
4635
4762
|
];
|
|
4636
|
-
const createRuntimeEnvMetadata = /* @__PURE__ */ __name((workspace, settings) => {
|
|
4763
|
+
const createRuntimeEnvMetadata = /* @__PURE__ */ __name((workspace, settings, trusted) => {
|
|
4637
4764
|
const snapshot = settings ? settingsRuntime.environment.buildRuntimeEnvironment(
|
|
4638
4765
|
settings.merged,
|
|
4639
4766
|
workspace,
|
|
4640
|
-
daemonRuntimeBaseEnv
|
|
4767
|
+
daemonRuntimeBaseEnv,
|
|
4768
|
+
trusted
|
|
4641
4769
|
) : {
|
|
4642
4770
|
effectiveEnv: { ...daemonRuntimeBaseEnv },
|
|
4643
4771
|
overlayKeys: Object.freeze([]),
|
|
@@ -4667,27 +4795,33 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4667
4795
|
};
|
|
4668
4796
|
}, "createRuntimeEnvMetadata");
|
|
4669
4797
|
const subSessionStoppers = [];
|
|
4670
|
-
const
|
|
4798
|
+
const subSessionStoppersByRuntime = /* @__PURE__ */ new WeakMap();
|
|
4671
4799
|
const runtimeCleanupPromises = /* @__PURE__ */ new WeakMap();
|
|
4672
4800
|
const removeArrayValue = /* @__PURE__ */ __name((values, value) => {
|
|
4673
4801
|
const index = values.indexOf(value);
|
|
4674
4802
|
if (index >= 0) values.splice(index, 1);
|
|
4675
4803
|
}, "removeArrayValue");
|
|
4676
4804
|
for (const workspaceInput of workspaceInputs.slice(1)) {
|
|
4805
|
+
const secondaryDecision = trustPolicy.evaluateDaemonWorkspaceTrust(
|
|
4806
|
+
bootTrustSnapshot,
|
|
4807
|
+
workspaceInput.cwd
|
|
4808
|
+
);
|
|
4809
|
+
const secondaryTrusted = secondaryDecision.targetTrusted;
|
|
4677
4810
|
let secondarySettings;
|
|
4678
4811
|
try {
|
|
4679
4812
|
secondarySettings = settingsRuntime.settings.loadSettings(
|
|
4680
|
-
workspaceInput.cwd
|
|
4813
|
+
workspaceInput.cwd,
|
|
4814
|
+
{
|
|
4815
|
+
skipLoadEnvironment: true,
|
|
4816
|
+
skipWorkspaceSettings: !secondaryTrusted,
|
|
4817
|
+
workspaceTrusted: secondaryTrusted
|
|
4818
|
+
}
|
|
4681
4819
|
);
|
|
4682
4820
|
} catch (err) {
|
|
4683
4821
|
writeStderrLine(
|
|
4684
4822
|
`qwen serve: could not read full settings for secondary workspace ${workspaceInput.cwd} (${err instanceof Error ? err.message : String(err)}); falling back to defaults.`
|
|
4685
4823
|
);
|
|
4686
4824
|
}
|
|
4687
|
-
const secondaryTrusted = secondarySettings ? settingsRuntime.trustedFolders.getWorkspaceTrustStatus(
|
|
4688
|
-
secondarySettings.merged,
|
|
4689
|
-
workspaceInput.cwd
|
|
4690
|
-
).effective.state === "trusted" : false;
|
|
4691
4825
|
if (!secondaryTrusted) {
|
|
4692
4826
|
daemonLog.warn("secondary workspace is not trusted", {
|
|
4693
4827
|
workspace: workspaceInput.cwd,
|
|
@@ -4696,11 +4830,15 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4696
4830
|
}
|
|
4697
4831
|
const secondaryEnv = createRuntimeEnvMetadata(
|
|
4698
4832
|
workspaceInput.cwd,
|
|
4699
|
-
secondarySettings
|
|
4833
|
+
secondarySettings,
|
|
4834
|
+
secondaryTrusted
|
|
4700
4835
|
);
|
|
4836
|
+
const secondaryCustomIgnoreFiles = secondarySettings?.merged.context?.fileFiltering?.customIgnoreFiles;
|
|
4837
|
+
const secondaryContextFilename = extractContextFilename(secondarySettings?.merged.context?.fileName) ?? contextFilenameForInit ?? "QWEN.md";
|
|
4701
4838
|
const secondaryWorkspaceHash = core.hashDaemonWorkspace(
|
|
4702
4839
|
workspaceInput.cwd
|
|
4703
4840
|
);
|
|
4841
|
+
const secondaryGenerationGuard = runtime.createWorkspaceGenerationGuard();
|
|
4704
4842
|
const secondaryStatusProvider = runtime.createDaemonStatusProvider({
|
|
4705
4843
|
env: secondaryEnv.effectiveEnv
|
|
4706
4844
|
});
|
|
@@ -4709,9 +4847,11 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4709
4847
|
trusted: secondaryTrusted,
|
|
4710
4848
|
emit: deps.fsAuditEmit,
|
|
4711
4849
|
pathLocks: sharedPathLocks,
|
|
4712
|
-
|
|
4850
|
+
generationGuard: secondaryGenerationGuard,
|
|
4851
|
+
...secondaryCustomIgnoreFiles !== void 0 ? { customIgnoreFiles: secondaryCustomIgnoreFiles } : {}
|
|
4713
4852
|
});
|
|
4714
4853
|
const secondaryChannelFactory = runtime.createSpawnChannelFactory({
|
|
4854
|
+
processRegistry,
|
|
4715
4855
|
sourceEnv: secondaryEnv.effectiveEnv,
|
|
4716
4856
|
onDiagnosticLine: diagnosticSink,
|
|
4717
4857
|
pipeHooks: {
|
|
@@ -4743,10 +4883,17 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4743
4883
|
),
|
|
4744
4884
|
maxSessions: opts.maxSessions,
|
|
4745
4885
|
freshSessionAdmission: totalSessionAdmission.admit,
|
|
4746
|
-
sessionLifecycle:
|
|
4886
|
+
sessionLifecycle: /* @__PURE__ */ __name((event) => {
|
|
4887
|
+
if (event.type === "registered" && secondaryGenerationGuard.closed) {
|
|
4888
|
+
return;
|
|
4889
|
+
}
|
|
4890
|
+
sessionOwnerIndex.handleBridgeSessionLifecycle(event);
|
|
4891
|
+
}, "sessionLifecycle"),
|
|
4747
4892
|
...opts.maxPendingPromptsPerSession !== void 0 ? { maxPendingPromptsPerSession: opts.maxPendingPromptsPerSession } : {},
|
|
4748
4893
|
...opts.eventRingSize !== void 0 ? { eventRingSize: opts.eventRingSize } : {},
|
|
4749
4894
|
...opts.compactedReplayMaxBytes !== void 0 ? { compactedReplayMaxBytes: opts.compactedReplayMaxBytes } : {},
|
|
4895
|
+
...opts.maxJournalEvents !== void 0 ? { maxJournalEvents: opts.maxJournalEvents } : {},
|
|
4896
|
+
...opts.maxJournalBytes !== void 0 ? { maxJournalBytes: opts.maxJournalBytes } : {},
|
|
4750
4897
|
...opts.channelIdleTimeoutMs !== void 0 ? { channelIdleTimeoutMs: opts.channelIdleTimeoutMs } : {},
|
|
4751
4898
|
...opts.initializeTimeoutMs !== void 0 ? { initializeTimeoutMs: opts.initializeTimeoutMs } : {},
|
|
4752
4899
|
...opts.sessionReapIntervalMs !== void 0 ? { sessionReapIntervalMs: opts.sessionReapIntervalMs } : {},
|
|
@@ -4766,26 +4913,42 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4766
4913
|
statusProvider: secondaryStatusProvider,
|
|
4767
4914
|
fileSystem: createBridgeFileSystemAdapter(secondaryBridgeFsFactory),
|
|
4768
4915
|
persistApprovalMode: /* @__PURE__ */ __name((workspace, mode) => withSettingsLock(workspace, async () => {
|
|
4769
|
-
|
|
4770
|
-
|
|
4916
|
+
secondaryGenerationGuard.assertOpen();
|
|
4917
|
+
if (!secondaryTrusted) {
|
|
4918
|
+
throw new Error(
|
|
4919
|
+
"Cannot persist approval mode for an untrusted workspace."
|
|
4920
|
+
);
|
|
4921
|
+
}
|
|
4922
|
+
const fresh = settingsRuntime.settings.loadSettings(workspace, {
|
|
4923
|
+
skipLoadEnvironment: true,
|
|
4924
|
+
workspaceTrusted: secondaryTrusted
|
|
4925
|
+
});
|
|
4926
|
+
secondaryGenerationGuard.assertOpen();
|
|
4927
|
+
fresh.setValue(
|
|
4928
|
+
WORKSPACE_SETTING_SCOPE,
|
|
4929
|
+
"tools.approvalMode",
|
|
4930
|
+
mode,
|
|
4931
|
+
() => secondaryGenerationGuard.assertOpen()
|
|
4932
|
+
);
|
|
4771
4933
|
}), "persistApprovalMode")
|
|
4772
4934
|
});
|
|
4773
4935
|
secondaryBridgeRef = secondaryBridge;
|
|
4774
4936
|
runtimeBridges.push(secondaryBridge);
|
|
4775
4937
|
internalRuntimeBridgesForCleanup.push(secondaryBridge);
|
|
4776
4938
|
subSessionStoppers.push(secondarySubSessionLauncher.stop);
|
|
4777
|
-
subSessionStoppersByWorkspace.set(
|
|
4778
|
-
workspaceInput.cwd,
|
|
4779
|
-
secondarySubSessionLauncher.stop
|
|
4780
|
-
);
|
|
4781
4939
|
const secondaryWorkspaceService = runtime.createDaemonWorkspaceService({
|
|
4782
4940
|
boundWorkspace: workspaceInput.cwd,
|
|
4783
|
-
|
|
4941
|
+
isWorkspaceTrusted: /* @__PURE__ */ __name(() => secondaryTrusted, "isWorkspaceTrusted"),
|
|
4942
|
+
assertGenerationOpen: /* @__PURE__ */ __name(() => secondaryGenerationGuard.assertOpen(), "assertGenerationOpen"),
|
|
4943
|
+
contextFilename: secondaryContextFilename,
|
|
4784
4944
|
statusProvider: secondaryStatusProvider,
|
|
4785
4945
|
workspaceProvidersStatusProvider: runtime.createWorkspaceProvidersStatusProvider({
|
|
4786
|
-
env: secondaryEnv.effectiveEnv
|
|
4946
|
+
env: secondaryEnv.effectiveEnv,
|
|
4947
|
+
workspaceTrusted: secondaryTrusted
|
|
4948
|
+
}),
|
|
4949
|
+
workspaceSkillsStatusProvider: runtime.createWorkspaceSkillsStatusProvider({
|
|
4950
|
+
workspaceTrusted: secondaryTrusted
|
|
4787
4951
|
}),
|
|
4788
|
-
workspaceSkillsStatusProvider: runtime.createWorkspaceSkillsStatusProvider(),
|
|
4789
4952
|
skillInstallEnv: secondaryEnv.effectiveEnv,
|
|
4790
4953
|
voiceEnv: secondaryEnv.effectiveEnv,
|
|
4791
4954
|
voiceSettingsScope: WORKSPACE_SETTING_SCOPE,
|
|
@@ -4795,19 +4958,25 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4795
4958
|
persistDisabledSkills: persistDisabledSkillsFn,
|
|
4796
4959
|
persistSetting: persistSettingFn,
|
|
4797
4960
|
persistSettings: persistSettingsFn,
|
|
4798
|
-
reloadDaemonEnv: /* @__PURE__ */ __name((workspace) => withSettingsLock(workspace, async () => {
|
|
4961
|
+
reloadDaemonEnv: /* @__PURE__ */ __name((workspace, assertGenerationOpen) => withSettingsLock(workspace, async () => {
|
|
4962
|
+
assertGenerationOpen?.();
|
|
4799
4963
|
const fresh = settingsRuntime.settings.loadSettings(workspace, {
|
|
4800
|
-
skipLoadEnvironment: true
|
|
4964
|
+
skipLoadEnvironment: true,
|
|
4965
|
+
skipWorkspaceSettings: !secondaryTrusted,
|
|
4966
|
+
workspaceTrusted: secondaryTrusted
|
|
4801
4967
|
});
|
|
4968
|
+
assertGenerationOpen?.();
|
|
4802
4969
|
const result = settingsRuntime.settings.reloadEnvironment(
|
|
4803
4970
|
fresh.merged,
|
|
4804
|
-
workspace
|
|
4971
|
+
workspace,
|
|
4972
|
+
secondaryTrusted
|
|
4805
4973
|
);
|
|
4806
4974
|
try {
|
|
4807
4975
|
const refreshedRuntimeEnv = settingsRuntime.environment.buildRuntimeEnvironment(
|
|
4808
4976
|
fresh.merged,
|
|
4809
4977
|
workspace,
|
|
4810
|
-
daemonRuntimeBaseEnv
|
|
4978
|
+
daemonRuntimeBaseEnv,
|
|
4979
|
+
secondaryTrusted
|
|
4811
4980
|
);
|
|
4812
4981
|
logRuntimeEnvFileReadFailures(workspace, refreshedRuntimeEnv);
|
|
4813
4982
|
secondaryEnv.replace(refreshedRuntimeEnv.effectiveEnv);
|
|
@@ -4845,7 +5014,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4845
5014
|
refreshExtensionsForAllSessions: /* @__PURE__ */ __name(() => secondaryBridge.refreshExtensionsForAllSessions(), "refreshExtensionsForAllSessions"),
|
|
4846
5015
|
publishWorkspaceEvent: /* @__PURE__ */ __name((event) => secondaryBridge.publishWorkspaceEvent(event), "publishWorkspaceEvent")
|
|
4847
5016
|
});
|
|
4848
|
-
|
|
5017
|
+
const secondaryRuntime = {
|
|
4849
5018
|
workspaceId: secondaryWorkspaceHash,
|
|
4850
5019
|
workspaceCwd: workspaceInput.cwd,
|
|
4851
5020
|
...workspaceInput.displayName ? { displayName: workspaceInput.displayName } : {},
|
|
@@ -4857,12 +5026,24 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4857
5026
|
bridge: secondaryBridge,
|
|
4858
5027
|
workspaceService: secondaryWorkspaceService,
|
|
4859
5028
|
routeFileSystemFactory: secondaryBridgeFsFactory,
|
|
4860
|
-
clientMcpSenderRegistry: secondaryClientMcpSenderRegistry
|
|
4861
|
-
|
|
5029
|
+
clientMcpSenderRegistry: secondaryClientMcpSenderRegistry,
|
|
5030
|
+
generationGuard: secondaryGenerationGuard,
|
|
5031
|
+
trustMaterialization: JSON.stringify({
|
|
5032
|
+
trusted: secondaryTrusted,
|
|
5033
|
+
boundWorkspaces: [workspaceInput.cwd]
|
|
5034
|
+
})
|
|
5035
|
+
};
|
|
5036
|
+
subSessionStoppersByRuntime.set(
|
|
5037
|
+
secondaryRuntime,
|
|
5038
|
+
secondarySubSessionLauncher.stop
|
|
5039
|
+
);
|
|
5040
|
+
workspaceRuntimes.push(secondaryRuntime);
|
|
4862
5041
|
}
|
|
4863
5042
|
const workspaceRegistry = runtime.createWorkspaceRegistry(workspaceRuntimes, {
|
|
4864
|
-
sessionOwnerIndex
|
|
5043
|
+
sessionOwnerIndex,
|
|
5044
|
+
scanUnindexedOwners: deps.bridge !== void 0
|
|
4865
5045
|
});
|
|
5046
|
+
workspaceRegistryForPersistence.current = workspaceRegistry;
|
|
4866
5047
|
const workspaceVoiceCoordinator = new WorkspaceVoiceCoordinator();
|
|
4867
5048
|
core.registerDaemonGaugeCallbacks({
|
|
4868
5049
|
sessionCount: /* @__PURE__ */ __name(() => workspaceRegistry.list().reduce((sum, item) => sum + item.bridge.sessionCount, 0), "sessionCount"),
|
|
@@ -4897,9 +5078,15 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4897
5078
|
const rejectedTotal = hits ? hits.prompt + hits.mutation + hits.read : 0;
|
|
4898
5079
|
const rateLimitRejected = prevRateRejected === void 0 ? 0 : Math.max(0, rejectedTotal - prevRateRejected);
|
|
4899
5080
|
prevRateRejected = rejectedTotal;
|
|
4900
|
-
const
|
|
5081
|
+
const primaryEntry = workspaceRegistry.primaryEntry;
|
|
5082
|
+
const primaryRuntimeBridge = primaryEntry.state === "active" ? primaryEntry.current?.runtime.bridge : void 0;
|
|
5083
|
+
const child = primaryRuntimeBridge?.getChildResourceSnapshot?.();
|
|
4901
5084
|
if (runtime.getActiveSseCount() > 0 || (acp?.wsStreams ?? 0) > 0) {
|
|
4902
|
-
void
|
|
5085
|
+
void primaryRuntimeBridge?.refreshChildResource?.().catch((err) => {
|
|
5086
|
+
daemonLog.warn(
|
|
5087
|
+
`ACP child resource refresh failed: ${err instanceof Error ? err.message : String(err)}`
|
|
5088
|
+
);
|
|
5089
|
+
});
|
|
4903
5090
|
}
|
|
4904
5091
|
metricsRing.sample(nowMs, {
|
|
4905
5092
|
cpuPercent,
|
|
@@ -4955,34 +5142,52 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4955
5142
|
metricsLoopDelay.disable();
|
|
4956
5143
|
}
|
|
4957
5144
|
};
|
|
4958
|
-
const createDynamicWorkspaceRuntime = /* @__PURE__ */ __name(async (cwd,
|
|
4959
|
-
|
|
5145
|
+
const createDynamicWorkspaceRuntime = /* @__PURE__ */ __name(async (cwd, buildOptions) => {
|
|
5146
|
+
const provenance = buildOptions?.provenance ?? "existing";
|
|
5147
|
+
if (provenance === "managed-scratch" && (!managedScratchRoot || !isManagedScratchChild(cwd, managedScratchRoot.canonicalRoot))) {
|
|
4960
5148
|
throw new Error(
|
|
4961
5149
|
"Managed scratch runtime must use an accepted direct child directory"
|
|
4962
5150
|
);
|
|
4963
5151
|
}
|
|
5152
|
+
const snapshot = buildOptions?.snapshot ?? await trustPolicy.readDaemonTrustPolicySnapshot();
|
|
5153
|
+
const decision = buildOptions?.decision ?? trustPolicy.evaluateDaemonWorkspaceTrust(snapshot, cwd);
|
|
5154
|
+
const trusted = provenance === "managed-scratch" ? true : buildOptions?.trusted ?? decision.targetTrusted;
|
|
4964
5155
|
let wsSettings;
|
|
4965
5156
|
try {
|
|
4966
|
-
wsSettings = settingsRuntime.settings.loadSettings(cwd
|
|
5157
|
+
wsSettings = settingsRuntime.settings.loadSettings(cwd, {
|
|
5158
|
+
skipLoadEnvironment: true,
|
|
5159
|
+
skipWorkspaceSettings: !trusted,
|
|
5160
|
+
workspaceTrusted: trusted
|
|
5161
|
+
});
|
|
4967
5162
|
} catch (err) {
|
|
4968
5163
|
writeStderrLine(
|
|
4969
5164
|
`qwen serve: could not read full settings for dynamic workspace ${cwd} (${err instanceof Error ? err.message : String(err)}); falling back to defaults.`
|
|
4970
5165
|
);
|
|
4971
5166
|
}
|
|
4972
|
-
const
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
).effective.state === "trusted" : false);
|
|
4976
|
-
const wsEnv = createRuntimeEnvMetadata(cwd, wsSettings);
|
|
5167
|
+
const wsEnv = createRuntimeEnvMetadata(cwd, wsSettings, trusted);
|
|
5168
|
+
const wsCustomIgnoreFiles = wsSettings?.merged.context?.fileFiltering?.customIgnoreFiles;
|
|
5169
|
+
const wsContextFilename = extractContextFilename(wsSettings?.merged.context?.fileName) ?? contextFilenameForInit ?? "QWEN.md";
|
|
4977
5170
|
const wsHash = core.hashDaemonWorkspace(cwd);
|
|
5171
|
+
const generationGuard = buildOptions?.generationGuard ?? runtime.createWorkspaceGenerationGuard();
|
|
5172
|
+
const runtimeBoundWorkspaces = buildOptions?.boundWorkspaces ?? [cwd];
|
|
4978
5173
|
const wsFsFactory = runtime.resolveBridgeFsFactory({
|
|
4979
|
-
boundWorkspaces:
|
|
5174
|
+
boundWorkspaces: runtimeBoundWorkspaces,
|
|
4980
5175
|
trusted,
|
|
4981
5176
|
emit: deps.fsAuditEmit,
|
|
4982
5177
|
pathLocks: sharedPathLocks,
|
|
4983
|
-
|
|
5178
|
+
generationGuard,
|
|
5179
|
+
...wsCustomIgnoreFiles !== void 0 ? { customIgnoreFiles: wsCustomIgnoreFiles } : {}
|
|
4984
5180
|
});
|
|
5181
|
+
const wsRouteFsFactory = buildOptions?.primary === true && runtimeBoundWorkspaces.length > 1 ? runtime.resolveBridgeFsFactory({
|
|
5182
|
+
boundWorkspaces: [cwd],
|
|
5183
|
+
trusted,
|
|
5184
|
+
emit: deps.fsAuditEmit,
|
|
5185
|
+
pathLocks: sharedPathLocks,
|
|
5186
|
+
generationGuard,
|
|
5187
|
+
...wsCustomIgnoreFiles !== void 0 ? { customIgnoreFiles: wsCustomIgnoreFiles } : {}
|
|
5188
|
+
}) : wsFsFactory;
|
|
4985
5189
|
const wsChannelFactory = runtime.createSpawnChannelFactory({
|
|
5190
|
+
processRegistry,
|
|
4986
5191
|
sourceEnv: wsEnv.effectiveEnv,
|
|
4987
5192
|
onDiagnosticLine: diagnosticSink,
|
|
4988
5193
|
pipeHooks: {
|
|
@@ -5016,10 +5221,15 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5016
5221
|
),
|
|
5017
5222
|
maxSessions: opts.maxSessions,
|
|
5018
5223
|
freshSessionAdmission: totalSessionAdmission.admit,
|
|
5019
|
-
sessionLifecycle:
|
|
5224
|
+
sessionLifecycle: /* @__PURE__ */ __name((event) => {
|
|
5225
|
+
if (event.type === "registered" && generationGuard.closed) return;
|
|
5226
|
+
sessionOwnerIndex.handleBridgeSessionLifecycle(event);
|
|
5227
|
+
}, "sessionLifecycle"),
|
|
5020
5228
|
...opts.maxPendingPromptsPerSession !== void 0 ? { maxPendingPromptsPerSession: opts.maxPendingPromptsPerSession } : {},
|
|
5021
5229
|
...opts.eventRingSize !== void 0 ? { eventRingSize: opts.eventRingSize } : {},
|
|
5022
5230
|
...opts.compactedReplayMaxBytes !== void 0 ? { compactedReplayMaxBytes: opts.compactedReplayMaxBytes } : {},
|
|
5231
|
+
...opts.maxJournalEvents !== void 0 ? { maxJournalEvents: opts.maxJournalEvents } : {},
|
|
5232
|
+
...opts.maxJournalBytes !== void 0 ? { maxJournalBytes: opts.maxJournalBytes } : {},
|
|
5023
5233
|
...opts.channelIdleTimeoutMs !== void 0 ? { channelIdleTimeoutMs: opts.channelIdleTimeoutMs } : {},
|
|
5024
5234
|
...opts.initializeTimeoutMs !== void 0 ? { initializeTimeoutMs: opts.initializeTimeoutMs } : {},
|
|
5025
5235
|
...opts.sessionReapIntervalMs !== void 0 ? { sessionReapIntervalMs: opts.sessionReapIntervalMs } : {},
|
|
@@ -5032,18 +5242,31 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5032
5242
|
onDiagnosticLine: diagnosticSink,
|
|
5033
5243
|
telemetry: createRuntimeBridgeTelemetry(wsHash),
|
|
5034
5244
|
...permissionPolicy !== void 0 ? { permissionPolicy } : {},
|
|
5035
|
-
...permissionConsensusQuorum !== void 0 ? {
|
|
5245
|
+
...permissionConsensusQuorum !== void 0 ? {
|
|
5246
|
+
permissionConsensusQuorum
|
|
5247
|
+
} : {},
|
|
5036
5248
|
permissionAudit: permissionAuditPublisher,
|
|
5037
5249
|
statusProvider: runtime.createDaemonStatusProvider({
|
|
5038
5250
|
env: wsEnv.effectiveEnv
|
|
5039
5251
|
}),
|
|
5040
5252
|
fileSystem: createBridgeFileSystemAdapter(wsFsFactory),
|
|
5041
5253
|
persistApprovalMode: /* @__PURE__ */ __name((workspace, mode) => withSettingsLock(workspace, async () => {
|
|
5042
|
-
|
|
5254
|
+
generationGuard.assertOpen();
|
|
5255
|
+
if (!trusted) {
|
|
5256
|
+
throw new Error(
|
|
5257
|
+
"Cannot persist approval mode for an untrusted workspace."
|
|
5258
|
+
);
|
|
5259
|
+
}
|
|
5260
|
+
const fresh = settingsRuntime.settings.loadSettings(workspace, {
|
|
5261
|
+
skipLoadEnvironment: true,
|
|
5262
|
+
workspaceTrusted: trusted
|
|
5263
|
+
});
|
|
5264
|
+
generationGuard.assertOpen();
|
|
5043
5265
|
fresh.setValue(
|
|
5044
5266
|
WORKSPACE_SETTING_SCOPE,
|
|
5045
5267
|
"tools.approvalMode",
|
|
5046
|
-
mode
|
|
5268
|
+
mode,
|
|
5269
|
+
() => generationGuard.assertOpen()
|
|
5047
5270
|
);
|
|
5048
5271
|
}), "persistApprovalMode")
|
|
5049
5272
|
});
|
|
@@ -5056,36 +5279,47 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5056
5279
|
try {
|
|
5057
5280
|
wsService = runtime.createDaemonWorkspaceService({
|
|
5058
5281
|
boundWorkspace: cwd,
|
|
5059
|
-
|
|
5282
|
+
isWorkspaceTrusted: /* @__PURE__ */ __name(() => trusted, "isWorkspaceTrusted"),
|
|
5283
|
+
assertGenerationOpen: /* @__PURE__ */ __name(() => generationGuard.assertOpen(), "assertGenerationOpen"),
|
|
5284
|
+
contextFilename: wsContextFilename,
|
|
5060
5285
|
statusProvider: runtime.createDaemonStatusProvider({
|
|
5061
5286
|
env: wsEnv.effectiveEnv
|
|
5062
5287
|
}),
|
|
5063
5288
|
workspaceProvidersStatusProvider: runtime.createWorkspaceProvidersStatusProvider({
|
|
5064
|
-
env: wsEnv.effectiveEnv
|
|
5289
|
+
env: wsEnv.effectiveEnv,
|
|
5290
|
+
workspaceTrusted: trusted
|
|
5291
|
+
}),
|
|
5292
|
+
workspaceSkillsStatusProvider: runtime.createWorkspaceSkillsStatusProvider({
|
|
5293
|
+
workspaceTrusted: trusted
|
|
5065
5294
|
}),
|
|
5066
|
-
workspaceSkillsStatusProvider: runtime.createWorkspaceSkillsStatusProvider(),
|
|
5067
5295
|
skillInstallEnv: wsEnv.effectiveEnv,
|
|
5068
5296
|
voiceEnv: wsEnv.effectiveEnv,
|
|
5069
|
-
voiceSettingsScope: WORKSPACE_SETTING_SCOPE,
|
|
5297
|
+
...buildOptions?.primary === true ? {} : { voiceSettingsScope: WORKSPACE_SETTING_SCOPE },
|
|
5070
5298
|
isChannelLive: /* @__PURE__ */ __name(() => wsBridge.isChannelLive(), "isChannelLive"),
|
|
5071
5299
|
preheatAcpChild: /* @__PURE__ */ __name(() => wsBridge.preheat(), "preheatAcpChild"),
|
|
5072
5300
|
persistDisabledTools: persistDisabledToolsFn,
|
|
5073
5301
|
persistDisabledSkills: persistDisabledSkillsFn,
|
|
5074
5302
|
persistSetting: persistSettingFn,
|
|
5075
5303
|
persistSettings: persistSettingsFn,
|
|
5076
|
-
reloadDaemonEnv: /* @__PURE__ */ __name((workspace) => withSettingsLock(workspace, async () => {
|
|
5304
|
+
reloadDaemonEnv: /* @__PURE__ */ __name((workspace, assertGenerationOpen) => withSettingsLock(workspace, async () => {
|
|
5305
|
+
assertGenerationOpen?.();
|
|
5077
5306
|
const fresh = settingsRuntime.settings.loadSettings(workspace, {
|
|
5078
|
-
skipLoadEnvironment: true
|
|
5307
|
+
skipLoadEnvironment: true,
|
|
5308
|
+
skipWorkspaceSettings: !trusted,
|
|
5309
|
+
workspaceTrusted: trusted
|
|
5079
5310
|
});
|
|
5311
|
+
assertGenerationOpen?.();
|
|
5080
5312
|
const result = settingsRuntime.settings.reloadEnvironment(
|
|
5081
5313
|
fresh.merged,
|
|
5082
|
-
workspace
|
|
5314
|
+
workspace,
|
|
5315
|
+
trusted
|
|
5083
5316
|
);
|
|
5084
5317
|
try {
|
|
5085
5318
|
const refreshedRuntimeEnv = settingsRuntime.environment.buildRuntimeEnvironment(
|
|
5086
5319
|
fresh.merged,
|
|
5087
5320
|
workspace,
|
|
5088
|
-
daemonRuntimeBaseEnv
|
|
5321
|
+
daemonRuntimeBaseEnv,
|
|
5322
|
+
trusted
|
|
5089
5323
|
);
|
|
5090
5324
|
logRuntimeEnvFileReadFailures(workspace, refreshedRuntimeEnv);
|
|
5091
5325
|
wsEnv.replace(refreshedRuntimeEnv.effectiveEnv);
|
|
@@ -5121,7 +5355,12 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5121
5355
|
queryWorkspaceStatus: /* @__PURE__ */ __name((method, idle) => wsBridge.queryWorkspaceStatus(method, idle), "queryWorkspaceStatus"),
|
|
5122
5356
|
invokeWorkspaceCommand: /* @__PURE__ */ __name((method, params, invokeOpts) => wsBridge.invokeWorkspaceCommand(method, params, invokeOpts), "invokeWorkspaceCommand"),
|
|
5123
5357
|
refreshExtensionsForAllSessions: /* @__PURE__ */ __name(() => wsBridge.refreshExtensionsForAllSessions(), "refreshExtensionsForAllSessions"),
|
|
5124
|
-
publishWorkspaceEvent: /* @__PURE__ */ __name((event) =>
|
|
5358
|
+
publishWorkspaceEvent: /* @__PURE__ */ __name((event) => {
|
|
5359
|
+
if (buildOptions?.primary === true && (event.type === "settings_changed" || event.type === "settings_reloaded")) {
|
|
5360
|
+
invalidatePrimaryServeFeaturesCache();
|
|
5361
|
+
}
|
|
5362
|
+
wsBridge.publishWorkspaceEvent(event);
|
|
5363
|
+
}, "publishWorkspaceEvent")
|
|
5125
5364
|
});
|
|
5126
5365
|
} catch (err) {
|
|
5127
5366
|
wsSubSessionLauncher.stop();
|
|
@@ -5136,31 +5375,75 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5136
5375
|
runtimeBridges.push(wsBridge);
|
|
5137
5376
|
internalRuntimeBridgesForCleanup.push(wsBridge);
|
|
5138
5377
|
subSessionStoppers.push(wsSubSessionLauncher.stop);
|
|
5139
|
-
|
|
5140
|
-
return {
|
|
5378
|
+
const wsRuntime = {
|
|
5141
5379
|
workspaceId: wsHash,
|
|
5142
5380
|
workspaceCwd: cwd,
|
|
5143
|
-
|
|
5381
|
+
...buildOptions?.displayName !== void 0 ? { displayName: buildOptions.displayName } : {},
|
|
5382
|
+
primary: buildOptions?.primary ?? false,
|
|
5144
5383
|
trusted,
|
|
5145
|
-
|
|
5146
|
-
|
|
5384
|
+
provenance,
|
|
5385
|
+
removable: buildOptions?.removable ?? true,
|
|
5386
|
+
registrationIds: [...buildOptions?.registrationIds ?? []],
|
|
5147
5387
|
env: wsEnv.metadata,
|
|
5148
5388
|
bridge: wsBridge,
|
|
5149
5389
|
workspaceService: wsService,
|
|
5150
|
-
routeFileSystemFactory:
|
|
5151
|
-
clientMcpSenderRegistry: wsClientMcpRegistry
|
|
5390
|
+
routeFileSystemFactory: wsRouteFsFactory,
|
|
5391
|
+
clientMcpSenderRegistry: wsClientMcpRegistry,
|
|
5392
|
+
generationGuard,
|
|
5393
|
+
trustMaterialization: buildOptions?.trustMaterialization ?? JSON.stringify({
|
|
5394
|
+
trusted,
|
|
5395
|
+
boundWorkspaces: [...runtimeBoundWorkspaces].sort()
|
|
5396
|
+
})
|
|
5152
5397
|
};
|
|
5398
|
+
subSessionStoppersByRuntime.set(wsRuntime, wsSubSessionLauncher.stop);
|
|
5399
|
+
if (provenance !== "managed-scratch" && !buildOptions?.snapshot) {
|
|
5400
|
+
const latest = await trustPolicy.readDaemonTrustPolicySnapshot();
|
|
5401
|
+
if (latest.revision !== snapshot.revision) {
|
|
5402
|
+
generationGuard.close();
|
|
5403
|
+
wsSubSessionLauncher.stop();
|
|
5404
|
+
await wsBridge.shutdown({ reason: "trust_reconfigured" }).catch(() => {
|
|
5405
|
+
try {
|
|
5406
|
+
wsBridge.killAllSync();
|
|
5407
|
+
} catch {
|
|
5408
|
+
}
|
|
5409
|
+
});
|
|
5410
|
+
subSessionStoppersByRuntime.delete(wsRuntime);
|
|
5411
|
+
removeArrayValue(subSessionStoppers, wsSubSessionLauncher.stop);
|
|
5412
|
+
removeArrayValue(runtimeBridges, wsBridge);
|
|
5413
|
+
removeArrayValue(internalRuntimeBridgesForCleanup, wsBridge);
|
|
5414
|
+
if ((buildOptions?.validationAttempt ?? 0) >= 2) {
|
|
5415
|
+
throw new Error(
|
|
5416
|
+
"Workspace trust policy kept changing during runtime creation."
|
|
5417
|
+
);
|
|
5418
|
+
}
|
|
5419
|
+
const { generationGuard: _staleGuard, ...retryOptions } = buildOptions ?? {};
|
|
5420
|
+
return createDynamicWorkspaceRuntime(cwd, {
|
|
5421
|
+
...retryOptions,
|
|
5422
|
+
validationAttempt: (buildOptions?.validationAttempt ?? 0) + 1
|
|
5423
|
+
});
|
|
5424
|
+
}
|
|
5425
|
+
}
|
|
5426
|
+
return wsRuntime;
|
|
5153
5427
|
}, "createDynamicWorkspaceRuntime");
|
|
5428
|
+
const serveAppForRuntimeLifecycle = { current: void 0 };
|
|
5154
5429
|
const workspaceRuntimeRemoval = {
|
|
5155
5430
|
async runtimeAdded(runtimeAdded) {
|
|
5156
|
-
|
|
5431
|
+
channelWebhookEnvByWorkspace.set(
|
|
5432
|
+
runtimeAdded.workspaceCwd,
|
|
5433
|
+
workspaceRuntimeEffectiveEnv(runtimeAdded, daemonRuntimeBaseEnv)
|
|
5434
|
+
);
|
|
5435
|
+
channelWebhookConfigVersion += 1;
|
|
5436
|
+
refreshChannelWebhookConfigs?.();
|
|
5437
|
+
const app3 = serveAppForRuntimeLifecycle.current ?? runtimeApp ?? runtimeAppForCleanup;
|
|
5157
5438
|
const startScheduledTaskKeepaliveForWorkspace = app3?.locals?.["startScheduledTaskKeepaliveForWorkspace"];
|
|
5158
5439
|
startScheduledTaskKeepaliveForWorkspace?.(runtimeAdded);
|
|
5159
5440
|
if (!channelWorkerManager) return;
|
|
5160
5441
|
try {
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5442
|
+
if (runtimeAdded.trusted) {
|
|
5443
|
+
await channelWorkerManager.restoreWorkspace(
|
|
5444
|
+
runtimeAdded.workspaceCwd
|
|
5445
|
+
);
|
|
5446
|
+
}
|
|
5164
5447
|
await channelWorkerManager.refreshWorkspaces();
|
|
5165
5448
|
} catch (err) {
|
|
5166
5449
|
daemonLog.error(
|
|
@@ -5172,14 +5455,51 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5172
5455
|
}
|
|
5173
5456
|
},
|
|
5174
5457
|
beginDrain(runtimeToDrain) {
|
|
5458
|
+
if (runtimeToDrain.primary) {
|
|
5459
|
+
if (bridgeRef === runtimeToDrain.bridge) bridgeRef = void 0;
|
|
5460
|
+
invalidatePrimaryServeFeaturesCache();
|
|
5461
|
+
}
|
|
5175
5462
|
totalSessionAdmission.beginWorkspaceDrain(runtimeToDrain.workspaceCwd);
|
|
5176
5463
|
channelWorkerManager?.beginWorkspaceDrain(runtimeToDrain.workspaceCwd);
|
|
5177
5464
|
workspaceVoiceCoordinator.beginWorkspaceDrain(runtimeToDrain);
|
|
5465
|
+
channelWebhookEnvByWorkspace.delete(runtimeToDrain.workspaceCwd);
|
|
5466
|
+
channelWebhookConfigVersion += 1;
|
|
5467
|
+
refreshChannelWebhookConfigs?.();
|
|
5468
|
+
const app3 = serveAppForRuntimeLifecycle.current ?? runtimeApp ?? runtimeAppForCleanup;
|
|
5469
|
+
const stopScheduledTaskKeepaliveForWorkspace = app3?.locals?.["stopScheduledTaskKeepaliveForWorkspace"];
|
|
5470
|
+
try {
|
|
5471
|
+
stopScheduledTaskKeepaliveForWorkspace?.(runtimeToDrain.workspaceCwd);
|
|
5472
|
+
} catch (err) {
|
|
5473
|
+
daemonLog.error(
|
|
5474
|
+
"workspace scheduled-task drain error",
|
|
5475
|
+
err instanceof Error ? err : null
|
|
5476
|
+
);
|
|
5477
|
+
}
|
|
5178
5478
|
},
|
|
5179
5479
|
cancelDrain(runtimeToDrain) {
|
|
5480
|
+
if (runtimeToDrain.primary && bridgeRef === void 0) {
|
|
5481
|
+
bridgeRef = runtimeToDrain.bridge;
|
|
5482
|
+
invalidatePrimaryServeFeaturesCache();
|
|
5483
|
+
}
|
|
5180
5484
|
channelWorkerManager?.cancelWorkspaceDrain(runtimeToDrain.workspaceCwd);
|
|
5181
5485
|
totalSessionAdmission.cancelWorkspaceDrain(runtimeToDrain.workspaceCwd);
|
|
5182
5486
|
workspaceVoiceCoordinator.cancelWorkspaceDrain(runtimeToDrain);
|
|
5487
|
+
channelWebhookEnvByWorkspace.set(
|
|
5488
|
+
runtimeToDrain.workspaceCwd,
|
|
5489
|
+
workspaceRuntimeEffectiveEnv(runtimeToDrain, daemonRuntimeBaseEnv)
|
|
5490
|
+
);
|
|
5491
|
+
channelWebhookConfigVersion += 1;
|
|
5492
|
+
refreshChannelWebhookConfigs?.();
|
|
5493
|
+
const app3 = serveAppForRuntimeLifecycle.current ?? runtimeApp ?? runtimeAppForCleanup;
|
|
5494
|
+
const startScheduledTaskKeepaliveForWorkspace = app3?.locals?.["startScheduledTaskKeepaliveForWorkspace"];
|
|
5495
|
+
try {
|
|
5496
|
+
startScheduledTaskKeepaliveForWorkspace?.(runtimeToDrain);
|
|
5497
|
+
} catch (err) {
|
|
5498
|
+
daemonLog.error(
|
|
5499
|
+
"workspace scheduled-task drain rollback error",
|
|
5500
|
+
err instanceof Error ? err : null
|
|
5501
|
+
);
|
|
5502
|
+
}
|
|
5183
5503
|
},
|
|
5184
5504
|
completeDrain(runtimeToDrain) {
|
|
5185
5505
|
totalSessionAdmission.completeWorkspaceDrain(
|
|
@@ -5202,18 +5522,29 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5202
5522
|
const existing = runtimeCleanupPromises.get(runtimeToDrain);
|
|
5203
5523
|
if (existing) return existing;
|
|
5204
5524
|
const cleanup = (async () => {
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
)
|
|
5525
|
+
const containmentErrors = [];
|
|
5526
|
+
try {
|
|
5527
|
+
await workspaceVoiceCoordinator.disposeRuntime(
|
|
5528
|
+
runtimeToDrain,
|
|
5529
|
+
reason
|
|
5530
|
+
);
|
|
5531
|
+
} catch (err) {
|
|
5532
|
+
daemonLog.error(
|
|
5533
|
+
"workspace voice cleanup error",
|
|
5534
|
+
err instanceof Error ? err : null
|
|
5535
|
+
);
|
|
5536
|
+
}
|
|
5537
|
+
if (reason === "trust_reconfigured" && workspaceVoiceCoordinator.getWorkspaceActivity(runtimeToDrain) > 0) {
|
|
5538
|
+
containmentErrors.push(
|
|
5539
|
+
new Error("Workspace voice sessions are still active.")
|
|
5540
|
+
);
|
|
5541
|
+
}
|
|
5542
|
+
const stopSubSessions = subSessionStoppersByRuntime.get(runtimeToDrain);
|
|
5212
5543
|
try {
|
|
5213
5544
|
stopSubSessions?.();
|
|
5214
5545
|
} catch {
|
|
5215
5546
|
}
|
|
5216
|
-
if (reason
|
|
5547
|
+
if (reason !== "daemon_shutdown" && channelWorkerManager) {
|
|
5217
5548
|
await channelWorkerManager.removeWorkspace(runtimeToDrain.workspaceCwd).catch((err) => {
|
|
5218
5549
|
daemonLog.error(
|
|
5219
5550
|
"workspace channel worker cleanup error",
|
|
@@ -5234,25 +5565,65 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5234
5565
|
);
|
|
5235
5566
|
}
|
|
5236
5567
|
writeChannelWorkerPidfile();
|
|
5568
|
+
if (reason === "trust_reconfigured" && channelWorkerManager.workspaceActivity(
|
|
5569
|
+
runtimeToDrain.workspaceCwd
|
|
5570
|
+
) > 0) {
|
|
5571
|
+
containmentErrors.push(
|
|
5572
|
+
new Error("Workspace channel workers are still active.")
|
|
5573
|
+
);
|
|
5574
|
+
}
|
|
5237
5575
|
}
|
|
5238
|
-
if (reason
|
|
5239
|
-
const app3 = runtimeApp ?? runtimeAppForCleanup;
|
|
5576
|
+
if (reason !== "daemon_shutdown") {
|
|
5577
|
+
const app3 = serveAppForRuntimeLifecycle.current ?? runtimeApp ?? runtimeAppForCleanup;
|
|
5240
5578
|
const stopWorkspaceGitStateForWorkspace = app3?.locals?.["stopWorkspaceGitStateForWorkspace"];
|
|
5241
5579
|
const stopScheduledTaskKeepaliveForWorkspace = app3?.locals?.["stopScheduledTaskKeepaliveForWorkspace"];
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5580
|
+
try {
|
|
5581
|
+
stopWorkspaceGitStateForWorkspace?.(runtimeToDrain.workspaceCwd);
|
|
5582
|
+
} catch (err) {
|
|
5583
|
+
daemonLog.error(
|
|
5584
|
+
"workspace git-state cleanup error",
|
|
5585
|
+
err instanceof Error ? err : null
|
|
5586
|
+
);
|
|
5587
|
+
}
|
|
5588
|
+
try {
|
|
5589
|
+
stopScheduledTaskKeepaliveForWorkspace?.(
|
|
5590
|
+
runtimeToDrain.workspaceCwd
|
|
5591
|
+
);
|
|
5592
|
+
} catch (err) {
|
|
5593
|
+
daemonLog.error(
|
|
5594
|
+
"workspace scheduled-task cleanup error",
|
|
5595
|
+
err instanceof Error ? err : null
|
|
5596
|
+
);
|
|
5597
|
+
}
|
|
5246
5598
|
}
|
|
5247
5599
|
let bridgeStopped = false;
|
|
5248
5600
|
try {
|
|
5249
5601
|
if (!shutdownBridges.has(runtimeToDrain.bridge)) {
|
|
5250
|
-
|
|
5602
|
+
try {
|
|
5603
|
+
await runtimeToDrain.bridge.shutdown({ reason });
|
|
5604
|
+
} catch (shutdownError) {
|
|
5605
|
+
try {
|
|
5606
|
+
runtimeToDrain.bridge.killAllSync();
|
|
5607
|
+
daemonLog.warn(
|
|
5608
|
+
"workspace bridge required forceful shutdown",
|
|
5609
|
+
{
|
|
5610
|
+
workspace: runtimeToDrain.workspaceCwd,
|
|
5611
|
+
reason,
|
|
5612
|
+
error: shutdownError instanceof Error ? shutdownError.message : String(shutdownError)
|
|
5613
|
+
}
|
|
5614
|
+
);
|
|
5615
|
+
} catch (killError) {
|
|
5616
|
+
throw new AggregateError(
|
|
5617
|
+
[shutdownError, killError],
|
|
5618
|
+
"Workspace bridge shutdown could not be confirmed."
|
|
5619
|
+
);
|
|
5620
|
+
}
|
|
5621
|
+
}
|
|
5251
5622
|
}
|
|
5252
5623
|
bridgeStopped = true;
|
|
5253
5624
|
} finally {
|
|
5254
|
-
if (bridgeStopped
|
|
5255
|
-
|
|
5625
|
+
if (bridgeStopped) {
|
|
5626
|
+
subSessionStoppersByRuntime.delete(runtimeToDrain);
|
|
5256
5627
|
if (stopSubSessions) {
|
|
5257
5628
|
removeArrayValue(subSessionStoppers, stopSubSessions);
|
|
5258
5629
|
}
|
|
@@ -5264,22 +5635,103 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5264
5635
|
shutdownBridges.add(runtimeToDrain.bridge);
|
|
5265
5636
|
}
|
|
5266
5637
|
}
|
|
5638
|
+
if (containmentErrors.length > 0) {
|
|
5639
|
+
throw new AggregateError(
|
|
5640
|
+
containmentErrors,
|
|
5641
|
+
"Workspace runtime containment could not be confirmed."
|
|
5642
|
+
);
|
|
5643
|
+
}
|
|
5267
5644
|
})();
|
|
5268
5645
|
runtimeCleanupPromises.set(runtimeToDrain, cleanup);
|
|
5269
5646
|
void cleanup.catch(() => {
|
|
5270
|
-
if (
|
|
5647
|
+
if (runtimeCleanupPromises.get(runtimeToDrain) === cleanup) {
|
|
5271
5648
|
runtimeCleanupPromises.delete(runtimeToDrain);
|
|
5272
5649
|
}
|
|
5273
5650
|
});
|
|
5274
5651
|
return cleanup;
|
|
5275
5652
|
}
|
|
5276
5653
|
};
|
|
5654
|
+
const channelManagementServices = /* @__PURE__ */ new WeakMap();
|
|
5655
|
+
const channelManagementService = /* @__PURE__ */ __name((targetRuntime) => {
|
|
5656
|
+
const existing = channelManagementServices.get(targetRuntime);
|
|
5657
|
+
if (existing) return existing;
|
|
5658
|
+
const pending = (async () => {
|
|
5659
|
+
if (!ensureChannelWorkerManager) {
|
|
5660
|
+
throw Object.assign(
|
|
5661
|
+
new Error("Channel worker manager is unavailable."),
|
|
5662
|
+
{ code: "channel_worker_unavailable" }
|
|
5663
|
+
);
|
|
5664
|
+
}
|
|
5665
|
+
const [
|
|
5666
|
+
{ createChannelManagementService },
|
|
5667
|
+
{ WorkspaceChannelSettingsStore }
|
|
5668
|
+
] = await Promise.all([
|
|
5669
|
+
import("./channel-management-service-XR7GZSWF.js"),
|
|
5670
|
+
import("./channel-settings-store-HW4FXXUA.js")
|
|
5671
|
+
]);
|
|
5672
|
+
return createChannelManagementService({
|
|
5673
|
+
workspaceCwd: targetRuntime.workspaceCwd,
|
|
5674
|
+
store: new WorkspaceChannelSettingsStore(targetRuntime.workspaceCwd),
|
|
5675
|
+
manager: await ensureChannelWorkerManager()
|
|
5676
|
+
});
|
|
5677
|
+
})();
|
|
5678
|
+
channelManagementServices.set(targetRuntime, pending);
|
|
5679
|
+
void pending.catch(() => {
|
|
5680
|
+
if (channelManagementServices.get(targetRuntime) === pending) {
|
|
5681
|
+
channelManagementServices.delete(targetRuntime);
|
|
5682
|
+
}
|
|
5683
|
+
});
|
|
5684
|
+
return pending;
|
|
5685
|
+
}, "channelManagementService");
|
|
5686
|
+
const validateWorkspaceRuntimeForPublication = /* @__PURE__ */ __name(async (runtimeForPublication) => {
|
|
5687
|
+
let candidate = runtimeForPublication;
|
|
5688
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
5689
|
+
const snapshot = await trustPolicy.readDaemonTrustPolicySnapshot();
|
|
5690
|
+
const decision = trustPolicy.evaluateDaemonWorkspaceTrust(
|
|
5691
|
+
snapshot,
|
|
5692
|
+
candidate.workspaceCwd
|
|
5693
|
+
);
|
|
5694
|
+
const materialization = JSON.stringify({
|
|
5695
|
+
trusted: decision.targetTrusted,
|
|
5696
|
+
boundWorkspaces: [candidate.workspaceCwd]
|
|
5697
|
+
});
|
|
5698
|
+
if (candidate.trustMaterialization === materialization) {
|
|
5699
|
+
return candidate;
|
|
5700
|
+
}
|
|
5701
|
+
candidate.generationGuard?.close();
|
|
5702
|
+
await workspaceRuntimeRemoval.disposeRuntime(
|
|
5703
|
+
candidate,
|
|
5704
|
+
"trust_reconfigured"
|
|
5705
|
+
);
|
|
5706
|
+
if (attempt === 2) {
|
|
5707
|
+
throw new Error(
|
|
5708
|
+
"Workspace trust policy kept changing before runtime publication."
|
|
5709
|
+
);
|
|
5710
|
+
}
|
|
5711
|
+
candidate = await createDynamicWorkspaceRuntime(
|
|
5712
|
+
runtimeForPublication.workspaceCwd,
|
|
5713
|
+
{
|
|
5714
|
+
primary: runtimeForPublication.primary,
|
|
5715
|
+
removable: runtimeForPublication.removable,
|
|
5716
|
+
displayName: runtimeForPublication.displayName,
|
|
5717
|
+
registrationIds: runtimeForPublication.registrationIds
|
|
5718
|
+
}
|
|
5719
|
+
);
|
|
5720
|
+
}
|
|
5721
|
+
throw new Error("Workspace runtime publication validation failed.");
|
|
5722
|
+
}, "validateWorkspaceRuntimeForPublication");
|
|
5277
5723
|
const app2 = runtime.createServeApp(opts, () => actualPort, {
|
|
5278
5724
|
workspaceRegistry,
|
|
5279
5725
|
createWorkspaceRuntime: createDynamicWorkspaceRuntime,
|
|
5726
|
+
...workspaceTrustHotReloadAvailable ? {
|
|
5727
|
+
validateWorkspaceRuntimeForPublication,
|
|
5728
|
+
runWorkspaceTrustOperation,
|
|
5729
|
+
getWorkspaceTrustPolicySnapshot: /* @__PURE__ */ __name(() => latestTrustPolicySnapshot, "getWorkspaceTrustPolicySnapshot")
|
|
5730
|
+
} : {},
|
|
5280
5731
|
managedScratchRoot,
|
|
5281
5732
|
workspaceRegistrationStore,
|
|
5282
5733
|
workspaceRuntimeRemoval,
|
|
5734
|
+
workspaceTrustHotReloadAvailable,
|
|
5283
5735
|
voiceCoordinator: workspaceVoiceCoordinator,
|
|
5284
5736
|
bridge,
|
|
5285
5737
|
webShellDir,
|
|
@@ -5330,6 +5782,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5330
5782
|
}, "deliverChannelMessage"),
|
|
5331
5783
|
channelDeliveryAuthorizations,
|
|
5332
5784
|
reloadChannelWorker,
|
|
5785
|
+
channelManagementService,
|
|
5333
5786
|
getPerfSnapshot: /* @__PURE__ */ __name(() => ({
|
|
5334
5787
|
eventLoop: currentDaemonEventLoopMonitor.snapshot(),
|
|
5335
5788
|
promptQueueWait: {
|
|
@@ -5357,9 +5810,10 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5357
5810
|
sessionArtifactsPersistenceAvailable: sessionArtifactsPersistenceAvailableFromSettings(
|
|
5358
5811
|
runtimeBootSettings?.merged
|
|
5359
5812
|
),
|
|
5360
|
-
installAuthProvider: /* @__PURE__ */ __name((req) => withSettingsLock(
|
|
5813
|
+
installAuthProvider: /* @__PURE__ */ __name((req, assertGenerationOpen) => withSettingsLock(
|
|
5361
5814
|
boundWorkspace,
|
|
5362
5815
|
async () => {
|
|
5816
|
+
assertGenerationOpen?.();
|
|
5363
5817
|
const provider = core.findProviderById(req.providerId);
|
|
5364
5818
|
if (!provider) {
|
|
5365
5819
|
throw new Error(`Unsupported auth provider: ${req.providerId}`);
|
|
@@ -5369,7 +5823,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5369
5823
|
resolveBaseUrl: core.resolveBaseUrl
|
|
5370
5824
|
});
|
|
5371
5825
|
const plan = core.buildInstallPlan(provider, inputs);
|
|
5372
|
-
const fresh =
|
|
5826
|
+
const fresh = loadSettingsForPersistence(boundWorkspace);
|
|
5373
5827
|
const adapter = settingsRuntime.loadedSettingsAdapter.createLoadedSettingsAdapter(
|
|
5374
5828
|
fresh
|
|
5375
5829
|
);
|
|
@@ -5377,6 +5831,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5377
5831
|
settings: adapter,
|
|
5378
5832
|
doRefreshAuth: false
|
|
5379
5833
|
});
|
|
5834
|
+
assertGenerationOpen?.();
|
|
5380
5835
|
core.emitDaemonLog("Auth provider installed.", {
|
|
5381
5836
|
"qwen-code.daemon.auth.provider_id": provider.id,
|
|
5382
5837
|
"qwen-code.daemon.auth.auth_type": plan.authType
|
|
@@ -5395,11 +5850,171 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5395
5850
|
}
|
|
5396
5851
|
), "installAuthProvider")
|
|
5397
5852
|
});
|
|
5853
|
+
serveAppForRuntimeLifecycle.current = app2;
|
|
5398
5854
|
invalidatePrimaryServeFeaturesCache = app2.locals.invalidateServeFeaturesCache ?? invalidatePrimaryServeFeaturesCache;
|
|
5399
5855
|
app2.locals.subSessionStoppers = subSessionStoppers;
|
|
5400
5856
|
subSessionStoppers.push(subSessionLauncher.stop);
|
|
5401
|
-
|
|
5402
|
-
|
|
5857
|
+
subSessionStoppersByRuntime.set(
|
|
5858
|
+
workspaceRegistry.primary,
|
|
5859
|
+
subSessionLauncher.stop
|
|
5860
|
+
);
|
|
5861
|
+
if (workspaceTrustHotReloadAvailable) {
|
|
5862
|
+
const [
|
|
5863
|
+
{ createWorkspaceTrustReconciler },
|
|
5864
|
+
{ createDaemonTrustPolicyMonitor }
|
|
5865
|
+
] = await Promise.all([
|
|
5866
|
+
import("./workspace-trust-reconciler-IBUPOUJN.js"),
|
|
5867
|
+
import("./daemon-trust-policy-monitor-HS3PKKRO.js")
|
|
5868
|
+
]);
|
|
5869
|
+
const materializationFor = /* @__PURE__ */ __name((entry, snapshot, decision) => {
|
|
5870
|
+
const boundWorkspaces2 = entry.primary && decision.targetTrusted ? runtime.resolveBoundWorkspacesFromIdeEnv(
|
|
5871
|
+
entry.workspaceCwd,
|
|
5872
|
+
void 0,
|
|
5873
|
+
(workspace, index) => index === 0 || trustPolicy.evaluateDaemonWorkspaceTrust(snapshot, workspace).targetTrusted
|
|
5874
|
+
) : [entry.workspaceCwd];
|
|
5875
|
+
return {
|
|
5876
|
+
key: JSON.stringify({
|
|
5877
|
+
trusted: decision.targetTrusted,
|
|
5878
|
+
boundWorkspaces: [...boundWorkspaces2].sort()
|
|
5879
|
+
}),
|
|
5880
|
+
boundWorkspaces: boundWorkspaces2
|
|
5881
|
+
};
|
|
5882
|
+
}, "materializationFor");
|
|
5883
|
+
const acpHandle = /* @__PURE__ */ __name(() => app2.locals?.["acpHandle"], "acpHandle");
|
|
5884
|
+
const trustReconciler = createWorkspaceTrustReconciler({
|
|
5885
|
+
registry: workspaceRegistry,
|
|
5886
|
+
readLatestSnapshot: trustPolicy.readDaemonTrustPolicySnapshot,
|
|
5887
|
+
materializationKey: /* @__PURE__ */ __name(({ entry, snapshot, decision }) => materializationFor(entry, snapshot, decision).key, "materializationKey"),
|
|
5888
|
+
isTrustDecrease: /* @__PURE__ */ __name(({
|
|
5889
|
+
runtime: current,
|
|
5890
|
+
nextMaterialization,
|
|
5891
|
+
decision
|
|
5892
|
+
}) => {
|
|
5893
|
+
if (current.trusted && !decision.targetTrusted) return true;
|
|
5894
|
+
if (!current.primary || !current.trusted) return false;
|
|
5895
|
+
try {
|
|
5896
|
+
const previous = JSON.parse(
|
|
5897
|
+
current.trustMaterialization ?? "{}"
|
|
5898
|
+
);
|
|
5899
|
+
const next = JSON.parse(nextMaterialization);
|
|
5900
|
+
if (!Array.isArray(previous.boundWorkspaces) || !Array.isArray(next.boundWorkspaces)) {
|
|
5901
|
+
return true;
|
|
5902
|
+
}
|
|
5903
|
+
const nextRoots = new Set(
|
|
5904
|
+
next.boundWorkspaces.filter(
|
|
5905
|
+
(value) => typeof value === "string"
|
|
5906
|
+
)
|
|
5907
|
+
);
|
|
5908
|
+
return previous.boundWorkspaces.some(
|
|
5909
|
+
(value) => typeof value !== "string" || !nextRoots.has(value)
|
|
5910
|
+
);
|
|
5911
|
+
} catch {
|
|
5912
|
+
return true;
|
|
5913
|
+
}
|
|
5914
|
+
}, "isTrustDecrease"),
|
|
5915
|
+
buildRuntime: /* @__PURE__ */ __name(async ({
|
|
5916
|
+
entry,
|
|
5917
|
+
trusted,
|
|
5918
|
+
snapshot,
|
|
5919
|
+
decision,
|
|
5920
|
+
generationGuard
|
|
5921
|
+
}) => {
|
|
5922
|
+
const materialized = materializationFor(
|
|
5923
|
+
entry,
|
|
5924
|
+
snapshot,
|
|
5925
|
+
trusted === decision.targetTrusted ? decision : { ...decision, targetTrusted: trusted }
|
|
5926
|
+
);
|
|
5927
|
+
return createDynamicWorkspaceRuntime(entry.workspaceCwd, {
|
|
5928
|
+
trusted,
|
|
5929
|
+
snapshot,
|
|
5930
|
+
decision,
|
|
5931
|
+
generationGuard,
|
|
5932
|
+
primary: entry.primary,
|
|
5933
|
+
removable: entry.removable,
|
|
5934
|
+
displayName: entry.displayName,
|
|
5935
|
+
registrationIds: entry.registrationIds,
|
|
5936
|
+
boundWorkspaces: materialized.boundWorkspaces,
|
|
5937
|
+
trustMaterialization: materialized.key
|
|
5938
|
+
});
|
|
5939
|
+
}, "buildRuntime"),
|
|
5940
|
+
drainRuntime: /* @__PURE__ */ __name(async (runtimeToDrain) => {
|
|
5941
|
+
workspaceRuntimeRemoval.beginDrain(runtimeToDrain);
|
|
5942
|
+
acpHandle()?.beginWorkspaceDrain(runtimeToDrain.workspaceId);
|
|
5943
|
+
}, "drainRuntime"),
|
|
5944
|
+
disposeRuntime: /* @__PURE__ */ __name(async (runtimeToDispose, reason) => {
|
|
5945
|
+
const errors = [];
|
|
5946
|
+
try {
|
|
5947
|
+
await workspaceRuntimeRemoval.disposeRuntime(
|
|
5948
|
+
runtimeToDispose,
|
|
5949
|
+
reason
|
|
5950
|
+
);
|
|
5951
|
+
} catch (error) {
|
|
5952
|
+
errors.push(error);
|
|
5953
|
+
}
|
|
5954
|
+
try {
|
|
5955
|
+
const handle = acpHandle();
|
|
5956
|
+
if (!runtimeToDispose.primary) {
|
|
5957
|
+
handle?.commitWorkspaceRemoval(runtimeToDispose.workspaceId);
|
|
5958
|
+
}
|
|
5959
|
+
handle?.disposeWorkspace(runtimeToDispose.workspaceId);
|
|
5960
|
+
const deadline = Date.now() + 1e3;
|
|
5961
|
+
while ((handle?.getWorkspaceActivity(runtimeToDispose.workspaceId).memoryTasks ?? 0) > 0 && Date.now() < deadline) {
|
|
5962
|
+
await new Promise((resolve) => setTimeout(resolve, 25));
|
|
5963
|
+
}
|
|
5964
|
+
if ((handle?.getWorkspaceActivity(runtimeToDispose.workspaceId).memoryTasks ?? 0) > 0) {
|
|
5965
|
+
throw new Error(
|
|
5966
|
+
"Workspace memory tasks did not stop after runtime disposal."
|
|
5967
|
+
);
|
|
5968
|
+
}
|
|
5969
|
+
} catch (error) {
|
|
5970
|
+
errors.push(error);
|
|
5971
|
+
}
|
|
5972
|
+
if (errors.length === 1) throw errors[0];
|
|
5973
|
+
if (errors.length > 1) {
|
|
5974
|
+
throw new AggregateError(
|
|
5975
|
+
errors,
|
|
5976
|
+
"Workspace runtime and ACP cleanup failed."
|
|
5977
|
+
);
|
|
5978
|
+
}
|
|
5979
|
+
}, "disposeRuntime"),
|
|
5980
|
+
runtimeActivated: /* @__PURE__ */ __name(async (runtimeAdded) => {
|
|
5981
|
+
workspaceRuntimeRemoval.cancelDrain(runtimeAdded);
|
|
5982
|
+
acpHandle()?.cancelWorkspaceDrain(runtimeAdded.workspaceId);
|
|
5983
|
+
if (runtimeAdded.primary) {
|
|
5984
|
+
bridgeRef = runtimeAdded.bridge;
|
|
5985
|
+
invalidatePrimaryServeFeaturesCache();
|
|
5986
|
+
}
|
|
5987
|
+
await workspaceRuntimeRemoval.runtimeAdded(runtimeAdded);
|
|
5988
|
+
}, "runtimeActivated"),
|
|
5989
|
+
onError: /* @__PURE__ */ __name((entry, error) => {
|
|
5990
|
+
daemonLog.error(
|
|
5991
|
+
`workspace trust reconciliation failed for ${entry.workspaceCwd}`,
|
|
5992
|
+
error instanceof Error ? error : null
|
|
5993
|
+
);
|
|
5994
|
+
}, "onError")
|
|
5995
|
+
});
|
|
5996
|
+
const trustMonitor = createDaemonTrustPolicyMonitor({
|
|
5997
|
+
onSnapshot: /* @__PURE__ */ __name((snapshot) => {
|
|
5998
|
+
latestTrustPolicySnapshot = snapshot;
|
|
5999
|
+
return runWorkspaceTrustOperation(
|
|
6000
|
+
() => trustReconciler.reconcile(snapshot)
|
|
6001
|
+
);
|
|
6002
|
+
}, "onSnapshot"),
|
|
6003
|
+
onError: /* @__PURE__ */ __name((error) => {
|
|
6004
|
+
daemonLog.error(
|
|
6005
|
+
"workspace trust policy monitor failed",
|
|
6006
|
+
error instanceof Error ? error : null
|
|
6007
|
+
);
|
|
6008
|
+
}, "onError")
|
|
6009
|
+
});
|
|
6010
|
+
app2.locals.stopTrustPolicyMonitor = () => trustMonitor.stop();
|
|
6011
|
+
app2.locals.requestTrustReconcile = () => trustMonitor.requestReconcile("manual");
|
|
6012
|
+
app2.locals.waitForTrustPolicyIdle = () => runWorkspaceTrustOperation(async () => void 0);
|
|
6013
|
+
await trustMonitor.start();
|
|
6014
|
+
}
|
|
6015
|
+
const activePrimaryBridge = workspaceRegistry.primaryEntry.current?.runtime.bridge;
|
|
6016
|
+
bridgeRef = activePrimaryBridge;
|
|
6017
|
+
return { app: app2, bridge: activePrimaryBridge };
|
|
5403
6018
|
}, "buildRuntime");
|
|
5404
6019
|
if (deps.bridge) {
|
|
5405
6020
|
const runtime = await buildRuntime();
|
|
@@ -5456,46 +6071,89 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5456
6071
|
);
|
|
5457
6072
|
}
|
|
5458
6073
|
const channelValidationSettingsRuntime = opts.channelSelection ? await loadSettingsRuntimeModules() : void 0;
|
|
6074
|
+
const channelValidationTrustPolicy = opts.channelSelection ? await import("./daemon-trust-policy-ILUDTLHD.js") : void 0;
|
|
6075
|
+
const channelValidationTrustSnapshot = channelValidationTrustPolicy ? await channelValidationTrustPolicy.readDaemonTrustPolicySnapshot() : void 0;
|
|
5459
6076
|
const resolveChannelWorkspaceGroupsAtListen = /* @__PURE__ */ __name(() => {
|
|
5460
6077
|
if (!opts.channelSelection || !channelValidationSettingsRuntime || !channelRuntime) {
|
|
5461
6078
|
return void 0;
|
|
5462
6079
|
}
|
|
6080
|
+
const registry = (runtimeApp ?? runtimeAppForCleanup)?.locals?.["workspaceRegistry"];
|
|
6081
|
+
const resolveRuntime = /* @__PURE__ */ __name((workspaceCwd) => {
|
|
6082
|
+
const runtime = registry?.getByWorkspaceCwd(workspaceCwd);
|
|
6083
|
+
if (registry && !runtime) {
|
|
6084
|
+
throw Object.assign(
|
|
6085
|
+
new Error(`Workspace "${workspaceCwd}" is unavailable.`),
|
|
6086
|
+
{ code: "workspace_unavailable" }
|
|
6087
|
+
);
|
|
6088
|
+
}
|
|
6089
|
+
return runtime;
|
|
6090
|
+
}, "resolveRuntime");
|
|
6091
|
+
const resolveTrusted = /* @__PURE__ */ __name((workspaceCwd, primary, runtime) => {
|
|
6092
|
+
if (runtime) return runtime.trusted;
|
|
6093
|
+
if (primary && deps.trustedWorkspace !== void 0) {
|
|
6094
|
+
return deps.trustedWorkspace;
|
|
6095
|
+
}
|
|
6096
|
+
if (!channelValidationTrustPolicy || !channelValidationTrustSnapshot) {
|
|
6097
|
+
return false;
|
|
6098
|
+
}
|
|
6099
|
+
return channelValidationTrustPolicy.evaluateDaemonWorkspaceTrust(
|
|
6100
|
+
channelValidationTrustSnapshot,
|
|
6101
|
+
workspaceCwd
|
|
6102
|
+
).targetTrusted;
|
|
6103
|
+
}, "resolveTrusted");
|
|
5463
6104
|
const settingsByWorkspace = /* @__PURE__ */ new Map();
|
|
5464
6105
|
if (workspaceInputs.length === 1) {
|
|
5465
6106
|
const workspace = workspaceInputs[0];
|
|
5466
|
-
const
|
|
5467
|
-
|
|
5468
|
-
)
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
6107
|
+
const runtime = resolveRuntime(workspace.cwd);
|
|
6108
|
+
const trusted = resolveTrusted(workspace.cwd, true, runtime);
|
|
6109
|
+
if (!trusted) {
|
|
6110
|
+
throw Object.assign(
|
|
6111
|
+
new Error(
|
|
6112
|
+
`Primary workspace "${workspace.cwd}" is not trusted; cannot host channels.`
|
|
6113
|
+
),
|
|
6114
|
+
{ code: "untrusted_workspace" }
|
|
6115
|
+
);
|
|
6116
|
+
}
|
|
6117
|
+
const effectiveEnv = runtime ? workspaceRuntimeEffectiveEnv(runtime, daemonRuntimeBaseEnv) : channelValidationSettingsRuntime.environment.buildRuntimeEnvironment(
|
|
6118
|
+
channelValidationSettingsRuntime.settings.loadSettings(
|
|
5473
6119
|
workspace.cwd,
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
6120
|
+
{
|
|
6121
|
+
skipLoadEnvironment: true,
|
|
6122
|
+
skipWorkspaceSettings: false,
|
|
6123
|
+
workspaceTrusted: true
|
|
6124
|
+
}
|
|
6125
|
+
).merged,
|
|
6126
|
+
workspace.cwd,
|
|
6127
|
+
daemonRuntimeBaseEnv,
|
|
6128
|
+
trusted
|
|
6129
|
+
).effectiveEnv;
|
|
6130
|
+
channelWebhookEnvByWorkspace.set(workspace.cwd, effectiveEnv);
|
|
5477
6131
|
return void 0;
|
|
5478
6132
|
}
|
|
5479
6133
|
const workspaces = workspaceInputs.map((workspace, index) => {
|
|
6134
|
+
const runtime = resolveRuntime(workspace.cwd);
|
|
6135
|
+
const trusted = resolveTrusted(workspace.cwd, index === 0, runtime);
|
|
5480
6136
|
const settings = channelValidationSettingsRuntime.settings.loadSettings(
|
|
5481
|
-
workspace.cwd
|
|
6137
|
+
workspace.cwd,
|
|
6138
|
+
{
|
|
6139
|
+
skipLoadEnvironment: true,
|
|
6140
|
+
skipWorkspaceSettings: !trusted,
|
|
6141
|
+
workspaceTrusted: trusted
|
|
6142
|
+
}
|
|
5482
6143
|
);
|
|
5483
6144
|
settingsByWorkspace.set(workspace.cwd, settings);
|
|
5484
6145
|
channelWebhookEnvByWorkspace.set(
|
|
5485
6146
|
workspace.cwd,
|
|
5486
|
-
channelValidationSettingsRuntime.environment.buildRuntimeEnvironment(
|
|
6147
|
+
runtime ? workspaceRuntimeEffectiveEnv(runtime, daemonRuntimeBaseEnv) : channelValidationSettingsRuntime.environment.buildRuntimeEnvironment(
|
|
5487
6148
|
settings.merged,
|
|
5488
6149
|
workspace.cwd,
|
|
5489
|
-
daemonRuntimeBaseEnv
|
|
6150
|
+
daemonRuntimeBaseEnv,
|
|
6151
|
+
trusted
|
|
5490
6152
|
).effectiveEnv
|
|
5491
6153
|
);
|
|
5492
|
-
const trusted = index === 0 && deps.trustedWorkspace !== void 0 ? deps.trustedWorkspace : channelValidationSettingsRuntime.trustedFolders.getWorkspaceTrustStatus(
|
|
5493
|
-
settings.merged,
|
|
5494
|
-
workspace.cwd
|
|
5495
|
-
).effective.state === "trusted";
|
|
5496
6154
|
return {
|
|
5497
6155
|
workspaceCwd: workspace.cwd,
|
|
5498
|
-
primary: index === 0,
|
|
6156
|
+
primary: runtime?.primary ?? index === 0,
|
|
5499
6157
|
trusted
|
|
5500
6158
|
};
|
|
5501
6159
|
});
|
|
@@ -5715,9 +6373,18 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5715
6373
|
}
|
|
5716
6374
|
const runtimes = registry.list();
|
|
5717
6375
|
if (runtimes.length <= 1 && operation === "initial") {
|
|
6376
|
+
const primary = registry.primary;
|
|
6377
|
+
if (!primary.trusted) {
|
|
6378
|
+
throw Object.assign(
|
|
6379
|
+
new Error(
|
|
6380
|
+
`Primary workspace "${primary.workspaceCwd}" is not trusted; cannot host channels.`
|
|
6381
|
+
),
|
|
6382
|
+
{ code: "untrusted_workspace" }
|
|
6383
|
+
);
|
|
6384
|
+
}
|
|
5718
6385
|
return [
|
|
5719
6386
|
{
|
|
5720
|
-
workspaceCwd:
|
|
6387
|
+
workspaceCwd: primary.workspaceCwd,
|
|
5721
6388
|
selection: channelSelection
|
|
5722
6389
|
}
|
|
5723
6390
|
];
|
|
@@ -5728,7 +6395,12 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5728
6395
|
const grouping = resolveChannelWorkspaceGroups({
|
|
5729
6396
|
workspaces: runtimes.map((runtime) => {
|
|
5730
6397
|
const settings = settingsRuntime.settings.loadSettings(
|
|
5731
|
-
runtime.workspaceCwd
|
|
6398
|
+
runtime.workspaceCwd,
|
|
6399
|
+
{
|
|
6400
|
+
skipLoadEnvironment: true,
|
|
6401
|
+
skipWorkspaceSettings: !runtime.trusted,
|
|
6402
|
+
workspaceTrusted: runtime.trusted
|
|
6403
|
+
}
|
|
5732
6404
|
);
|
|
5733
6405
|
settingsByWorkspace.set(runtime.workspaceCwd, settings);
|
|
5734
6406
|
return {
|
|
@@ -5899,7 +6571,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5899
6571
|
);
|
|
5900
6572
|
return;
|
|
5901
6573
|
}
|
|
5902
|
-
if (shouldPreheat) {
|
|
6574
|
+
if (shouldPreheat && runtime.bridge) {
|
|
5903
6575
|
startBridgePreheat(runtime.bridge);
|
|
5904
6576
|
}
|
|
5905
6577
|
await completeRuntimeStartup(runtime.app);
|
|
@@ -5941,6 +6613,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5941
6613
|
if (shuttingDown) {
|
|
5942
6614
|
daemonLog.warn(`received ${signal} during drain \u2014 forcing exit`);
|
|
5943
6615
|
try {
|
|
6616
|
+
managedProcessRegistry?.killAllSync();
|
|
5944
6617
|
channelWorkerManager?.killAllSync();
|
|
5945
6618
|
for (const runtimeBridge of getRuntimeBridgesForCleanup()) {
|
|
5946
6619
|
runtimeBridge.killAllSync();
|
|
@@ -5968,7 +6641,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5968
6641
|
process.exit(runtimeStartupError === void 0 ? 0 : 1);
|
|
5969
6642
|
} catch (err) {
|
|
5970
6643
|
daemonLog.error("shutdown error", err instanceof Error ? err : null);
|
|
5971
|
-
if (
|
|
6644
|
+
if (err instanceof Error && retryableChannelWorkerShutdownErrors.has(err)) {
|
|
5972
6645
|
daemonLog.error(
|
|
5973
6646
|
"refusing to exit while a channel worker or service lease remains; signal again to retry after the child exits (another signal during that retry forces exit)"
|
|
5974
6647
|
);
|
|
@@ -6001,6 +6674,14 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
6001
6674
|
const initiallyMountedApp = runtimeApp ?? runtimeAppForCleanup;
|
|
6002
6675
|
const initiallyMountedManagement = initiallyMountedApp?.locals?.["workspaceManagementHandle"];
|
|
6003
6676
|
const initialManagementWait = initiallyMountedManagement?.sealAndWait?.();
|
|
6677
|
+
let processRegistryShutdown;
|
|
6678
|
+
const startProcessRegistryShutdown = /* @__PURE__ */ __name(() => {
|
|
6679
|
+
processRegistryShutdown ??= managedProcessRegistry?.shutdown().then(
|
|
6680
|
+
() => void 0,
|
|
6681
|
+
(error2) => error2 instanceof Error ? error2 : new Error(String(error2))
|
|
6682
|
+
);
|
|
6683
|
+
}, "startProcessRegistryShutdown");
|
|
6684
|
+
startProcessRegistryShutdown();
|
|
6004
6685
|
clearRuntimeStartAfterHealthTimer();
|
|
6005
6686
|
clearRuntimeStartFallbackTimer();
|
|
6006
6687
|
cancelDeferredRuntimeStartup();
|
|
@@ -6029,6 +6710,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
6029
6710
|
const finalErr = err ?? bridgeShutdownError ?? channelWorkerShutdownError;
|
|
6030
6711
|
const retryableChannelClose = channelWorkerShutdownError !== void 0 && channelWorkerManager?.state().enabled === true;
|
|
6031
6712
|
if (retryableChannelClose) {
|
|
6713
|
+
const retryableError = channelWorkerShutdownError;
|
|
6032
6714
|
await flushDaemonLogBounded(
|
|
6033
6715
|
daemonLog,
|
|
6034
6716
|
DAEMON_LOG_FORCED_FLUSH_BUDGET_MS
|
|
@@ -6036,13 +6718,18 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
6036
6718
|
closePromise = void 0;
|
|
6037
6719
|
shuttingDown = false;
|
|
6038
6720
|
channelControlDraining = false;
|
|
6039
|
-
|
|
6721
|
+
retryableChannelWorkerShutdownErrors.add(retryableError);
|
|
6722
|
+
rej(retryableError);
|
|
6040
6723
|
return;
|
|
6041
6724
|
}
|
|
6042
6725
|
if (loggerPublished || loggerSignalOwned) {
|
|
6043
|
-
writeDaemonLifecycleBestEffort(
|
|
6044
|
-
()
|
|
6045
|
-
|
|
6726
|
+
writeDaemonLifecycleBestEffort(() => {
|
|
6727
|
+
if (finalErr) {
|
|
6728
|
+
daemonLog.error("daemon shutdown incomplete", finalErr);
|
|
6729
|
+
} else {
|
|
6730
|
+
daemonLog.info("daemon stopped");
|
|
6731
|
+
}
|
|
6732
|
+
});
|
|
6046
6733
|
await daemonLog.close();
|
|
6047
6734
|
}
|
|
6048
6735
|
if (finalErr) rej(finalErr);
|
|
@@ -6065,6 +6752,15 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
6065
6752
|
if (workspaceManagementHandle !== initiallyMountedManagement) {
|
|
6066
6753
|
await workspaceManagementHandle?.sealAndWait?.();
|
|
6067
6754
|
}
|
|
6755
|
+
stopTrustPolicyMonitor(appForCleanup);
|
|
6756
|
+
const waitForTrustPolicyIdle = appForCleanup?.locals?.["waitForTrustPolicyIdle"];
|
|
6757
|
+
await waitForTrustPolicyIdle?.().catch((err) => {
|
|
6758
|
+
daemonLog.error(
|
|
6759
|
+
"workspace trust reconciliation shutdown wait failed",
|
|
6760
|
+
err instanceof Error ? err : null
|
|
6761
|
+
);
|
|
6762
|
+
});
|
|
6763
|
+
startProcessRegistryShutdown();
|
|
6068
6764
|
disposeRuntimeAppResources(appForCleanup);
|
|
6069
6765
|
disposeDaemonEventLoopMonitor();
|
|
6070
6766
|
if (channelWorkerManager) {
|
|
@@ -6115,6 +6811,14 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
6115
6811
|
bridgeShutdownError = err instanceof Error ? err : new Error(String(err));
|
|
6116
6812
|
});
|
|
6117
6813
|
}
|
|
6814
|
+
const processRegistryError = await processRegistryShutdown;
|
|
6815
|
+
if (processRegistryError) {
|
|
6816
|
+
daemonLog.error(
|
|
6817
|
+
"ACP process registry shutdown error",
|
|
6818
|
+
processRegistryError
|
|
6819
|
+
);
|
|
6820
|
+
bridgeShutdownError ??= processRegistryError;
|
|
6821
|
+
}
|
|
6118
6822
|
}).finally(() => {
|
|
6119
6823
|
if (!server.listening) {
|
|
6120
6824
|
void (runtimeFailureListenerClose ?? Promise.resolve()).then(
|
|
@@ -6197,7 +6901,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
6197
6901
|
closeErr instanceof Error ? closeErr : null
|
|
6198
6902
|
)
|
|
6199
6903
|
);
|
|
6200
|
-
if (
|
|
6904
|
+
if (closeErr instanceof Error && retryableChannelWorkerShutdownErrors.has(closeErr)) {
|
|
6201
6905
|
writeDaemonLifecycleBestEffort(
|
|
6202
6906
|
() => daemonLog.error(
|
|
6203
6907
|
"runtime startup failed, but qwen serve remains alive to retain the channel service lease until worker exit is confirmed"
|