@qwen-code/qwen-code 0.21.1-simplify-system-prompt.0 → 0.21.2
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 +39 -28
- package/bundled/qc-helper/docs/features/channels/_meta.ts +2 -0
- package/bundled/qc-helper/docs/features/channels/github.md +139 -0
- package/bundled/qc-helper/docs/features/channels/gitlab.md +171 -0
- package/bundled/qc-helper/docs/features/channels/overview.md +61 -6
- package/bundled/qc-helper/docs/features/code-review.md +21 -1
- package/bundled/qc-helper/docs/features/hooks.md +72 -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 +42 -8
- package/bundled/qc-helper/docs/qwen-serve.md +11 -7
- 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-TQBQ247P.js +88 -0
- package/chunks/{StandaloneSessionPicker-O6RKBPU4.js → StandaloneSessionPicker-2HPTKCLX.js} +71 -69
- package/chunks/{acp-startup-profiler-RV3IV562.js → acp-startup-profiler-2C4A5ZTJ.js} +2 -2
- package/chunks/{acpAgent-HYFVXVDR.js → acpAgent-PS6EDGH3.js} +1628 -590
- package/chunks/agent-VDOUB35F.js +84 -0
- package/chunks/agent-headless-EO53EFS2.js +78 -0
- package/chunks/{anthropicContentGenerator-LXUXMOE7.js → anthropicContentGenerator-OFHSZJBF.js} +61 -20
- package/chunks/{artifact-tool-Y5T7GG7F.js → artifact-tool-RDN2W7ND.js} +4 -4
- package/chunks/{askUserQuestion-2H6747FR.js → askUserQuestion-OZERWH5R.js} +4 -4
- package/chunks/bridge-W7AZSRZQ.js +94 -0
- package/chunks/{build-RV63TIRH.js → build-GDBLPA24.js} +1 -1
- package/chunks/{ca-25EDXPFZ.js → ca-6W3SK7OQ.js} +6 -1
- package/chunks/{channel-management-service-G74LFADV.js → channel-management-service-5S7YCWX5.js} +20 -5
- package/chunks/channel-settings-store-JFVRSNER.js +91 -0
- package/chunks/{channel-worker-group-PTJIJSKC.js → channel-worker-group-OVWGYMZS.js} +9 -5
- package/chunks/{channel-worker-manager-WIMGM2FD.js → channel-worker-manager-H55GKOQA.js} +9 -5
- package/chunks/{channel-worker-supervisor-KUFTR6P5.js → channel-worker-supervisor-CABBXYHK.js} +5 -4
- package/chunks/{chunk-6GMVPFB2.js → chunk-2IIJTXYF.js} +45 -16
- package/chunks/{chunk-BPJSQIJX.js → chunk-2J3OJGTL.js} +0 -2
- package/chunks/{chunk-I7XZ3RY5.js → chunk-2KKCCLPT.js} +1 -1
- package/chunks/{chunk-MSLKI6C2.js → chunk-2LEOZTBT.js} +49 -26
- package/chunks/{chunk-3QMGYBFN.js → chunk-3APUUXRF.js} +1 -80
- package/chunks/{chunk-VV6XU5L7.js → chunk-3F2WDAV6.js} +16 -11
- package/chunks/{chunk-MUP3T3AD.js → chunk-3I6DUGQD.js} +1 -35
- package/chunks/{chunk-66RMLJHC.js → chunk-44F4LBWZ.js} +577 -208
- package/chunks/{chunk-VAK25FTU.js → chunk-45IOTAUS.js} +1 -1
- package/chunks/{chunk-JZA3JUDJ.js → chunk-4KP2F2TE.js} +1 -1
- package/chunks/{chunk-DM4Q4JJH.js → chunk-54YCNSK5.js} +36562 -45062
- package/chunks/{chunk-2Q3OT4OV.js → chunk-56Z7QEAQ.js} +200 -77
- package/chunks/{chunk-ZOIFNCKL.js → chunk-5NNHICSA.js} +3 -23
- package/chunks/{chunk-A4UCTEB5.js → chunk-5WV5S2GT.js} +0 -1
- package/chunks/{chunk-RHLZR4E5.js → chunk-675H6PLP.js} +1 -1
- package/chunks/{chunk-YAF5VNU7.js → chunk-6CQWRWUC.js} +4 -5
- package/chunks/chunk-6FMJLI5M.js +1591 -0
- package/chunks/{chunk-HV3G62R6.js → chunk-6MPDY6ZG.js} +1 -1
- package/chunks/{chunk-32MVHM4T.js → chunk-6PQPKTXP.js} +1 -1
- package/chunks/{chunk-LG4GZIVV.js → chunk-6TAASXWL.js} +4 -4
- package/chunks/{chunk-OJGCZBB7.js → chunk-77V3VIKL.js} +41 -36
- package/chunks/{chunk-2OM7GEXO.js → chunk-7KAXXBER.js} +3 -3
- package/chunks/{chunk-2JM6GZ5D.js → chunk-7SJN2IWT.js} +8 -13
- package/chunks/{chunk-UUUTRMI2.js → chunk-7ULQIS27.js} +1 -1
- package/chunks/{chunk-2YZJCM5T.js → chunk-A7Y5H4TX.js} +4 -4
- package/chunks/{chunk-TOFQCPDC.js → chunk-AOHY3QJ3.js} +14 -8
- package/chunks/chunk-AQ37AY7B.js +93 -0
- package/chunks/{chunk-B6ZJ7SI6.js → chunk-AUOULH6Q.js} +383 -320
- package/chunks/{chunk-PJIZUQVC.js → chunk-AZQ3DT76.js} +2 -2
- package/chunks/{chunk-UH3WSE5L.js → chunk-B4AJNNOL.js} +1 -6
- package/chunks/{chunk-7FZEBPKS.js → chunk-BBIQAX4V.js} +23 -18
- package/chunks/{chunk-L26JL52R.js → chunk-CBBP4BMC.js} +64 -67
- package/chunks/{chunk-ZD6UTE4A.js → chunk-CNTR4GR6.js} +1 -1
- package/chunks/{chunk-4M377AZG.js → chunk-CO2U743O.js} +6 -6
- package/chunks/{chunk-3SJ43L4W.js → chunk-CPZAH673.js} +6 -0
- package/chunks/{chunk-VFSJ5VRH.js → chunk-CU47KXB5.js} +3 -3
- package/chunks/{chunk-EPDRMGT4.js → chunk-D4HTUMGX.js} +4 -28
- package/chunks/{chunk-XHRTVPG2.js → chunk-D6MDRSZ6.js} +7 -7
- package/chunks/{chunk-BYFNTGKI.js → chunk-DEEABGH2.js} +3111 -989
- package/chunks/{chunk-XVNQMZ2I.js → chunk-DGEIYUC3.js} +0 -1
- package/chunks/{chunk-BPZALHVR.js → chunk-DI35ZN7T.js} +1 -1
- package/chunks/{chunk-B4UMZKMU.js → chunk-DQ2O5QOJ.js} +1 -1
- package/chunks/{chunk-DLWL3Z7A.js → chunk-DSFHVTWD.js} +3 -3
- package/chunks/{chunk-RWS5VYWC.js → chunk-DUNI4EBW.js} +950 -446
- package/chunks/{chunk-NL7LTRLR.js → chunk-E2BHWIDT.js} +48 -72
- package/chunks/{chunk-3MSHSCSN.js → chunk-E2FN6SM7.js} +93 -3
- package/chunks/{chunk-USTWD7QV.js → chunk-E6CJ2SMM.js} +26 -16
- package/chunks/{chunk-TF2X2WCT.js → chunk-EQNUDTL6.js} +2 -2
- package/chunks/{chunk-PANH4R3B.js → chunk-EU5TBFJI.js} +18 -12
- package/chunks/{chunk-W4CQXHT6.js → chunk-FANRZEAJ.js} +1 -1
- package/chunks/{chunk-WBL3FJEU.js → chunk-FC4KQFCS.js} +1 -1
- package/chunks/{chunk-N3FAY5CM.js → chunk-FCYYAB4S.js} +157 -4
- package/chunks/{chunk-OKY7HXPG.js → chunk-FJ5WUMUQ.js} +2 -2
- package/chunks/{chunk-M4UKFCZ2.js → chunk-FNDXMN7I.js} +231 -171
- package/chunks/{chunk-FQK6JAFG.js → chunk-FS674JW4.js} +4 -4
- package/chunks/chunk-FYJ7W2PI.js +194 -0
- package/chunks/{chunk-INADJJGW.js → chunk-G7XXKQYS.js} +2 -2
- package/chunks/{chunk-LNARWLZQ.js → chunk-GJ2GBPBD.js} +2 -2
- package/chunks/{chunk-E5WH5O3C.js → chunk-GL4JOZXU.js} +4 -4
- package/chunks/{chunk-LS77BEZP.js → chunk-GLCZKT5V.js} +1 -5
- package/chunks/{chunk-KU5XMLDK.js → chunk-GURGAJTX.js} +4 -1
- package/chunks/{chunk-5THCYPLO.js → chunk-H6I4PGRV.js} +15 -8
- package/chunks/{chunk-A5L3JMUA.js → chunk-HC45LTEN.js} +18 -4
- package/chunks/{chunk-U7TXFVUN.js → chunk-HIVKI6O6.js} +118 -95
- package/chunks/{chunk-QY5MMZ6O.js → chunk-HX6RLYUO.js} +3 -3
- package/chunks/{chunk-GZXCZHCT.js → chunk-I3G5JWBV.js} +1 -1
- package/chunks/{chunk-ER5LWJR6.js → chunk-I5BT7ADR.js} +3 -3
- package/chunks/{chunk-L5UHQJTJ.js → chunk-IGTHU3T4.js} +1 -1
- package/chunks/{chunk-BIQWWWJN.js → chunk-IIUGIWWY.js} +1 -1
- package/chunks/{chunk-ML52PL6O.js → chunk-JCJ7LKNA.js} +5856 -5334
- package/chunks/{chunk-B7QDM6Z7.js → chunk-JE2CEOBO.js} +2 -2
- package/chunks/{chunk-S3TWXGKA.js → chunk-JE7KQ2UP.js} +4 -2
- package/chunks/{chunk-P5V4T7NK.js → chunk-JJPKFJBT.js} +11 -3
- package/chunks/{chunk-J6D3VXCC.js → chunk-JLZ3RBQG.js} +18 -5
- package/chunks/{chunk-PWTZEM3C.js → chunk-JXVC2PL3.js} +3 -37
- package/chunks/chunk-JYBU6YUE.js +378 -0
- package/chunks/{chunk-JCW2R7WC.js → chunk-K623ENWT.js} +3 -79
- package/chunks/{chunk-T2NCM2ET.js → chunk-K6KS3LTN.js} +2 -749
- package/chunks/{chunk-Z5BLYMZM.js → chunk-KR32NIAN.js} +6 -6
- package/chunks/{chunk-MK7VQDN3.js → chunk-KWHKHSIS.js} +8 -6
- package/chunks/{chunk-5U4IPFBR.js → chunk-KXDONCPU.js} +4 -4
- package/chunks/{chunk-DHHOYAPR.js → chunk-L2E5GFAG.js} +7 -7
- package/chunks/{chunk-V6VRAM7B.js → chunk-L32VV3ZJ.js} +12 -12
- package/chunks/{chunk-2W3OOD4W.js → chunk-L55JWS76.js} +6 -3
- package/chunks/{chunk-E5TUC6CA.js → chunk-LHKCY7DY.js} +3 -3
- package/chunks/{chunk-NH6KE4JX.js → chunk-LOY7RWQG.js} +3 -3
- package/chunks/{chunk-CC4N4M36.js → chunk-LYI2PZDK.js} +1 -1
- package/chunks/{chunk-3JAQDSXN.js → chunk-MB32MS4U.js} +80 -9
- package/chunks/{chunk-PR75REBZ.js → chunk-MM7TH7ZM.js} +12 -82
- package/chunks/{chunk-FODK6UMO.js → chunk-MPHPFVKK.js} +0 -2
- package/chunks/{chunk-M5JM7OSF.js → chunk-N4ACHWNH.js} +2 -3
- package/chunks/{chunk-JESCGQM3.js → chunk-NAVJD2PQ.js} +8 -7
- package/chunks/{chunk-J56UI34H.js → chunk-NBD76HUW.js} +4 -2
- package/chunks/{chunk-C3NS4F2Q.js → chunk-NHFEMWAZ.js} +1 -1
- package/chunks/{chunk-6PSLCFQ2.js → chunk-NTDH4IML.js} +18 -9
- package/chunks/{chunk-6OUGMXDC.js → chunk-NWNEANAT.js} +7 -7
- package/chunks/chunk-O6GEWCJA.js +21 -0
- package/chunks/chunk-OCPBI7J5.js +18 -0
- package/chunks/{chunk-ZE5WPL4I.js → chunk-OFZKFPYG.js} +3 -3
- package/chunks/{chunk-KIUFNBHR.js → chunk-P5VC5USY.js} +1 -1
- package/chunks/chunk-P755N4CS.js +2196 -0
- package/chunks/{chunk-BRRAJXPA.js → chunk-PCK4B6LR.js} +1 -1
- package/chunks/{chunk-TQCBGUHN.js → chunk-PJOHNFIY.js} +5 -5
- package/chunks/{chunk-G4WFQUYQ.js → chunk-PVNQRENX.js} +1 -1
- package/chunks/{chunk-DM22XS4K.js → chunk-PZEXDV3H.js} +357 -13
- package/chunks/{chunk-2JZBVYTU.js → chunk-Q3T5KA2V.js} +1 -8
- package/chunks/{chunk-SASBXAQL.js → chunk-Q5WZTTWE.js} +4 -4
- package/chunks/{chunk-SRZ6DXVG.js → chunk-QARJNL2V.js} +44 -136
- package/chunks/{chunk-YH6G52F2.js → chunk-QCXGC7QB.js} +4 -4
- package/chunks/{chunk-SQBYH7PX.js → chunk-QDK4F2N5.js} +1 -1
- package/chunks/{chunk-VDDGDZMA.js → chunk-QHWCP53L.js} +14 -7
- package/chunks/{chunk-H5FFA6TH.js → chunk-QTHQ6Z5X.js} +16 -3
- package/chunks/{chunk-5I2IWRSH.js → chunk-R2XWGR75.js} +2 -2
- package/chunks/{chunk-PHVR5UUY.js → chunk-RDJOB6S3.js} +1 -1
- package/chunks/{chunk-GDIPH4JY.js → chunk-RG64CDT2.js} +6 -6
- package/chunks/{chunk-3HBZKBMQ.js → chunk-RSVPYAGK.js} +5 -5
- package/chunks/{chunk-6AM5D4ME.js → chunk-S6LOFUVP.js} +0 -12
- package/chunks/{chunk-K4XWPEWB.js → chunk-SHN4KHDK.js} +4 -33
- package/chunks/{chunk-VYPFXUCB.js → chunk-SZ3KHTDR.js} +1 -1
- package/chunks/chunk-T26EAKDL.js +13 -0
- package/chunks/chunk-T3CHYWJZ.js +758 -0
- package/chunks/{chunk-FNQ6T3CV.js → chunk-TEGJSJDF.js} +10 -7
- package/chunks/{chunk-OHNBB4XR.js → chunk-THVU3RNH.js} +1 -1
- package/chunks/{record-artifact-RQKFYO5B.js → chunk-TIRRPCFS.js} +22 -7
- package/chunks/chunk-TTJZAIFP.js +319 -0
- package/chunks/{chunk-63P4EL5V.js → chunk-TZTAV5RH.js} +1 -1
- package/chunks/{chunk-52O2CIUL.js → chunk-UV6KF7T3.js} +130 -5
- package/chunks/{chunk-QPDRAXDJ.js → chunk-V25K5ID7.js} +1 -1
- package/chunks/{chunk-3IXOIAKE.js → chunk-V4XNUDPE.js} +18 -6
- package/chunks/{chunk-WDSWXQU3.js → chunk-VEMNQMHA.js} +2 -2
- package/chunks/{chunk-LNURQEMZ.js → chunk-VMX5RZQH.js} +12 -10
- package/chunks/{chunk-JALU3ZDU.js → chunk-W3UKBMSI.js} +154 -16
- package/chunks/{chunk-DN6ZX5AY.js → chunk-WWCMSZII.js} +61 -14
- package/chunks/{chunk-COH43MRJ.js → chunk-XCGIMOLN.js} +27 -1
- package/chunks/{chunk-FY3M44RD.js → chunk-XP4L6KS3.js} +3 -3
- package/chunks/{chunk-6FGBXPWM.js → chunk-XQK4XXTN.js} +38 -44
- package/chunks/{chunk-A6UO2C7C.js → chunk-XUGZYLDH.js} +167 -81
- package/chunks/{chunk-LZEMEFKY.js → chunk-YANIWTRZ.js} +1 -1
- package/chunks/{chunk-IPUUTYMV.js → chunk-YDLJGZHL.js} +1 -1
- package/chunks/{chunk-HIJQF5B5.js → chunk-YGE3IXJP.js} +1 -1
- package/chunks/{chunk-BJX6ZSUK.js → chunk-YUFIEIWC.js} +2 -2
- package/chunks/{chunk-BO4XCS7P.js → chunk-Z3S5EMOW.js} +20 -85
- package/chunks/chunk-Z4X5MTRT.js +133 -0
- package/chunks/{chunk-UW5EOVUN.js → chunk-ZBVS26BY.js} +4 -4
- package/chunks/{chunk-PSWQZHEA.js → chunk-ZMOJ7ISP.js} +1 -1
- package/chunks/{chunk-HTO4JFDZ.js → chunk-ZPJWUGCS.js} +0 -1
- package/chunks/{chunk-MVS3NS2N.js → chunk-ZPZ7ZJEE.js} +28 -5
- package/chunks/{computer-use-DOFAHZAB.js → computer-use-5QWCFNKD.js} +52 -50
- package/chunks/{config-utils-VFQXVGNR.js → config-utils-WADIDWGG.js} +4 -4
- package/chunks/contextCommand-4Z7T7TUM.js +83 -0
- package/chunks/core-runtime-6N4EFC2Q.js +137 -0
- package/chunks/{create-sub-session-IWW2IZ2T.js → create-sub-session-62YZWVAY.js} +3 -3
- package/chunks/{create-sub-session-7543K2QA.js → create-sub-session-AEREHZBQ.js} +49 -47
- package/chunks/{cron-create-YIID5XAW.js → cron-create-6E7GIQTG.js} +6 -6
- package/chunks/{cron-delete-ZVHYCEP2.js → cron-delete-JD26XY3W.js} +5 -5
- package/chunks/{cron-list-XEGS463Q.js → cron-list-CUWFB44G.js} +6 -6
- package/chunks/{daemon-VOMQW7KZ.js → daemon-PCNCI5YU.js} +239 -18
- package/chunks/daemon-status-provider-DDF7C5M7.js +93 -0
- package/chunks/daemon-trust-policy-Q4KSOJTR.js +88 -0
- package/chunks/daemon-trust-policy-monitor-V6FTE3IY.js +175 -0
- package/chunks/{de-HGRCYDEJ.js → de-SY6O76BF.js} +6 -1
- package/chunks/deferred-core-runtime-GHJ5GQHK.js +92 -0
- package/chunks/dist-26BIMQT6.js +4487 -0
- package/chunks/{dist-KTYYJ2C5.js → dist-2PERFI23.js} +12 -9
- package/chunks/{dist-NNVBBOGU.js → dist-OAOC5OV4.js} +2 -2
- package/chunks/{dist-K6Y4E7FX.js → dist-PVEAFLHY.js} +5 -4
- package/chunks/{dist-RTJFMNEZ.js → dist-SL2LUMML.js} +1449 -14
- package/chunks/dist-ULIG4M5H.js +13415 -0
- package/chunks/{dist-ANLAT3GS.js → dist-WGMNT3JQ.js} +2 -1
- package/chunks/{dist-BRB6EXK4.js → dist-ZHXOBXDN.js} +3 -3
- package/chunks/earlyInputCapture-TQXLLISD.js +85 -0
- package/chunks/{edit-RIEOJWKB.js → edit-FJEUV6KZ.js} +51 -49
- package/chunks/{en-MTWBNGDO.js → en-NBK3JKCE.js} +9 -1
- package/chunks/{enter-worktree-OGK5FQ3R.js → enter-worktree-7GE3TZ4P.js} +51 -49
- package/chunks/{enterPlanMode-IWZYALIB.js → enterPlanMode-KR5TMPCJ.js} +51 -49
- package/chunks/environment-SWL3CMB3.js +105 -0
- package/chunks/errors-XQE7BGZV.js +91 -0
- package/chunks/esm-K5FARBNI.js +5548 -0
- package/chunks/{exit-worktree-4TEYVIVP.js → exit-worktree-CHKTYNCV.js} +51 -49
- package/chunks/exitPlanMode-QYAG6LWX.js +76 -0
- package/chunks/{fast-path-HYE7IFEV.js → fast-path-Z2K7W6DC.js} +13 -3
- package/chunks/{fr-45RLL55O.js → fr-4KG5V7UT.js} +6 -1
- package/chunks/{gemini-NGRQX3YJ.js → gemini-YU4XKEDG.js} +107 -103
- package/chunks/{geminiContentGenerator-FQHPFZSR.js → geminiContentGenerator-ZZX6NBO4.js} +7 -7
- 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-FRTM3X2E.js → glob-VYF5CXSX.js} +51 -49
- package/chunks/goal-tools-HGO6VXPB.js +335 -0
- package/chunks/{grep-RKWVROCW.js → grep-5DP5ZUTW.js} +53 -50
- package/chunks/handleAutoUpdate-UVBJ56DL.js +84 -0
- package/chunks/i18n-UQNYHEUD.js +100 -0
- package/chunks/{image-gen-WIEM7KZA.js → image-gen-WHPIZNWF.js} +12 -12
- package/chunks/initializer-GMIICF4W.js +89 -0
- package/chunks/installationInfo-4MGG4WVI.js +83 -0
- package/chunks/{ja-B7DF7DFG.js → ja-F3GSQXMF.js} +6 -1
- package/chunks/{keychain-token-storage-MDTG3WRM.js → keychain-token-storage-IKO4G53C.js} +3 -3
- package/chunks/lib-RUF3WZA6.js +9 -0
- package/chunks/list-CPN2W334.js +92 -0
- package/chunks/{list-agents-5KJJHR6I.js → list-agents-PXJ7ZUFB.js} +3 -3
- package/chunks/loadedSettingsAdapter-ZQAV5NDO.js +86 -0
- package/chunks/{loggingContentGenerator-WGM27QAW.js → loggingContentGenerator-5E7W4IEP.js} +31 -30
- package/chunks/{loop-wakeup-FXKNNYSY.js → loop-wakeup-Y26NQZ5I.js} +15 -8
- package/chunks/{ls-NTK6VOQJ.js → ls-ONQTTMQR.js} +5 -5
- package/chunks/{lsp-2JI24STP.js → lsp-YGHHRGMD.js} +3 -3
- package/chunks/{managed-npm-update-JQ2CG3RH.js → managed-npm-update-MKKAXYXA.js} +50 -48
- package/chunks/mcp-V5NTJF6X.js +86 -0
- package/chunks/{monitor-7FEWXX5F.js → monitor-CO3ASY6E.js} +51 -49
- package/chunks/nonInteractiveCli-ZJYEOO7U.js +148 -0
- package/chunks/{notebook-edit-JGJV2K6J.js → notebook-edit-Z7AEE6FM.js} +51 -49
- package/chunks/{openaiContentGenerator-JPVXDTAO.js → openaiContentGenerator-CA3MQOP3.js} +25 -27
- package/chunks/pidfile-NL7MKDRU.js +89 -0
- package/chunks/process-registry-2CHQBXH5.js +157 -0
- package/chunks/{processUtils-V2LCK6T6.js → processUtils-PB5K2DYH.js} +2 -2
- package/chunks/{pt-22Q3FP73.js → pt-EQ33KWEN.js} +6 -1
- package/chunks/{qwenContentGenerator-TICV2W2Z.js → qwenContentGenerator-JYFNDCOS.js} +55 -53
- package/chunks/{qwenOAuth2-XGFI5XJG.js → qwenOAuth2-W2ALKQDD.js} +10 -10
- package/chunks/read-file-IEOR5H5W.js +29 -0
- package/chunks/{read-mcp-resource-4DKQWGHD.js → read-mcp-resource-U2IJN5HM.js} +4 -4
- package/chunks/record-artifact-MGPJ7EG4.js +21 -0
- package/chunks/resumeHistoryUtils-BNBTP5AS.js +94 -0
- package/chunks/ripGrep-UMQODKEB.js +76 -0
- package/chunks/{ru-FZCNZHDC.js → ru-7OZAUKGG.js} +6 -1
- package/chunks/{run-qwen-serve-3VCV4I7E.js → run-qwen-serve-RN2R6QQW.js} +982 -263
- package/chunks/runtime-QFJ2MJF5.js +122 -0
- package/chunks/{scheduler-RS2I6RU5.js → scheduler-AMYUFOZI.js} +49 -47
- package/chunks/{sdk-exporters-grpc-AK3LGHNO.js → sdk-exporters-grpc-54L4LS5L.js} +4 -4
- package/chunks/{sdk-exporters-http-FS6ZV7MF.js → sdk-exporters-http-4BQANSJ6.js} +7 -7
- package/chunks/{sdk-impl-7FZSCSXB.js → sdk-impl-Z4VXWVFX.js} +10 -10
- package/chunks/{send-message-Q6OOR6BR.js → send-message-PMP4ATVM.js} +8 -13
- package/chunks/serve-EIIYJVX3.js +92 -0
- package/chunks/{server-HRZ23U7M.js → server-EP2LLAPD.js} +4816 -1298
- package/chunks/{session-7XHZKTVV.js → session-GMPZBLOW.js} +101 -97
- package/chunks/{settings-7ZGZDXAS.js → settings-LN7RNKBS.js} +53 -51
- package/chunks/shell-EM2OWU5X.js +86 -0
- package/chunks/{skill-LIWXNLDW.js → skill-T5VPSK73.js} +22 -23
- package/chunks/skill-settings-GMR3GMNY.js +94 -0
- package/chunks/spawnChannel-YPCU62DI.js +85 -0
- package/chunks/standalone-update-JAKIM2NF.js +95 -0
- package/chunks/{startInteractiveUI-IW3CSKHA.js → startInteractiveUI-YETQWGYF.js} +1240 -903
- package/chunks/{syntheticOutput-I3757IWH.js → syntheticOutput-D7E6ZFKR.js} +4 -4
- package/chunks/task-create-NFCYD43L.js +26 -0
- package/chunks/{task-list-FOPULZEP.js → task-list-TAVMGEVD.js} +7 -7
- package/chunks/{task-stop-H6RHXFVQ.js → task-stop-ZDF2UJRM.js} +3 -3
- package/chunks/{task-update-M57TFZJT.js → task-update-6L7LHGEX.js} +12 -11
- package/chunks/{team-create-O2FROQ4R.js → team-create-LFJ6HGNY.js} +53 -51
- package/chunks/{team-delete-QE2UXJL7.js → team-delete-DPGGRQBU.js} +7 -7
- package/chunks/{team-plan-approval-Q6WDBXTQ.js → team-plan-approval-C2KLSDGO.js} +51 -49
- package/chunks/theme-manager-JQ3ZGBP5.js +80 -0
- package/chunks/{todoWrite-VQ7FKOHL.js → todoWrite-2UO5G6G6.js} +34 -6
- package/chunks/{tool-search-APECNQ3Z.js → tool-search-FAZBFRJZ.js} +21 -22
- package/chunks/total-session-admission-5CALIVYO.js +88 -0
- package/chunks/{tree-sitter-FS4VPMZA.js → tree-sitter-4D7QS7F6.js} +1 -1
- package/chunks/{tree-sitter-bash-6B46JJCV.js → tree-sitter-bash-VEJGF5XF.js} +1 -1
- package/chunks/trustedFolders-KOPSP44S.js +98 -0
- package/chunks/{update-relaunch-ON5MDJQG.js → update-relaunch-6QL2TICS.js} +5 -5
- package/chunks/updateCheck-4Q6RIKFW.js +95 -0
- package/chunks/useAutoAcceptIndicator-Q5BMKZV3.js +96 -0
- package/chunks/{validateNonInterActiveAuth-JBLKBKRD.js → validateNonInterActiveAuth-GKOC5F6Z.js} +95 -91
- package/chunks/{version-LTNUBQJY.js → version-VSATY2LD.js} +1 -1
- package/chunks/{web-fetch-L5UTI53V.js → web-fetch-JCLKL6NL.js} +19 -21
- package/chunks/{web-search-KM33JOS3.js → web-search-DSQTFUBX.js} +13 -13
- package/chunks/{workflow-K7FAWV77.js → workflow-M6QAVKVJ.js} +52 -50
- package/chunks/workspace-providers-status-YKLTLMJA.js +89 -0
- package/chunks/{workspace-registration-store-6TGVDJV5.js → workspace-registration-store-5DMGKU64.js} +1 -1
- package/chunks/workspace-registry-PTYUSYXX.js +96 -0
- package/chunks/workspace-service-25ML3T47.js +103 -0
- package/chunks/workspace-skills-status-YKZWOYRX.js +89 -0
- package/chunks/workspace-trust-reconciler-5FI2S3OS.js +349 -0
- package/chunks/write-file-AY7VLP5X.js +78 -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-S4LJZMD5.js +224 -0
- package/cli.js +50 -16
- 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-BbHijhiN.js → arc-xjArKHU2.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-Cb4B_JD0.js → architectureDiagram-3BPJPVTR-BgrQDNYG.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-Dsjlh3H-.js → blockDiagram-GPEHLZMM-CXxWC-1_.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-Cp5AeR4U.js → c4Diagram-AAUBKEIU-Dx1tLm3v.js} +1 -1
- package/web-shell/assets/channel-B1cyk94G.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-CLcY7W2e.js → chunk-2J33WTMH-CBxjogVR.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-BUhvY2LR.js → chunk-4BX2VUAB-izb-rY5W.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-kDIFC_71.js → chunk-55IACEB6-NzLyvSb8.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-CIBO15f2.js → chunk-727SXJPM-DVyKb0dl.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-BJ_T_slV.js → chunk-AQP2D5EJ-BtqL7NzB.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-BEkW35J8.js → chunk-FMBD7UC4-iNpdKIO0.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-GGPxofay.js → chunk-ND2GUHAM-DI7cbFmX.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-Bifllrb6.js → chunk-QZHKN3VN-3Y_-xFYs.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-BpBYZoRE.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BpBYZoRE.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-C-Add_Dp.js → cose-bilkent-S5V4N54A--raRatZn.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-B7MfwNq2.js → dagre-BM42HDAG-B8SU70mO.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-CY_0zuDz.js → diagram-2AECGRRQ-ewgoakXo.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-VyYSbCgA.js → diagram-5GNKFQAL-Bm_JLTnS.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-CBiIZ2PL.js → diagram-KO2AKTUF-DEIUjUy9.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-BL3CrVOx.js → diagram-LMA3HP47-C2Wmrpj-.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-CZUPx96P.js → diagram-OG6HWLK6-CtYe6bFx.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-B81xHr1-.js → erDiagram-TEJ5UH35-DfpHcWLV.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-EZWhir-J.js → flowDiagram-I6XJVG4X-CAiUhio5.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-CVFSuIAg.js → ganttDiagram-6RSMTGT7-CYc7ezr4.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-C1H2uQDv.js → gitGraphDiagram-PVQCEYII-70lbkcRS.js} +1 -1
- package/web-shell/assets/index-C1k3PDuU.css +5 -0
- package/web-shell/assets/index-C2GE3DAF.js +74 -0
- package/web-shell/assets/index-DZLIXILO.js +1750 -0
- package/web-shell/assets/{index-BYo99NBH.js → index-Ww86nT9f.js} +1 -1
- package/web-shell/assets/{infoDiagram-5YYISTIA-BwyFMlF8.js → infoDiagram-5YYISTIA-C7e8DWPa.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-CQ7Yhn2Y.js → ishikawaDiagram-YF4QCWOH-BYLr2op-.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-CJn2sf0l.js → journeyDiagram-JHISSGLW-hEibAHKX.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-DaNRqwVN.js → kanban-definition-UN3LZRKU-F2rt8Uhp.js} +1 -1
- package/web-shell/assets/{linear-DCKODZe2.js → linear-DPhyNezd.js} +1 -1
- package/web-shell/assets/{mermaid.core-CTGJOk27.js → mermaid.core-ZUtnug0n.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-BKU3_3rg.js → mindmap-definition-RKZ34NQL-DDWcMoi8.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-COcwBJ82.js → pieDiagram-4H26LBE5-CTRKzw1_.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-CQnQ443x.js → quadrantDiagram-W4KKPZXB-CAEwYG_z.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-CZ2oj5cD.js → requirementDiagram-4Y6WPE33-CRjnH9D9.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-BxAv5mNu.js → sankeyDiagram-5OEKKPKP-LPQT_sOd.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CztaySPs.js → sequenceDiagram-3UESZ5HK-Ht2Iqvb0.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-CTQT1oGD.js → stateDiagram-AJRCARHV-CIUdqOXu.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BmqqQZ6w.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-K9Mkex5A.js → timeline-definition-PNZ67QCA-BcilneZF.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-B2rVIw76.js → vennDiagram-CIIHVFJN-BljwiiH1.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-Z1w2JR4M.js → wardley-L42UT6IY-DeKjkYjq.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-CIX9aKXf.js → wardleyDiagram-YWT4CUSO-L3U1H7KG.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-CI9DLIKB.js → xychartDiagram-2RQKCTM6-IJnWsgMT.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/MaxSizedBox-INHRH72H.js +0 -86
- package/chunks/agent-VXDAN5JK.js +0 -82
- package/chunks/agent-headless-K4ZMMNBD.js +0 -76
- package/chunks/bridge-LGPZCFHO.js +0 -91
- package/chunks/channel-settings-store-CHCDRTPY.js +0 -89
- package/chunks/chunk-SZRN75WQ.js +0 -29
- package/chunks/chunk-UGYMA4EI.js +0 -219
- package/chunks/chunk-VCBZUOSI.js +0 -8575
- package/chunks/contextCommand-QIZYHDR5.js +0 -81
- package/chunks/daemon-status-provider-OS5UWBHV.js +0 -90
- package/chunks/earlyInputCapture-WQT24RWD.js +0 -83
- package/chunks/environment-VZ7BRI4Q.js +0 -103
- package/chunks/errors-PCX25DVP.js +0 -89
- package/chunks/exitPlanMode-GHPUHBZJ.js +0 -423
- package/chunks/handleAutoUpdate-2CZQRJ66.js +0 -82
- package/chunks/i18n-XEQVMRKN.js +0 -98
- package/chunks/initializer-OVGZ4FLY.js +0 -87
- package/chunks/installationInfo-5UUQJI6Y.js +0 -81
- package/chunks/list-HODU6RXD.js +0 -90
- package/chunks/loadedSettingsAdapter-TYNLBALY.js +0 -84
- package/chunks/mcp-J3DFWX4A.js +0 -84
- package/chunks/nonInteractiveCli-F4GYSMHT.js +0 -144
- package/chunks/pidfile-4VNAR3EP.js +0 -87
- package/chunks/read-file-LZXUR4TO.js +0 -31
- package/chunks/resumeHistoryUtils-65OX3SGJ.js +0 -92
- package/chunks/ripGrep-2U2FRGMV.js +0 -74
- package/chunks/runtime-AXJWIEDU.js +0 -120
- package/chunks/serve-W2GC47CM.js +0 -90
- package/chunks/shell-45IPBDP5.js +0 -84
- package/chunks/spawnChannel-PVXQ5AGV.js +0 -83
- package/chunks/src-AY65BYR7.js +0 -3166
- package/chunks/standalone-update-ZMFNKAEY.js +0 -93
- package/chunks/task-create-N7WQSGYA.js +0 -25
- package/chunks/theme-manager-YYPZFBAH.js +0 -78
- package/chunks/total-session-admission-JXES723M.js +0 -85
- package/chunks/trustedFolders-HVI7IXUH.js +0 -94
- package/chunks/updateCheck-WUJGHWZZ.js +0 -93
- package/chunks/useAutoAcceptIndicator-CHSTZLZD.js +0 -94
- package/chunks/workspace-providers-status-GAKSF4LL.js +0 -87
- package/chunks/workspace-registry-A7NQUONG.js +0 -89
- package/chunks/workspace-service-STGVSO4N.js +0 -99
- package/chunks/workspace-skills-status-66AK3DUA.js +0 -86
- package/chunks/write-file-HUUCEG4P.js +0 -74
- package/web-shell/assets/channel-Bzdx6E8P.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-Cd6wbiuK.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Cd6wbiuK.js +0 -1
- package/web-shell/assets/index-B2bXx96W.js +0 -1249
- package/web-shell/assets/index-_8mKjx8q.css +0 -5
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BjMdT6E_.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,22 +35,22 @@ import {
|
|
|
35
35
|
require_express,
|
|
36
36
|
resolveWebShellDir,
|
|
37
37
|
setDeferredRuntimeRequestTiming
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-MB32MS4U.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
|
-
|
|
49
|
-
|
|
50
|
-
import "./chunk-
|
|
44
|
+
DEFAULT_MAX_JOURNAL_BYTES,
|
|
45
|
+
DEFAULT_MAX_JOURNAL_EVENTS,
|
|
46
|
+
normalizeCompactedReplayMaxBytes,
|
|
47
|
+
normalizeMaxJournalBytes,
|
|
48
|
+
normalizeMaxJournalEvents
|
|
49
|
+
} from "./chunk-XCGIMOLN.js";
|
|
50
|
+
import "./chunk-FC4KQFCS.js";
|
|
51
51
|
import {
|
|
52
52
|
resolveChannelCwd
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-FANRZEAJ.js";
|
|
54
54
|
import {
|
|
55
55
|
loadServeFastPathSettings,
|
|
56
56
|
preResolveServeFastPathHomeEnvOverrides
|
|
@@ -59,13 +59,18 @@ import {
|
|
|
59
59
|
MAX_REGISTERED_WORKSPACES,
|
|
60
60
|
resolveWorkspaceInputs,
|
|
61
61
|
workspaceRegistrationId
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-LYI2PZDK.js";
|
|
63
|
+
import "./chunk-E2FN6SM7.js";
|
|
64
|
+
import {
|
|
65
|
+
LOAD_REPLAY_META_KEY
|
|
66
|
+
} from "./chunk-CPZAH673.js";
|
|
67
|
+
import "./chunk-B4AJNNOL.js";
|
|
63
68
|
import {
|
|
64
69
|
canonicalizeWorkspace,
|
|
65
70
|
translateAndCheckAbsoluteWorkspacePath
|
|
66
71
|
} from "./chunk-2RFKHEXL.js";
|
|
67
|
-
import "./chunk-
|
|
68
|
-
import "./chunk-
|
|
72
|
+
import "./chunk-FCYYAB4S.js";
|
|
73
|
+
import "./chunk-FYJ7W2PI.js";
|
|
69
74
|
import {
|
|
70
75
|
ChannelDeliveryError,
|
|
71
76
|
ChannelWebhookEnqueueError,
|
|
@@ -75,31 +80,33 @@ import {
|
|
|
75
80
|
import {
|
|
76
81
|
normalizeWorkerDiagnostic,
|
|
77
82
|
sanitizeWorkerDiagnostic
|
|
78
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-6MPDY6ZG.js";
|
|
79
84
|
import {
|
|
80
85
|
channelSelectionNames
|
|
81
86
|
} from "./chunk-ALMR3E6Q.js";
|
|
82
87
|
import "./chunk-BK2UNYWD.js";
|
|
83
88
|
import "./chunk-M5GB774H.js";
|
|
89
|
+
import "./chunk-5HBA2Z7V.js";
|
|
90
|
+
import "./chunk-K6KS3LTN.js";
|
|
91
|
+
import "./chunk-T3CHYWJZ.js";
|
|
84
92
|
import {
|
|
85
93
|
sanitizeLogText
|
|
86
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-JCJ7LKNA.js";
|
|
87
95
|
import "./chunk-UDXSXLER.js";
|
|
88
|
-
import "./chunk-5HBA2Z7V.js";
|
|
89
96
|
import "./chunk-GOXKNSDZ.js";
|
|
90
97
|
import {
|
|
91
98
|
getGlobalQwenDirLite,
|
|
92
99
|
resolveConfigPathLite
|
|
93
100
|
} from "./chunk-IDS7MSUP.js";
|
|
94
101
|
import "./chunk-6PEXNQTX.js";
|
|
95
|
-
import {
|
|
96
|
-
getCliVersion
|
|
97
|
-
} from "./chunk-I7XZ3RY5.js";
|
|
98
|
-
import "./chunk-VJNBRRZG.js";
|
|
99
102
|
import "./chunk-ALGGS7UH.js";
|
|
100
103
|
import {
|
|
101
104
|
isWithinRoot
|
|
102
105
|
} from "./chunk-MR3PXB6E.js";
|
|
106
|
+
import {
|
|
107
|
+
getCliVersion
|
|
108
|
+
} from "./chunk-2KKCCLPT.js";
|
|
109
|
+
import "./chunk-VJNBRRZG.js";
|
|
103
110
|
import {
|
|
104
111
|
writeStderrLine,
|
|
105
112
|
writeStdoutLine
|
|
@@ -1262,7 +1269,7 @@ function createConcreteLogger(input) {
|
|
|
1262
1269
|
}
|
|
1263
1270
|
});
|
|
1264
1271
|
let timeout;
|
|
1265
|
-
const deadline = new Promise((
|
|
1272
|
+
const deadline = new Promise((resolve2) => {
|
|
1266
1273
|
timeout = setTimeout(() => {
|
|
1267
1274
|
try {
|
|
1268
1275
|
input.warnOnce(
|
|
@@ -1271,7 +1278,7 @@ function createConcreteLogger(input) {
|
|
|
1271
1278
|
);
|
|
1272
1279
|
} catch {
|
|
1273
1280
|
} finally {
|
|
1274
|
-
|
|
1281
|
+
resolve2();
|
|
1275
1282
|
}
|
|
1276
1283
|
}, input.policy.closeDrainBudgetMs);
|
|
1277
1284
|
timeout.unref();
|
|
@@ -2319,8 +2326,8 @@ async function flushDaemonLogBounded(daemonLog, budgetMs) {
|
|
|
2319
2326
|
await Promise.race([
|
|
2320
2327
|
daemonLog.flush().catch(() => {
|
|
2321
2328
|
}),
|
|
2322
|
-
new Promise((
|
|
2323
|
-
timer = setTimeout(
|
|
2329
|
+
new Promise((resolve2) => {
|
|
2330
|
+
timer = setTimeout(resolve2, budgetMs);
|
|
2324
2331
|
timer.unref();
|
|
2325
2332
|
})
|
|
2326
2333
|
]);
|
|
@@ -2494,6 +2501,13 @@ function formatHostForUrl(host) {
|
|
|
2494
2501
|
return host;
|
|
2495
2502
|
}
|
|
2496
2503
|
__name(formatHostForUrl, "formatHostForUrl");
|
|
2504
|
+
function workspaceRuntimeEffectiveEnv(runtime, daemonEnv) {
|
|
2505
|
+
if (runtime.env.mode === "runtime-overlay") {
|
|
2506
|
+
return runtime.env.effectiveEnv ?? {};
|
|
2507
|
+
}
|
|
2508
|
+
return runtime.env.effectiveEnv ?? daemonEnv;
|
|
2509
|
+
}
|
|
2510
|
+
__name(workspaceRuntimeEffectiveEnv, "workspaceRuntimeEffectiveEnv");
|
|
2497
2511
|
function formatChannelWorkerDaemonUrl(host, port) {
|
|
2498
2512
|
const normalized = host.trim().toLowerCase();
|
|
2499
2513
|
if (normalized === "" || normalized === "0.0.0.0" || normalized === "::" || normalized === "[::]") {
|
|
@@ -2531,15 +2545,16 @@ function withSettingsLock(workspace, fn) {
|
|
|
2531
2545
|
return next;
|
|
2532
2546
|
}
|
|
2533
2547
|
__name(withSettingsLock, "withSettingsLock");
|
|
2548
|
+
var retryableChannelWorkerShutdownErrors = /* @__PURE__ */ new WeakSet();
|
|
2534
2549
|
var channelWorkerRuntimePromise;
|
|
2535
2550
|
async function loadChannelWorkerRuntime() {
|
|
2536
2551
|
channelWorkerRuntimePromise ??= Promise.all([
|
|
2537
|
-
import("./channel-worker-supervisor-
|
|
2538
|
-
import("./pidfile-
|
|
2539
|
-
import("./runtime-
|
|
2552
|
+
import("./channel-worker-supervisor-CABBXYHK.js"),
|
|
2553
|
+
import("./pidfile-NL7MKDRU.js"),
|
|
2554
|
+
import("./runtime-QFJ2MJF5.js"),
|
|
2540
2555
|
import("./cli-entry-path-4VJ3Y6T2.js"),
|
|
2541
|
-
import("./channel-worker-group-
|
|
2542
|
-
import("./channel-worker-manager-
|
|
2556
|
+
import("./channel-worker-group-OVWGYMZS.js"),
|
|
2557
|
+
import("./channel-worker-manager-H55GKOQA.js")
|
|
2543
2558
|
]).then(
|
|
2544
2559
|
([
|
|
2545
2560
|
supervisor,
|
|
@@ -2644,7 +2659,7 @@ function shouldPreheatBridge(deps) {
|
|
|
2644
2659
|
__name(shouldPreheatBridge, "shouldPreheatBridge");
|
|
2645
2660
|
var coreRuntimePromise;
|
|
2646
2661
|
function loadCoreRuntime() {
|
|
2647
|
-
coreRuntimePromise ??= import("./
|
|
2662
|
+
coreRuntimePromise ??= import("./core-runtime-6N4EFC2Q.js");
|
|
2648
2663
|
return coreRuntimePromise;
|
|
2649
2664
|
}
|
|
2650
2665
|
__name(loadCoreRuntime, "loadCoreRuntime");
|
|
@@ -2674,10 +2689,10 @@ __name(resolveDaemonLogBaseDirForRun, "resolveDaemonLogBaseDirForRun");
|
|
|
2674
2689
|
var settingsRuntimePromise;
|
|
2675
2690
|
function loadSettingsRuntimeModules() {
|
|
2676
2691
|
settingsRuntimePromise ??= Promise.all([
|
|
2677
|
-
import("./settings-
|
|
2678
|
-
import("./environment-
|
|
2679
|
-
import("./loadedSettingsAdapter-
|
|
2680
|
-
import("./trustedFolders-
|
|
2692
|
+
import("./settings-LN7RNKBS.js"),
|
|
2693
|
+
import("./environment-SWL3CMB3.js"),
|
|
2694
|
+
import("./loadedSettingsAdapter-ZQAV5NDO.js"),
|
|
2695
|
+
import("./trustedFolders-KOPSP44S.js")
|
|
2681
2696
|
]).then(([settings, environment, loadedSettingsAdapter, trustedFolders]) => ({
|
|
2682
2697
|
settings,
|
|
2683
2698
|
environment,
|
|
@@ -2690,8 +2705,8 @@ __name(loadSettingsRuntimeModules, "loadSettingsRuntimeModules");
|
|
|
2690
2705
|
var channelWebhookConfigRuntimePromise;
|
|
2691
2706
|
function loadChannelWebhookConfigRuntime() {
|
|
2692
2707
|
channelWebhookConfigRuntimePromise ??= Promise.all([
|
|
2693
|
-
import("./runtime-
|
|
2694
|
-
import("./config-utils-
|
|
2708
|
+
import("./runtime-QFJ2MJF5.js"),
|
|
2709
|
+
import("./config-utils-WADIDWGG.js")
|
|
2695
2710
|
]).then(([channelRuntime, configUtils]) => ({
|
|
2696
2711
|
loadChannelsConfig: channelRuntime.loadChannelsConfig,
|
|
2697
2712
|
parseChannelWebhookConfig: configUtils.parseChannelWebhookConfig
|
|
@@ -2707,6 +2722,7 @@ async function loadServeRuntimeModules() {
|
|
|
2707
2722
|
serverModule,
|
|
2708
2723
|
bridgeModule,
|
|
2709
2724
|
spawnChannelModule,
|
|
2725
|
+
processRegistryModule,
|
|
2710
2726
|
workspaceModule,
|
|
2711
2727
|
workspaceTypesModule,
|
|
2712
2728
|
daemonStatusProviderModule,
|
|
@@ -2715,16 +2731,17 @@ async function loadServeRuntimeModules() {
|
|
|
2715
2731
|
totalSessionAdmissionModule,
|
|
2716
2732
|
workspaceRegistryModule
|
|
2717
2733
|
] = await Promise.all([
|
|
2718
|
-
import("./server-
|
|
2719
|
-
import("./bridge-
|
|
2720
|
-
import("./spawnChannel-
|
|
2721
|
-
import("./
|
|
2734
|
+
import("./server-EP2LLAPD.js"),
|
|
2735
|
+
import("./bridge-W7AZSRZQ.js"),
|
|
2736
|
+
import("./spawnChannel-YPCU62DI.js"),
|
|
2737
|
+
import("./process-registry-2CHQBXH5.js"),
|
|
2738
|
+
import("./workspace-service-25ML3T47.js"),
|
|
2722
2739
|
import("./types-ML3TRJQ5.js"),
|
|
2723
|
-
import("./daemon-status-provider-
|
|
2724
|
-
import("./workspace-providers-status-
|
|
2725
|
-
import("./workspace-skills-status-
|
|
2726
|
-
import("./total-session-admission-
|
|
2727
|
-
import("./workspace-registry-
|
|
2740
|
+
import("./daemon-status-provider-DDF7C5M7.js"),
|
|
2741
|
+
import("./workspace-providers-status-YKLTLMJA.js"),
|
|
2742
|
+
import("./workspace-skills-status-YKZWOYRX.js"),
|
|
2743
|
+
import("./total-session-admission-5CALIVYO.js"),
|
|
2744
|
+
import("./workspace-registry-PTYUSYXX.js")
|
|
2728
2745
|
]);
|
|
2729
2746
|
return {
|
|
2730
2747
|
createServeApp: serverModule.createServeApp,
|
|
@@ -2733,6 +2750,7 @@ async function loadServeRuntimeModules() {
|
|
|
2733
2750
|
resolveBridgeFsFactory: serverModule.resolveBridgeFsFactory,
|
|
2734
2751
|
createAcpSessionBridge: bridgeModule.createAcpSessionBridge,
|
|
2735
2752
|
createSpawnChannelFactory: spawnChannelModule.createSpawnChannelFactory,
|
|
2753
|
+
ProcessRegistry: processRegistryModule.ProcessRegistry,
|
|
2736
2754
|
createDaemonWorkspaceService: workspaceModule.createDaemonWorkspaceService,
|
|
2737
2755
|
WorkspaceSettingsPartialPersistError: workspaceTypesModule.WorkspaceSettingsPartialPersistError,
|
|
2738
2756
|
WorkspaceSkillNotToggleableError: workspaceTypesModule.WorkspaceSkillNotToggleableError,
|
|
@@ -2741,7 +2759,8 @@ async function loadServeRuntimeModules() {
|
|
|
2741
2759
|
createWorkspaceSkillsStatusProvider: workspaceSkillsStatusModule.createWorkspaceSkillsStatusProvider,
|
|
2742
2760
|
createTotalSessionAdmissionController: totalSessionAdmissionModule.createTotalSessionAdmissionController,
|
|
2743
2761
|
createWorkspaceRegistry: workspaceRegistryModule.createWorkspaceRegistry,
|
|
2744
|
-
createWorkspaceSessionOwnerIndex: workspaceRegistryModule.createWorkspaceSessionOwnerIndex
|
|
2762
|
+
createWorkspaceSessionOwnerIndex: workspaceRegistryModule.createWorkspaceSessionOwnerIndex,
|
|
2763
|
+
createWorkspaceGenerationGuard: workspaceRegistryModule.createWorkspaceGenerationGuard
|
|
2745
2764
|
};
|
|
2746
2765
|
}
|
|
2747
2766
|
__name(loadServeRuntimeModules, "loadServeRuntimeModules");
|
|
@@ -2916,12 +2935,12 @@ async function waitForRuntimeStartingForShutdown(runtimeStarting, daemonLog, tim
|
|
|
2916
2935
|
let timer;
|
|
2917
2936
|
await Promise.race([
|
|
2918
2937
|
runtimeStarting,
|
|
2919
|
-
new Promise((
|
|
2938
|
+
new Promise((resolve2) => {
|
|
2920
2939
|
timer = setTimeout(() => {
|
|
2921
2940
|
daemonLog.warn(
|
|
2922
2941
|
`${timeoutMs}ms runtime-startup wait reached during shutdown; continuing listener close`
|
|
2923
2942
|
);
|
|
2924
|
-
|
|
2943
|
+
resolve2();
|
|
2925
2944
|
}, timeoutMs);
|
|
2926
2945
|
timer.unref();
|
|
2927
2946
|
})
|
|
@@ -3090,6 +3109,8 @@ function createBootstrapServeApp(input) {
|
|
|
3090
3109
|
listenerMaxConnections: listenerMaxConnections(opts.maxConnections),
|
|
3091
3110
|
eventRingSize: opts.eventRingSize ?? DEFAULT_EVENT_RING_SIZE,
|
|
3092
3111
|
compactedReplayMaxBytes: opts.compactedReplayMaxBytes ?? DEFAULT_COMPACTED_REPLAY_MAX_BYTES,
|
|
3112
|
+
maxJournalEvents: opts.maxJournalEvents ?? DEFAULT_MAX_JOURNAL_EVENTS,
|
|
3113
|
+
maxJournalBytes: opts.maxJournalBytes ?? DEFAULT_MAX_JOURNAL_BYTES,
|
|
3093
3114
|
promptDeadlineMs: positiveFiniteOrNull(opts.promptDeadlineMs),
|
|
3094
3115
|
writerIdleTimeoutMs: positiveFiniteOrNull(opts.writerIdleTimeoutMs),
|
|
3095
3116
|
channelIdleTimeoutMs: channelIdleTimeoutMs(opts.channelIdleTimeoutMs),
|
|
@@ -3613,7 +3634,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
3613
3634
|
}
|
|
3614
3635
|
let workspaceRegistrationStore = deps.workspaceRegistrationStore;
|
|
3615
3636
|
if (workspaceRegistrationStore === void 0 && process.env["QWEN_SERVE_NO_PERSISTENT_REGISTRATION"] !== "1") {
|
|
3616
|
-
const { WorkspaceRegistrationStore } = await import("./workspace-registration-store-
|
|
3637
|
+
const { WorkspaceRegistrationStore } = await import("./workspace-registration-store-5DMGKU64.js");
|
|
3617
3638
|
workspaceRegistrationStore = new WorkspaceRegistrationStore(boundWorkspace);
|
|
3618
3639
|
}
|
|
3619
3640
|
if (workspaceRegistrationStore) {
|
|
@@ -3768,6 +3789,12 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
3768
3789
|
if (opts.compactedReplayMaxBytes !== void 0) {
|
|
3769
3790
|
normalizeCompactedReplayMaxBytes(opts.compactedReplayMaxBytes);
|
|
3770
3791
|
}
|
|
3792
|
+
if (opts.maxJournalEvents !== void 0) {
|
|
3793
|
+
normalizeMaxJournalEvents(opts.maxJournalEvents);
|
|
3794
|
+
}
|
|
3795
|
+
if (opts.maxJournalBytes !== void 0) {
|
|
3796
|
+
normalizeMaxJournalBytes(opts.maxJournalBytes);
|
|
3797
|
+
}
|
|
3771
3798
|
if (opts.writerIdleTimeoutMs !== void 0) {
|
|
3772
3799
|
if (!isPositiveIntegerMs(opts.writerIdleTimeoutMs)) {
|
|
3773
3800
|
throw new TypeError(
|
|
@@ -3852,6 +3879,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
3852
3879
|
let runtimeApp;
|
|
3853
3880
|
let runtimeAppForCleanup;
|
|
3854
3881
|
let bridgeRef = deps.bridge;
|
|
3882
|
+
let managedProcessRegistry;
|
|
3855
3883
|
const internalRuntimeBridgesForCleanup = [];
|
|
3856
3884
|
let daemonEventLoopMonitor;
|
|
3857
3885
|
let daemonMetricsSampler;
|
|
@@ -3863,8 +3891,8 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
3863
3891
|
let startRuntimeAfterHealth;
|
|
3864
3892
|
let startRuntimeForRequest;
|
|
3865
3893
|
const deferRuntimeUntilFirstHealth = deps.resolveOnListen === true && deps.deferRuntimeUntilFirstHealth === true;
|
|
3866
|
-
const runtimeReady = new Promise((
|
|
3867
|
-
markRuntimeReady =
|
|
3894
|
+
const runtimeReady = new Promise((resolve2, reject) => {
|
|
3895
|
+
markRuntimeReady = resolve2;
|
|
3868
3896
|
markRuntimeFailed = reject;
|
|
3869
3897
|
});
|
|
3870
3898
|
void runtimeReady.catch(() => {
|
|
@@ -4018,6 +4046,19 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4018
4046
|
const disposedRuntimeApps = /* @__PURE__ */ new WeakSet();
|
|
4019
4047
|
const stoppedRuntimeAppProducers = /* @__PURE__ */ new WeakSet();
|
|
4020
4048
|
const stoppedExtensionReconcilers = /* @__PURE__ */ new WeakSet();
|
|
4049
|
+
const stoppedTrustPolicyMonitors = /* @__PURE__ */ new WeakSet();
|
|
4050
|
+
const stopTrustPolicyMonitor = /* @__PURE__ */ __name((app2) => {
|
|
4051
|
+
if (!app2 || stoppedTrustPolicyMonitors.has(app2)) return;
|
|
4052
|
+
stoppedTrustPolicyMonitors.add(app2);
|
|
4053
|
+
const stop = app2.locals?.["stopTrustPolicyMonitor"];
|
|
4054
|
+
try {
|
|
4055
|
+
stop?.();
|
|
4056
|
+
} catch (err) {
|
|
4057
|
+
daemonLog.warn(
|
|
4058
|
+
`trust policy monitor dispose error: ${err instanceof Error ? err.message : String(err)}`
|
|
4059
|
+
);
|
|
4060
|
+
}
|
|
4061
|
+
}, "stopTrustPolicyMonitor");
|
|
4021
4062
|
const stopExtensionReconciler = /* @__PURE__ */ __name((app2) => {
|
|
4022
4063
|
if (!app2 || stoppedExtensionReconcilers.has(app2)) return;
|
|
4023
4064
|
stoppedExtensionReconcilers.add(app2);
|
|
@@ -4045,6 +4086,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4045
4086
|
}, "stopSafely");
|
|
4046
4087
|
stopSafely("scheduled-task keepalive", locals.stopScheduledTaskKeepalive);
|
|
4047
4088
|
stopSafely("workspace git state", locals.stopWorkspaceGitState);
|
|
4089
|
+
stopTrustPolicyMonitor(app2);
|
|
4048
4090
|
for (const stop of locals.subSessionStoppers ?? []) {
|
|
4049
4091
|
stopSafely("sub-session launcher", stop);
|
|
4050
4092
|
}
|
|
@@ -4098,13 +4140,23 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4098
4140
|
return [...new Set(bridges)];
|
|
4099
4141
|
}, "getRuntimeBridgesForCleanup");
|
|
4100
4142
|
const buildRuntime = /* @__PURE__ */ __name(async () => {
|
|
4101
|
-
const [runtime, core, settingsRuntime, resolvedCliVersion] = await Promise.all([
|
|
4143
|
+
const [runtime, core, settingsRuntime, resolvedCliVersion, trustPolicy] = await Promise.all([
|
|
4102
4144
|
loadServeRuntimeModules(),
|
|
4103
4145
|
loadCoreRuntime(),
|
|
4104
4146
|
loadSettingsRuntimeModules(),
|
|
4105
|
-
cliVersionPromise
|
|
4147
|
+
cliVersionPromise,
|
|
4148
|
+
import("./daemon-trust-policy-Q4KSOJTR.js")
|
|
4106
4149
|
]);
|
|
4107
4150
|
cliVersion = resolvedCliVersion;
|
|
4151
|
+
settingsRuntime.environment.preResolveHomeEnvOverrides();
|
|
4152
|
+
const bootTrustSnapshot = await trustPolicy.readDaemonTrustPolicySnapshot();
|
|
4153
|
+
let latestTrustPolicySnapshot = bootTrustSnapshot;
|
|
4154
|
+
const bootPrimaryTrustDecision = trustPolicy.evaluateDaemonWorkspaceTrust(
|
|
4155
|
+
bootTrustSnapshot,
|
|
4156
|
+
boundWorkspace
|
|
4157
|
+
);
|
|
4158
|
+
const trustedWorkspace = deps.trustedWorkspace ?? bootPrimaryTrustDecision.targetTrusted;
|
|
4159
|
+
const workspaceTrustHotReloadAvailable = deps.trustedWorkspace === void 0 && deps.bridge === void 0 && deps.fsFactory === void 0;
|
|
4108
4160
|
let managedScratchRoot;
|
|
4109
4161
|
try {
|
|
4110
4162
|
managedScratchRoot = prepareManagedScratchRoot(
|
|
@@ -4118,16 +4170,19 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4118
4170
|
}
|
|
4119
4171
|
let runtimeBootSettings;
|
|
4120
4172
|
try {
|
|
4121
|
-
runtimeBootSettings = settingsRuntime.settings.loadSettings(
|
|
4173
|
+
runtimeBootSettings = settingsRuntime.settings.loadSettings(
|
|
4174
|
+
boundWorkspace,
|
|
4175
|
+
{
|
|
4176
|
+
skipLoadEnvironment: true,
|
|
4177
|
+
skipWorkspaceSettings: !trustedWorkspace,
|
|
4178
|
+
workspaceTrusted: trustedWorkspace
|
|
4179
|
+
}
|
|
4180
|
+
);
|
|
4122
4181
|
} catch (err) {
|
|
4123
4182
|
writeStderrLine(
|
|
4124
4183
|
`qwen serve: could not read full settings for runtime startup (${err instanceof Error ? err.message : String(err)}); falling back to defaults.`
|
|
4125
4184
|
);
|
|
4126
4185
|
}
|
|
4127
|
-
const trustedWorkspace = deps.trustedWorkspace ?? (runtimeBootSettings ? settingsRuntime.trustedFolders.getWorkspaceTrustStatus(
|
|
4128
|
-
runtimeBootSettings.merged,
|
|
4129
|
-
boundWorkspace
|
|
4130
|
-
).effective.state === "trusted" : true);
|
|
4131
4186
|
if (deps.trustedWorkspace === void 0 && runtimeBootSettings && !trustedWorkspace) {
|
|
4132
4187
|
daemonLog.warn(
|
|
4133
4188
|
"workspace file writes are disabled because the bound workspace is not trusted",
|
|
@@ -4137,7 +4192,8 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4137
4192
|
const runtimeEnvSnapshot = runtimeBootSettings ? settingsRuntime.environment.buildRuntimeEnvironment(
|
|
4138
4193
|
runtimeBootSettings.merged,
|
|
4139
4194
|
boundWorkspace,
|
|
4140
|
-
daemonRuntimeBaseEnv
|
|
4195
|
+
daemonRuntimeBaseEnv,
|
|
4196
|
+
trustedWorkspace
|
|
4141
4197
|
) : {
|
|
4142
4198
|
effectiveEnv: { ...daemonRuntimeBaseEnv },
|
|
4143
4199
|
overlayKeys: Object.freeze([]),
|
|
@@ -4145,6 +4201,29 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4145
4201
|
envFileReadFailed: false,
|
|
4146
4202
|
envFileReadFailures: Object.freeze([])
|
|
4147
4203
|
};
|
|
4204
|
+
const resolveSessionRuntimeBaseDir = /* @__PURE__ */ __name((workspace, settings, effectiveEnv) => {
|
|
4205
|
+
const resolveConfiguredPath = /* @__PURE__ */ __name((configuredPath, relativeTo) => {
|
|
4206
|
+
const expanded = configuredPath === "~" ? os.homedir() : configuredPath.startsWith("~/") || configuredPath.startsWith("~\\") ? path.join(
|
|
4207
|
+
os.homedir(),
|
|
4208
|
+
...configuredPath.slice(2).split(/[/\\]+/).filter(Boolean)
|
|
4209
|
+
) : configuredPath;
|
|
4210
|
+
return path.resolve(relativeTo, expanded);
|
|
4211
|
+
}, "resolveConfiguredPath");
|
|
4212
|
+
const runtimeDir = effectiveEnv["QWEN_RUNTIME_DIR"];
|
|
4213
|
+
if (runtimeDir) {
|
|
4214
|
+
return resolveConfiguredPath(runtimeDir, process.cwd());
|
|
4215
|
+
}
|
|
4216
|
+
const settingsDir = settings?.merged.advanced?.runtimeOutputDir;
|
|
4217
|
+
if (settingsDir) {
|
|
4218
|
+
return resolveConfiguredPath(settingsDir, workspace);
|
|
4219
|
+
}
|
|
4220
|
+
const qwenHome = effectiveEnv["QWEN_HOME"];
|
|
4221
|
+
if (qwenHome) {
|
|
4222
|
+
return resolveConfiguredPath(qwenHome, process.cwd());
|
|
4223
|
+
}
|
|
4224
|
+
const homeDir = os.homedir();
|
|
4225
|
+
return homeDir ? path.join(homeDir, ".qwen") : path.join(os.tmpdir(), ".qwen");
|
|
4226
|
+
}, "resolveSessionRuntimeBaseDir");
|
|
4148
4227
|
const logRuntimeEnvFileReadFailures = /* @__PURE__ */ __name((workspace, snapshot) => {
|
|
4149
4228
|
if (!snapshot.envFileReadFailed) return;
|
|
4150
4229
|
const failedFiles = snapshot.envFileReadFailures ?? [];
|
|
@@ -4154,14 +4233,21 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4154
4233
|
});
|
|
4155
4234
|
}, "logRuntimeEnvFileReadFailures");
|
|
4156
4235
|
logRuntimeEnvFileReadFailures(boundWorkspace, runtimeEnvSnapshot);
|
|
4236
|
+
const primarySessionRuntimeBaseDir = resolveSessionRuntimeBaseDir(
|
|
4237
|
+
boundWorkspace,
|
|
4238
|
+
runtimeBootSettings,
|
|
4239
|
+
runtimeEnvSnapshot.effectiveEnv
|
|
4240
|
+
);
|
|
4157
4241
|
const runtimeEffectiveEnv = {
|
|
4158
|
-
...runtimeEnvSnapshot.effectiveEnv
|
|
4242
|
+
...runtimeEnvSnapshot.effectiveEnv,
|
|
4243
|
+
QWEN_RUNTIME_DIR: primarySessionRuntimeBaseDir
|
|
4159
4244
|
};
|
|
4160
4245
|
const replaceRuntimeEffectiveEnv = /* @__PURE__ */ __name((nextEnv) => {
|
|
4161
4246
|
for (const key of Object.keys(runtimeEffectiveEnv)) {
|
|
4162
4247
|
delete runtimeEffectiveEnv[key];
|
|
4163
4248
|
}
|
|
4164
4249
|
Object.assign(runtimeEffectiveEnv, nextEnv);
|
|
4250
|
+
runtimeEffectiveEnv["QWEN_RUNTIME_DIR"] = primarySessionRuntimeBaseDir;
|
|
4165
4251
|
}, "replaceRuntimeEffectiveEnv");
|
|
4166
4252
|
const primaryRuntimeEnv = {
|
|
4167
4253
|
mode: "runtime-overlay",
|
|
@@ -4308,17 +4394,10 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4308
4394
|
void 0,
|
|
4309
4395
|
(workspace, index) => {
|
|
4310
4396
|
if (index === 0) return true;
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
"excluding secondary workspace root because trust settings are unavailable",
|
|
4314
|
-
{ workspace }
|
|
4315
|
-
);
|
|
4316
|
-
return false;
|
|
4317
|
-
}
|
|
4318
|
-
const trustedSecondary = settingsRuntime.trustedFolders.getWorkspaceTrustStatus(
|
|
4319
|
-
runtimeBootSettings.merged,
|
|
4397
|
+
const trustedSecondary = trustPolicy.evaluateDaemonWorkspaceTrust(
|
|
4398
|
+
bootTrustSnapshot,
|
|
4320
4399
|
workspace
|
|
4321
|
-
).
|
|
4400
|
+
).targetTrusted;
|
|
4322
4401
|
if (!trustedSecondary) {
|
|
4323
4402
|
daemonLog.warn(
|
|
4324
4403
|
"excluding untrusted secondary workspace root from file-system access",
|
|
@@ -4333,7 +4412,16 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4333
4412
|
secondary: boundWorkspaces.slice(1),
|
|
4334
4413
|
ideEnvPresent: !!process.env["QWEN_CODE_IDE_WORKSPACE_PATH"]
|
|
4335
4414
|
});
|
|
4415
|
+
const primaryGenerationGuard = runtime.createWorkspaceGenerationGuard();
|
|
4416
|
+
const primaryTrustMaterialization = JSON.stringify({
|
|
4417
|
+
trusted: trustedWorkspace,
|
|
4418
|
+
boundWorkspaces: [...boundWorkspaces].sort()
|
|
4419
|
+
});
|
|
4336
4420
|
const sharedPathLocks = new PathMutexRegistry();
|
|
4421
|
+
const workspaceTrustOperationGate = new PathMutexRegistry();
|
|
4422
|
+
const runWorkspaceTrustOperation = /* @__PURE__ */ __name((operation) => workspaceTrustOperationGate.runExclusive("runtime-topology", operation), "runWorkspaceTrustOperation");
|
|
4423
|
+
const processRegistry = new runtime.ProcessRegistry();
|
|
4424
|
+
managedProcessRegistry = processRegistry;
|
|
4337
4425
|
const fsFactory = runtime.resolveBridgeFsFactory({
|
|
4338
4426
|
// Secondary roots share a write-capable factory only after their own
|
|
4339
4427
|
// folder trust check passes; untrusted secondary roots stay outside.
|
|
@@ -4342,6 +4430,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4342
4430
|
trusted: trustedWorkspace,
|
|
4343
4431
|
emit: deps.fsAuditEmit,
|
|
4344
4432
|
pathLocks: sharedPathLocks,
|
|
4433
|
+
generationGuard: primaryGenerationGuard,
|
|
4345
4434
|
...customIgnoreFiles !== void 0 ? { customIgnoreFiles } : {}
|
|
4346
4435
|
});
|
|
4347
4436
|
const routeFsFactory = runtime.resolveBridgeFsFactory({
|
|
@@ -4351,9 +4440,11 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4351
4440
|
trusted: trustedWorkspace,
|
|
4352
4441
|
emit: deps.fsAuditEmit,
|
|
4353
4442
|
pathLocks: sharedPathLocks,
|
|
4443
|
+
generationGuard: primaryGenerationGuard,
|
|
4354
4444
|
...customIgnoreFiles !== void 0 ? { customIgnoreFiles } : {}
|
|
4355
4445
|
});
|
|
4356
4446
|
const channelFactory = runtime.createSpawnChannelFactory({
|
|
4447
|
+
processRegistry,
|
|
4357
4448
|
sourceEnv: runtimeEffectiveEnv,
|
|
4358
4449
|
onDiagnosticLine: diagnosticSink,
|
|
4359
4450
|
pipeHooks: {
|
|
@@ -4371,9 +4462,12 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4371
4462
|
env: runtimeEffectiveEnv
|
|
4372
4463
|
});
|
|
4373
4464
|
const workspaceProvidersStatusProvider = runtime.createWorkspaceProvidersStatusProvider({
|
|
4374
|
-
env: runtimeEffectiveEnv
|
|
4465
|
+
env: runtimeEffectiveEnv,
|
|
4466
|
+
workspaceTrusted: trustedWorkspace
|
|
4467
|
+
});
|
|
4468
|
+
const workspaceSkillsStatusProvider = runtime.createWorkspaceSkillsStatusProvider({
|
|
4469
|
+
workspaceTrusted: trustedWorkspace
|
|
4375
4470
|
});
|
|
4376
|
-
const workspaceSkillsStatusProvider = runtime.createWorkspaceSkillsStatusProvider();
|
|
4377
4471
|
const clientMcpSenderRegistry = new ClientMcpSenderRegistry();
|
|
4378
4472
|
const runtimeBridges = [];
|
|
4379
4473
|
const totalSessionAdmission = runtime.createTotalSessionAdmissionController(
|
|
@@ -4383,84 +4477,108 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4383
4477
|
}
|
|
4384
4478
|
);
|
|
4385
4479
|
const sessionOwnerIndex = runtime.createWorkspaceSessionOwnerIndex();
|
|
4386
|
-
const
|
|
4387
|
-
|
|
4480
|
+
const workspaceRegistryForPersistence = { current: void 0 };
|
|
4481
|
+
const isWorkspaceTrustedForPersistence = /* @__PURE__ */ __name((workspace) => workspaceRegistryForPersistence.current?.getByWorkspaceCwd(workspace)?.trusted ?? (workspaceRegistryForPersistence.current === void 0 && workspace === boundWorkspace && trustedWorkspace), "isWorkspaceTrustedForPersistence");
|
|
4482
|
+
const loadSettingsForPersistence = /* @__PURE__ */ __name((workspace) => {
|
|
4483
|
+
const trusted = isWorkspaceTrustedForPersistence(workspace);
|
|
4484
|
+
return settingsRuntime.settings.loadSettings(workspace, {
|
|
4485
|
+
skipLoadEnvironment: true,
|
|
4486
|
+
skipWorkspaceSettings: !trusted,
|
|
4487
|
+
workspaceTrusted: trusted
|
|
4488
|
+
});
|
|
4489
|
+
}, "loadSettingsForPersistence");
|
|
4490
|
+
const persistDisabledToolsFn = /* @__PURE__ */ __name((workspace, toolName, enabled, assertGenerationOpen) => withSettingsLock(workspace, async () => {
|
|
4491
|
+
assertGenerationOpen?.();
|
|
4492
|
+
const fresh = loadSettingsForPersistence(workspace);
|
|
4388
4493
|
const wsScope = fresh.forScope(WORKSPACE_SETTING_SCOPE).settings;
|
|
4389
4494
|
const wsDisabled = wsScope.tools?.disabled;
|
|
4390
4495
|
const current = Array.isArray(wsDisabled) ? wsDisabled.filter((v) => typeof v === "string") : [];
|
|
4391
4496
|
const next = new Set(current);
|
|
4392
4497
|
if (enabled) next.delete(toolName);
|
|
4393
4498
|
else next.add(toolName);
|
|
4499
|
+
assertGenerationOpen?.();
|
|
4394
4500
|
fresh.setValue(
|
|
4395
4501
|
WORKSPACE_SETTING_SCOPE,
|
|
4396
4502
|
"tools.disabled",
|
|
4397
|
-
[...next].sort()
|
|
4503
|
+
[...next].sort(),
|
|
4504
|
+
assertGenerationOpen
|
|
4398
4505
|
);
|
|
4399
4506
|
}), "persistDisabledToolsFn");
|
|
4400
|
-
const persistDisabledSkillsFn = /* @__PURE__ */ __name((workspace, skillName, enabled) => withSettingsLock(workspace, async () => {
|
|
4401
|
-
|
|
4507
|
+
const persistDisabledSkillsFn = /* @__PURE__ */ __name((workspace, skillName, enabled, assertGenerationOpen) => withSettingsLock(workspace, async () => {
|
|
4508
|
+
assertGenerationOpen?.();
|
|
4509
|
+
const {
|
|
4510
|
+
resolveSkillSettings,
|
|
4511
|
+
skillSettingStrings,
|
|
4512
|
+
updateWorkspaceSkillSettingLists
|
|
4513
|
+
} = await import("./skill-settings-GMR3GMNY.js");
|
|
4514
|
+
const fresh = loadSettingsForPersistence(workspace);
|
|
4402
4515
|
const normalizedName = skillName.trim().toLowerCase();
|
|
4403
|
-
const
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
for (const [scope, names] of lockedScopes) {
|
|
4412
|
-
if (disabledNames(names).some(
|
|
4413
|
-
(name) => name.trim().toLowerCase() === normalizedName
|
|
4414
|
-
)) {
|
|
4415
|
-
throw new runtime.WorkspaceSkillNotToggleableError(
|
|
4416
|
-
skillName,
|
|
4417
|
-
"locked",
|
|
4418
|
-
scope
|
|
4419
|
-
);
|
|
4420
|
-
}
|
|
4516
|
+
const resolved = resolveSkillSettings(fresh);
|
|
4517
|
+
const disablement = resolved.disablements.get(normalizedName);
|
|
4518
|
+
if (disablement?.reason === "hard" && disablement.lockedScope) {
|
|
4519
|
+
throw new runtime.WorkspaceSkillNotToggleableError(
|
|
4520
|
+
skillName,
|
|
4521
|
+
"locked",
|
|
4522
|
+
disablement.lockedScope
|
|
4523
|
+
);
|
|
4421
4524
|
}
|
|
4422
|
-
const workspaceDisabled =
|
|
4423
|
-
fresh
|
|
4525
|
+
const workspaceDisabled = skillSettingStrings(
|
|
4526
|
+
fresh,
|
|
4527
|
+
WORKSPACE_SETTING_SCOPE,
|
|
4528
|
+
"disabled"
|
|
4424
4529
|
);
|
|
4425
|
-
const
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
}
|
|
4442
|
-
changed = true;
|
|
4443
|
-
}
|
|
4530
|
+
const workspaceEnabled = skillSettingStrings(
|
|
4531
|
+
fresh,
|
|
4532
|
+
WORKSPACE_SETTING_SCOPE,
|
|
4533
|
+
"enabled"
|
|
4534
|
+
);
|
|
4535
|
+
const next = updateWorkspaceSkillSettingLists(
|
|
4536
|
+
{ disabled: workspaceDisabled, enabled: workspaceEnabled },
|
|
4537
|
+
skillName,
|
|
4538
|
+
enabled,
|
|
4539
|
+
resolved.defaultDisabledNames.has(normalizedName) && !resolved.enabledNames.has(normalizedName)
|
|
4540
|
+
);
|
|
4541
|
+
const settingsChanges = [];
|
|
4542
|
+
if (JSON.stringify(next.disabled) !== JSON.stringify(workspaceDisabled)) {
|
|
4543
|
+
settingsChanges.push({
|
|
4544
|
+
key: "skills.disabled",
|
|
4545
|
+
value: next.disabled.length > 0 ? next.disabled : void 0
|
|
4546
|
+
});
|
|
4444
4547
|
}
|
|
4445
|
-
if (
|
|
4446
|
-
|
|
4447
|
-
|
|
4548
|
+
if (JSON.stringify(next.enabled) !== JSON.stringify(workspaceEnabled)) {
|
|
4549
|
+
settingsChanges.push({
|
|
4550
|
+
key: "skills.enabled",
|
|
4551
|
+
value: next.enabled.length > 0 ? next.enabled : void 0
|
|
4552
|
+
});
|
|
4448
4553
|
}
|
|
4449
|
-
if (
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4554
|
+
if (settingsChanges.length === 0) {
|
|
4555
|
+
return { changed: false, disabled: workspaceDisabled };
|
|
4556
|
+
}
|
|
4557
|
+
assertGenerationOpen?.();
|
|
4558
|
+
fresh.setValues(
|
|
4559
|
+
settingsChanges.map((change) => ({
|
|
4560
|
+
scope: WORKSPACE_SETTING_SCOPE,
|
|
4561
|
+
...change
|
|
4562
|
+
})),
|
|
4563
|
+
void 0,
|
|
4564
|
+
assertGenerationOpen
|
|
4454
4565
|
);
|
|
4455
|
-
return {
|
|
4566
|
+
return {
|
|
4567
|
+
changed: true,
|
|
4568
|
+
disabled: next.disabled,
|
|
4569
|
+
settingsChanges
|
|
4570
|
+
};
|
|
4456
4571
|
}), "persistDisabledSkillsFn");
|
|
4457
|
-
const persistSettingFn = /* @__PURE__ */ __name((workspace, scope, key, value) => withSettingsLock(workspace, async () => {
|
|
4458
|
-
|
|
4459
|
-
fresh
|
|
4572
|
+
const persistSettingFn = /* @__PURE__ */ __name((workspace, scope, key, value, assertGenerationOpen) => withSettingsLock(workspace, async () => {
|
|
4573
|
+
assertGenerationOpen?.();
|
|
4574
|
+
const fresh = loadSettingsForPersistence(workspace);
|
|
4575
|
+
assertGenerationOpen?.();
|
|
4576
|
+
fresh.setValue(scope, key, value, assertGenerationOpen);
|
|
4460
4577
|
return fresh;
|
|
4461
4578
|
}), "persistSettingFn");
|
|
4462
|
-
const persistSettingsFn = /* @__PURE__ */ __name((workspace, writes) => withSettingsLock(workspace, async () => {
|
|
4463
|
-
|
|
4579
|
+
const persistSettingsFn = /* @__PURE__ */ __name((workspace, writes, assertGenerationOpen) => withSettingsLock(workspace, async () => {
|
|
4580
|
+
assertGenerationOpen?.();
|
|
4581
|
+
const fresh = loadSettingsForPersistence(workspace);
|
|
4464
4582
|
const writesByScope = /* @__PURE__ */ new Map();
|
|
4465
4583
|
for (const write of writes) {
|
|
4466
4584
|
writesByScope.set(
|
|
@@ -4471,10 +4589,15 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4471
4589
|
const committedScopes = /* @__PURE__ */ new Set();
|
|
4472
4590
|
let committed = 0;
|
|
4473
4591
|
try {
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4592
|
+
assertGenerationOpen?.();
|
|
4593
|
+
fresh.setValues(
|
|
4594
|
+
writes,
|
|
4595
|
+
(scope) => {
|
|
4596
|
+
committedScopes.add(scope);
|
|
4597
|
+
committed += writesByScope.get(scope) ?? 0;
|
|
4598
|
+
},
|
|
4599
|
+
assertGenerationOpen
|
|
4600
|
+
);
|
|
4478
4601
|
} catch (err) {
|
|
4479
4602
|
const failedWrite = writes.find((write) => !committedScopes.has(write.scope)) ?? writes[committed];
|
|
4480
4603
|
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)}`;
|
|
@@ -4486,7 +4609,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4486
4609
|
);
|
|
4487
4610
|
}
|
|
4488
4611
|
}), "persistSettingsFn");
|
|
4489
|
-
const { createSubSessionLauncher } = await import("./create-sub-session-
|
|
4612
|
+
const { createSubSessionLauncher } = await import("./create-sub-session-AEREHZBQ.js");
|
|
4490
4613
|
const subSessionLauncher = createSubSessionLauncher({
|
|
4491
4614
|
getBridge: /* @__PURE__ */ __name(() => bridgeRef, "getBridge"),
|
|
4492
4615
|
boundWorkspace
|
|
@@ -4505,10 +4628,17 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4505
4628
|
),
|
|
4506
4629
|
maxSessions: opts.maxSessions,
|
|
4507
4630
|
freshSessionAdmission: totalSessionAdmission.admit,
|
|
4508
|
-
sessionLifecycle:
|
|
4631
|
+
sessionLifecycle: /* @__PURE__ */ __name((event) => {
|
|
4632
|
+
if (event.type === "registered" && primaryGenerationGuard.closed) {
|
|
4633
|
+
return;
|
|
4634
|
+
}
|
|
4635
|
+
sessionOwnerIndex.handleBridgeSessionLifecycle(event);
|
|
4636
|
+
}, "sessionLifecycle"),
|
|
4509
4637
|
...opts.maxPendingPromptsPerSession !== void 0 ? { maxPendingPromptsPerSession: opts.maxPendingPromptsPerSession } : {},
|
|
4510
4638
|
...opts.eventRingSize !== void 0 ? { eventRingSize: opts.eventRingSize } : {},
|
|
4511
4639
|
...opts.compactedReplayMaxBytes !== void 0 ? { compactedReplayMaxBytes: opts.compactedReplayMaxBytes } : {},
|
|
4640
|
+
...opts.maxJournalEvents !== void 0 ? { maxJournalEvents: opts.maxJournalEvents } : {},
|
|
4641
|
+
...opts.maxJournalBytes !== void 0 ? { maxJournalBytes: opts.maxJournalBytes } : {},
|
|
4512
4642
|
...opts.channelIdleTimeoutMs !== void 0 ? { channelIdleTimeoutMs: opts.channelIdleTimeoutMs } : {},
|
|
4513
4643
|
...opts.initializeTimeoutMs !== void 0 ? { initializeTimeoutMs: opts.initializeTimeoutMs } : {},
|
|
4514
4644
|
...opts.sessionReapIntervalMs !== void 0 ? { sessionReapIntervalMs: opts.sessionReapIntervalMs } : {},
|
|
@@ -4526,8 +4656,23 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4526
4656
|
statusProvider,
|
|
4527
4657
|
fileSystem: createBridgeFileSystemAdapter(fsFactory),
|
|
4528
4658
|
persistApprovalMode: /* @__PURE__ */ __name((workspace, mode) => withSettingsLock(workspace, async () => {
|
|
4529
|
-
|
|
4530
|
-
|
|
4659
|
+
primaryGenerationGuard.assertOpen();
|
|
4660
|
+
if (!trustedWorkspace) {
|
|
4661
|
+
throw new Error(
|
|
4662
|
+
"Cannot persist approval mode for an untrusted workspace."
|
|
4663
|
+
);
|
|
4664
|
+
}
|
|
4665
|
+
const fresh = settingsRuntime.settings.loadSettings(workspace, {
|
|
4666
|
+
skipLoadEnvironment: true,
|
|
4667
|
+
workspaceTrusted: trustedWorkspace
|
|
4668
|
+
});
|
|
4669
|
+
primaryGenerationGuard.assertOpen();
|
|
4670
|
+
fresh.setValue(
|
|
4671
|
+
WORKSPACE_SETTING_SCOPE,
|
|
4672
|
+
"tools.approvalMode",
|
|
4673
|
+
mode,
|
|
4674
|
+
() => primaryGenerationGuard.assertOpen()
|
|
4675
|
+
);
|
|
4531
4676
|
}), "persistApprovalMode")
|
|
4532
4677
|
});
|
|
4533
4678
|
if (!deps.bridge) {
|
|
@@ -4539,6 +4684,8 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4539
4684
|
}, "invalidatePrimaryServeFeaturesCache");
|
|
4540
4685
|
const workspaceService = runtime.createDaemonWorkspaceService({
|
|
4541
4686
|
boundWorkspace,
|
|
4687
|
+
isWorkspaceTrusted: /* @__PURE__ */ __name(() => trustedWorkspace, "isWorkspaceTrusted"),
|
|
4688
|
+
assertGenerationOpen: /* @__PURE__ */ __name(() => primaryGenerationGuard.assertOpen(), "assertGenerationOpen"),
|
|
4542
4689
|
contextFilename: contextFilenameForInit ?? "QWEN.md",
|
|
4543
4690
|
statusProvider,
|
|
4544
4691
|
workspaceProvidersStatusProvider,
|
|
@@ -4551,13 +4698,18 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4551
4698
|
persistSetting: persistSettingFn,
|
|
4552
4699
|
persistSettings: persistSettingsFn,
|
|
4553
4700
|
preheatAcpChild: /* @__PURE__ */ __name(() => bridge.preheat(), "preheatAcpChild"),
|
|
4554
|
-
reloadDaemonEnv: /* @__PURE__ */ __name((workspace) => withSettingsLock(workspace, async () => {
|
|
4701
|
+
reloadDaemonEnv: /* @__PURE__ */ __name((workspace, assertGenerationOpen) => withSettingsLock(workspace, async () => {
|
|
4702
|
+
assertGenerationOpen?.();
|
|
4555
4703
|
const fresh = settingsRuntime.settings.loadSettings(workspace, {
|
|
4556
|
-
skipLoadEnvironment: true
|
|
4704
|
+
skipLoadEnvironment: true,
|
|
4705
|
+
skipWorkspaceSettings: !trustedWorkspace,
|
|
4706
|
+
workspaceTrusted: trustedWorkspace
|
|
4557
4707
|
});
|
|
4708
|
+
assertGenerationOpen?.();
|
|
4558
4709
|
const result = settingsRuntime.settings.reloadEnvironment(
|
|
4559
4710
|
fresh.merged,
|
|
4560
|
-
workspace
|
|
4711
|
+
workspace,
|
|
4712
|
+
trustedWorkspace
|
|
4561
4713
|
);
|
|
4562
4714
|
let refreshedRuntimeEnv;
|
|
4563
4715
|
let fallbackReason;
|
|
@@ -4565,7 +4717,8 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4565
4717
|
refreshedRuntimeEnv = settingsRuntime.environment.buildRuntimeEnvironment(
|
|
4566
4718
|
fresh.merged,
|
|
4567
4719
|
workspace,
|
|
4568
|
-
daemonRuntimeBaseEnv
|
|
4720
|
+
daemonRuntimeBaseEnv,
|
|
4721
|
+
trustedWorkspace
|
|
4569
4722
|
);
|
|
4570
4723
|
} catch (err) {
|
|
4571
4724
|
fallbackReason = err instanceof Error ? err.message : String(err);
|
|
@@ -4624,6 +4777,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4624
4777
|
{
|
|
4625
4778
|
workspaceId: daemonWorkspaceHash,
|
|
4626
4779
|
workspaceCwd: boundWorkspace,
|
|
4780
|
+
sessionRuntimeBaseDir: primarySessionRuntimeBaseDir,
|
|
4627
4781
|
...workspaceInputs[0]?.displayName ? { displayName: workspaceInputs[0].displayName } : {},
|
|
4628
4782
|
primary: true,
|
|
4629
4783
|
trusted: trustedWorkspace,
|
|
@@ -4633,14 +4787,17 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4633
4787
|
bridge,
|
|
4634
4788
|
workspaceService,
|
|
4635
4789
|
routeFileSystemFactory: routeFsFactory,
|
|
4636
|
-
clientMcpSenderRegistry
|
|
4790
|
+
clientMcpSenderRegistry,
|
|
4791
|
+
generationGuard: primaryGenerationGuard,
|
|
4792
|
+
trustMaterialization: primaryTrustMaterialization
|
|
4637
4793
|
}
|
|
4638
4794
|
];
|
|
4639
|
-
const createRuntimeEnvMetadata = /* @__PURE__ */ __name((workspace, settings) => {
|
|
4795
|
+
const createRuntimeEnvMetadata = /* @__PURE__ */ __name((workspace, settings, trusted) => {
|
|
4640
4796
|
const snapshot = settings ? settingsRuntime.environment.buildRuntimeEnvironment(
|
|
4641
4797
|
settings.merged,
|
|
4642
4798
|
workspace,
|
|
4643
|
-
daemonRuntimeBaseEnv
|
|
4799
|
+
daemonRuntimeBaseEnv,
|
|
4800
|
+
trusted
|
|
4644
4801
|
) : {
|
|
4645
4802
|
effectiveEnv: { ...daemonRuntimeBaseEnv },
|
|
4646
4803
|
overlayKeys: Object.freeze([]),
|
|
@@ -4649,7 +4806,15 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4649
4806
|
envFileReadFailures: Object.freeze([])
|
|
4650
4807
|
};
|
|
4651
4808
|
logRuntimeEnvFileReadFailures(workspace, snapshot);
|
|
4652
|
-
const
|
|
4809
|
+
const sessionRuntimeBaseDir = resolveSessionRuntimeBaseDir(
|
|
4810
|
+
workspace,
|
|
4811
|
+
settings,
|
|
4812
|
+
snapshot.effectiveEnv
|
|
4813
|
+
);
|
|
4814
|
+
const effectiveEnv = {
|
|
4815
|
+
...snapshot.effectiveEnv,
|
|
4816
|
+
QWEN_RUNTIME_DIR: sessionRuntimeBaseDir
|
|
4817
|
+
};
|
|
4653
4818
|
const metadata = {
|
|
4654
4819
|
mode: "runtime-overlay",
|
|
4655
4820
|
overlayKeys: [...snapshot.overlayKeys],
|
|
@@ -4661,36 +4826,44 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4661
4826
|
return {
|
|
4662
4827
|
metadata,
|
|
4663
4828
|
effectiveEnv,
|
|
4829
|
+
sessionRuntimeBaseDir,
|
|
4664
4830
|
replace(nextEnv) {
|
|
4665
4831
|
for (const key of Object.keys(effectiveEnv)) {
|
|
4666
4832
|
delete effectiveEnv[key];
|
|
4667
4833
|
}
|
|
4668
4834
|
Object.assign(effectiveEnv, nextEnv);
|
|
4835
|
+
effectiveEnv["QWEN_RUNTIME_DIR"] = sessionRuntimeBaseDir;
|
|
4669
4836
|
}
|
|
4670
4837
|
};
|
|
4671
4838
|
}, "createRuntimeEnvMetadata");
|
|
4672
4839
|
const subSessionStoppers = [];
|
|
4673
|
-
const
|
|
4840
|
+
const subSessionStoppersByRuntime = /* @__PURE__ */ new WeakMap();
|
|
4674
4841
|
const runtimeCleanupPromises = /* @__PURE__ */ new WeakMap();
|
|
4675
4842
|
const removeArrayValue = /* @__PURE__ */ __name((values, value) => {
|
|
4676
4843
|
const index = values.indexOf(value);
|
|
4677
4844
|
if (index >= 0) values.splice(index, 1);
|
|
4678
4845
|
}, "removeArrayValue");
|
|
4679
4846
|
for (const workspaceInput of workspaceInputs.slice(1)) {
|
|
4847
|
+
const secondaryDecision = trustPolicy.evaluateDaemonWorkspaceTrust(
|
|
4848
|
+
bootTrustSnapshot,
|
|
4849
|
+
workspaceInput.cwd
|
|
4850
|
+
);
|
|
4851
|
+
const secondaryTrusted = secondaryDecision.targetTrusted;
|
|
4680
4852
|
let secondarySettings;
|
|
4681
4853
|
try {
|
|
4682
4854
|
secondarySettings = settingsRuntime.settings.loadSettings(
|
|
4683
|
-
workspaceInput.cwd
|
|
4855
|
+
workspaceInput.cwd,
|
|
4856
|
+
{
|
|
4857
|
+
skipLoadEnvironment: true,
|
|
4858
|
+
skipWorkspaceSettings: !secondaryTrusted,
|
|
4859
|
+
workspaceTrusted: secondaryTrusted
|
|
4860
|
+
}
|
|
4684
4861
|
);
|
|
4685
4862
|
} catch (err) {
|
|
4686
4863
|
writeStderrLine(
|
|
4687
4864
|
`qwen serve: could not read full settings for secondary workspace ${workspaceInput.cwd} (${err instanceof Error ? err.message : String(err)}); falling back to defaults.`
|
|
4688
4865
|
);
|
|
4689
4866
|
}
|
|
4690
|
-
const secondaryTrusted = secondarySettings ? settingsRuntime.trustedFolders.getWorkspaceTrustStatus(
|
|
4691
|
-
secondarySettings.merged,
|
|
4692
|
-
workspaceInput.cwd
|
|
4693
|
-
).effective.state === "trusted" : false;
|
|
4694
4867
|
if (!secondaryTrusted) {
|
|
4695
4868
|
daemonLog.warn("secondary workspace is not trusted", {
|
|
4696
4869
|
workspace: workspaceInput.cwd,
|
|
@@ -4699,11 +4872,15 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4699
4872
|
}
|
|
4700
4873
|
const secondaryEnv = createRuntimeEnvMetadata(
|
|
4701
4874
|
workspaceInput.cwd,
|
|
4702
|
-
secondarySettings
|
|
4875
|
+
secondarySettings,
|
|
4876
|
+
secondaryTrusted
|
|
4703
4877
|
);
|
|
4878
|
+
const secondaryCustomIgnoreFiles = secondarySettings?.merged.context?.fileFiltering?.customIgnoreFiles;
|
|
4879
|
+
const secondaryContextFilename = extractContextFilename(secondarySettings?.merged.context?.fileName) ?? contextFilenameForInit ?? "QWEN.md";
|
|
4704
4880
|
const secondaryWorkspaceHash = core.hashDaemonWorkspace(
|
|
4705
4881
|
workspaceInput.cwd
|
|
4706
4882
|
);
|
|
4883
|
+
const secondaryGenerationGuard = runtime.createWorkspaceGenerationGuard();
|
|
4707
4884
|
const secondaryStatusProvider = runtime.createDaemonStatusProvider({
|
|
4708
4885
|
env: secondaryEnv.effectiveEnv
|
|
4709
4886
|
});
|
|
@@ -4712,9 +4889,11 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4712
4889
|
trusted: secondaryTrusted,
|
|
4713
4890
|
emit: deps.fsAuditEmit,
|
|
4714
4891
|
pathLocks: sharedPathLocks,
|
|
4715
|
-
|
|
4892
|
+
generationGuard: secondaryGenerationGuard,
|
|
4893
|
+
...secondaryCustomIgnoreFiles !== void 0 ? { customIgnoreFiles: secondaryCustomIgnoreFiles } : {}
|
|
4716
4894
|
});
|
|
4717
4895
|
const secondaryChannelFactory = runtime.createSpawnChannelFactory({
|
|
4896
|
+
processRegistry,
|
|
4718
4897
|
sourceEnv: secondaryEnv.effectiveEnv,
|
|
4719
4898
|
onDiagnosticLine: diagnosticSink,
|
|
4720
4899
|
pipeHooks: {
|
|
@@ -4746,10 +4925,17 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4746
4925
|
),
|
|
4747
4926
|
maxSessions: opts.maxSessions,
|
|
4748
4927
|
freshSessionAdmission: totalSessionAdmission.admit,
|
|
4749
|
-
sessionLifecycle:
|
|
4928
|
+
sessionLifecycle: /* @__PURE__ */ __name((event) => {
|
|
4929
|
+
if (event.type === "registered" && secondaryGenerationGuard.closed) {
|
|
4930
|
+
return;
|
|
4931
|
+
}
|
|
4932
|
+
sessionOwnerIndex.handleBridgeSessionLifecycle(event);
|
|
4933
|
+
}, "sessionLifecycle"),
|
|
4750
4934
|
...opts.maxPendingPromptsPerSession !== void 0 ? { maxPendingPromptsPerSession: opts.maxPendingPromptsPerSession } : {},
|
|
4751
4935
|
...opts.eventRingSize !== void 0 ? { eventRingSize: opts.eventRingSize } : {},
|
|
4752
4936
|
...opts.compactedReplayMaxBytes !== void 0 ? { compactedReplayMaxBytes: opts.compactedReplayMaxBytes } : {},
|
|
4937
|
+
...opts.maxJournalEvents !== void 0 ? { maxJournalEvents: opts.maxJournalEvents } : {},
|
|
4938
|
+
...opts.maxJournalBytes !== void 0 ? { maxJournalBytes: opts.maxJournalBytes } : {},
|
|
4753
4939
|
...opts.channelIdleTimeoutMs !== void 0 ? { channelIdleTimeoutMs: opts.channelIdleTimeoutMs } : {},
|
|
4754
4940
|
...opts.initializeTimeoutMs !== void 0 ? { initializeTimeoutMs: opts.initializeTimeoutMs } : {},
|
|
4755
4941
|
...opts.sessionReapIntervalMs !== void 0 ? { sessionReapIntervalMs: opts.sessionReapIntervalMs } : {},
|
|
@@ -4769,26 +4955,42 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4769
4955
|
statusProvider: secondaryStatusProvider,
|
|
4770
4956
|
fileSystem: createBridgeFileSystemAdapter(secondaryBridgeFsFactory),
|
|
4771
4957
|
persistApprovalMode: /* @__PURE__ */ __name((workspace, mode) => withSettingsLock(workspace, async () => {
|
|
4772
|
-
|
|
4773
|
-
|
|
4958
|
+
secondaryGenerationGuard.assertOpen();
|
|
4959
|
+
if (!secondaryTrusted) {
|
|
4960
|
+
throw new Error(
|
|
4961
|
+
"Cannot persist approval mode for an untrusted workspace."
|
|
4962
|
+
);
|
|
4963
|
+
}
|
|
4964
|
+
const fresh = settingsRuntime.settings.loadSettings(workspace, {
|
|
4965
|
+
skipLoadEnvironment: true,
|
|
4966
|
+
workspaceTrusted: secondaryTrusted
|
|
4967
|
+
});
|
|
4968
|
+
secondaryGenerationGuard.assertOpen();
|
|
4969
|
+
fresh.setValue(
|
|
4970
|
+
WORKSPACE_SETTING_SCOPE,
|
|
4971
|
+
"tools.approvalMode",
|
|
4972
|
+
mode,
|
|
4973
|
+
() => secondaryGenerationGuard.assertOpen()
|
|
4974
|
+
);
|
|
4774
4975
|
}), "persistApprovalMode")
|
|
4775
4976
|
});
|
|
4776
4977
|
secondaryBridgeRef = secondaryBridge;
|
|
4777
4978
|
runtimeBridges.push(secondaryBridge);
|
|
4778
4979
|
internalRuntimeBridgesForCleanup.push(secondaryBridge);
|
|
4779
4980
|
subSessionStoppers.push(secondarySubSessionLauncher.stop);
|
|
4780
|
-
subSessionStoppersByWorkspace.set(
|
|
4781
|
-
workspaceInput.cwd,
|
|
4782
|
-
secondarySubSessionLauncher.stop
|
|
4783
|
-
);
|
|
4784
4981
|
const secondaryWorkspaceService = runtime.createDaemonWorkspaceService({
|
|
4785
4982
|
boundWorkspace: workspaceInput.cwd,
|
|
4786
|
-
|
|
4983
|
+
isWorkspaceTrusted: /* @__PURE__ */ __name(() => secondaryTrusted, "isWorkspaceTrusted"),
|
|
4984
|
+
assertGenerationOpen: /* @__PURE__ */ __name(() => secondaryGenerationGuard.assertOpen(), "assertGenerationOpen"),
|
|
4985
|
+
contextFilename: secondaryContextFilename,
|
|
4787
4986
|
statusProvider: secondaryStatusProvider,
|
|
4788
4987
|
workspaceProvidersStatusProvider: runtime.createWorkspaceProvidersStatusProvider({
|
|
4789
|
-
env: secondaryEnv.effectiveEnv
|
|
4988
|
+
env: secondaryEnv.effectiveEnv,
|
|
4989
|
+
workspaceTrusted: secondaryTrusted
|
|
4990
|
+
}),
|
|
4991
|
+
workspaceSkillsStatusProvider: runtime.createWorkspaceSkillsStatusProvider({
|
|
4992
|
+
workspaceTrusted: secondaryTrusted
|
|
4790
4993
|
}),
|
|
4791
|
-
workspaceSkillsStatusProvider: runtime.createWorkspaceSkillsStatusProvider(),
|
|
4792
4994
|
skillInstallEnv: secondaryEnv.effectiveEnv,
|
|
4793
4995
|
voiceEnv: secondaryEnv.effectiveEnv,
|
|
4794
4996
|
voiceSettingsScope: WORKSPACE_SETTING_SCOPE,
|
|
@@ -4798,19 +5000,25 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4798
5000
|
persistDisabledSkills: persistDisabledSkillsFn,
|
|
4799
5001
|
persistSetting: persistSettingFn,
|
|
4800
5002
|
persistSettings: persistSettingsFn,
|
|
4801
|
-
reloadDaemonEnv: /* @__PURE__ */ __name((workspace) => withSettingsLock(workspace, async () => {
|
|
5003
|
+
reloadDaemonEnv: /* @__PURE__ */ __name((workspace, assertGenerationOpen) => withSettingsLock(workspace, async () => {
|
|
5004
|
+
assertGenerationOpen?.();
|
|
4802
5005
|
const fresh = settingsRuntime.settings.loadSettings(workspace, {
|
|
4803
|
-
skipLoadEnvironment: true
|
|
5006
|
+
skipLoadEnvironment: true,
|
|
5007
|
+
skipWorkspaceSettings: !secondaryTrusted,
|
|
5008
|
+
workspaceTrusted: secondaryTrusted
|
|
4804
5009
|
});
|
|
5010
|
+
assertGenerationOpen?.();
|
|
4805
5011
|
const result = settingsRuntime.settings.reloadEnvironment(
|
|
4806
5012
|
fresh.merged,
|
|
4807
|
-
workspace
|
|
5013
|
+
workspace,
|
|
5014
|
+
secondaryTrusted
|
|
4808
5015
|
);
|
|
4809
5016
|
try {
|
|
4810
5017
|
const refreshedRuntimeEnv = settingsRuntime.environment.buildRuntimeEnvironment(
|
|
4811
5018
|
fresh.merged,
|
|
4812
5019
|
workspace,
|
|
4813
|
-
daemonRuntimeBaseEnv
|
|
5020
|
+
daemonRuntimeBaseEnv,
|
|
5021
|
+
secondaryTrusted
|
|
4814
5022
|
);
|
|
4815
5023
|
logRuntimeEnvFileReadFailures(workspace, refreshedRuntimeEnv);
|
|
4816
5024
|
secondaryEnv.replace(refreshedRuntimeEnv.effectiveEnv);
|
|
@@ -4848,9 +5056,10 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4848
5056
|
refreshExtensionsForAllSessions: /* @__PURE__ */ __name(() => secondaryBridge.refreshExtensionsForAllSessions(), "refreshExtensionsForAllSessions"),
|
|
4849
5057
|
publishWorkspaceEvent: /* @__PURE__ */ __name((event) => secondaryBridge.publishWorkspaceEvent(event), "publishWorkspaceEvent")
|
|
4850
5058
|
});
|
|
4851
|
-
|
|
5059
|
+
const secondaryRuntime = {
|
|
4852
5060
|
workspaceId: secondaryWorkspaceHash,
|
|
4853
5061
|
workspaceCwd: workspaceInput.cwd,
|
|
5062
|
+
sessionRuntimeBaseDir: secondaryEnv.sessionRuntimeBaseDir,
|
|
4854
5063
|
...workspaceInput.displayName ? { displayName: workspaceInput.displayName } : {},
|
|
4855
5064
|
primary: false,
|
|
4856
5065
|
trusted: secondaryTrusted,
|
|
@@ -4860,12 +5069,24 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4860
5069
|
bridge: secondaryBridge,
|
|
4861
5070
|
workspaceService: secondaryWorkspaceService,
|
|
4862
5071
|
routeFileSystemFactory: secondaryBridgeFsFactory,
|
|
4863
|
-
clientMcpSenderRegistry: secondaryClientMcpSenderRegistry
|
|
4864
|
-
|
|
5072
|
+
clientMcpSenderRegistry: secondaryClientMcpSenderRegistry,
|
|
5073
|
+
generationGuard: secondaryGenerationGuard,
|
|
5074
|
+
trustMaterialization: JSON.stringify({
|
|
5075
|
+
trusted: secondaryTrusted,
|
|
5076
|
+
boundWorkspaces: [workspaceInput.cwd]
|
|
5077
|
+
})
|
|
5078
|
+
};
|
|
5079
|
+
subSessionStoppersByRuntime.set(
|
|
5080
|
+
secondaryRuntime,
|
|
5081
|
+
secondarySubSessionLauncher.stop
|
|
5082
|
+
);
|
|
5083
|
+
workspaceRuntimes.push(secondaryRuntime);
|
|
4865
5084
|
}
|
|
4866
5085
|
const workspaceRegistry = runtime.createWorkspaceRegistry(workspaceRuntimes, {
|
|
4867
|
-
sessionOwnerIndex
|
|
5086
|
+
sessionOwnerIndex,
|
|
5087
|
+
scanUnindexedOwners: deps.bridge !== void 0
|
|
4868
5088
|
});
|
|
5089
|
+
workspaceRegistryForPersistence.current = workspaceRegistry;
|
|
4869
5090
|
const workspaceVoiceCoordinator = new WorkspaceVoiceCoordinator();
|
|
4870
5091
|
core.registerDaemonGaugeCallbacks({
|
|
4871
5092
|
sessionCount: /* @__PURE__ */ __name(() => workspaceRegistry.list().reduce((sum, item) => sum + item.bridge.sessionCount, 0), "sessionCount"),
|
|
@@ -4900,9 +5121,15 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4900
5121
|
const rejectedTotal = hits ? hits.prompt + hits.mutation + hits.read : 0;
|
|
4901
5122
|
const rateLimitRejected = prevRateRejected === void 0 ? 0 : Math.max(0, rejectedTotal - prevRateRejected);
|
|
4902
5123
|
prevRateRejected = rejectedTotal;
|
|
4903
|
-
const
|
|
5124
|
+
const primaryEntry = workspaceRegistry.primaryEntry;
|
|
5125
|
+
const primaryRuntimeBridge = primaryEntry.state === "active" ? primaryEntry.current?.runtime.bridge : void 0;
|
|
5126
|
+
const child = primaryRuntimeBridge?.getChildResourceSnapshot?.();
|
|
4904
5127
|
if (runtime.getActiveSseCount() > 0 || (acp?.wsStreams ?? 0) > 0) {
|
|
4905
|
-
void
|
|
5128
|
+
void primaryRuntimeBridge?.refreshChildResource?.().catch((err) => {
|
|
5129
|
+
daemonLog.warn(
|
|
5130
|
+
`ACP child resource refresh failed: ${err instanceof Error ? err.message : String(err)}`
|
|
5131
|
+
);
|
|
5132
|
+
});
|
|
4906
5133
|
}
|
|
4907
5134
|
metricsRing.sample(nowMs, {
|
|
4908
5135
|
cpuPercent,
|
|
@@ -4958,34 +5185,52 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
4958
5185
|
metricsLoopDelay.disable();
|
|
4959
5186
|
}
|
|
4960
5187
|
};
|
|
4961
|
-
const createDynamicWorkspaceRuntime = /* @__PURE__ */ __name(async (cwd,
|
|
4962
|
-
|
|
5188
|
+
const createDynamicWorkspaceRuntime = /* @__PURE__ */ __name(async (cwd, buildOptions) => {
|
|
5189
|
+
const provenance = buildOptions?.provenance ?? "existing";
|
|
5190
|
+
if (provenance === "managed-scratch" && (!managedScratchRoot || !isManagedScratchChild(cwd, managedScratchRoot.canonicalRoot))) {
|
|
4963
5191
|
throw new Error(
|
|
4964
5192
|
"Managed scratch runtime must use an accepted direct child directory"
|
|
4965
5193
|
);
|
|
4966
5194
|
}
|
|
5195
|
+
const snapshot = buildOptions?.snapshot ?? await trustPolicy.readDaemonTrustPolicySnapshot();
|
|
5196
|
+
const decision = buildOptions?.decision ?? trustPolicy.evaluateDaemonWorkspaceTrust(snapshot, cwd);
|
|
5197
|
+
const trusted = provenance === "managed-scratch" ? true : buildOptions?.trusted ?? decision.targetTrusted;
|
|
4967
5198
|
let wsSettings;
|
|
4968
5199
|
try {
|
|
4969
|
-
wsSettings = settingsRuntime.settings.loadSettings(cwd
|
|
5200
|
+
wsSettings = settingsRuntime.settings.loadSettings(cwd, {
|
|
5201
|
+
skipLoadEnvironment: true,
|
|
5202
|
+
skipWorkspaceSettings: !trusted,
|
|
5203
|
+
workspaceTrusted: trusted
|
|
5204
|
+
});
|
|
4970
5205
|
} catch (err) {
|
|
4971
5206
|
writeStderrLine(
|
|
4972
5207
|
`qwen serve: could not read full settings for dynamic workspace ${cwd} (${err instanceof Error ? err.message : String(err)}); falling back to defaults.`
|
|
4973
5208
|
);
|
|
4974
5209
|
}
|
|
4975
|
-
const
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
).effective.state === "trusted" : false);
|
|
4979
|
-
const wsEnv = createRuntimeEnvMetadata(cwd, wsSettings);
|
|
5210
|
+
const wsEnv = createRuntimeEnvMetadata(cwd, wsSettings, trusted);
|
|
5211
|
+
const wsCustomIgnoreFiles = wsSettings?.merged.context?.fileFiltering?.customIgnoreFiles;
|
|
5212
|
+
const wsContextFilename = extractContextFilename(wsSettings?.merged.context?.fileName) ?? contextFilenameForInit ?? "QWEN.md";
|
|
4980
5213
|
const wsHash = core.hashDaemonWorkspace(cwd);
|
|
5214
|
+
const generationGuard = buildOptions?.generationGuard ?? runtime.createWorkspaceGenerationGuard();
|
|
5215
|
+
const runtimeBoundWorkspaces = buildOptions?.boundWorkspaces ?? [cwd];
|
|
4981
5216
|
const wsFsFactory = runtime.resolveBridgeFsFactory({
|
|
4982
|
-
boundWorkspaces:
|
|
5217
|
+
boundWorkspaces: runtimeBoundWorkspaces,
|
|
4983
5218
|
trusted,
|
|
4984
5219
|
emit: deps.fsAuditEmit,
|
|
4985
5220
|
pathLocks: sharedPathLocks,
|
|
4986
|
-
|
|
5221
|
+
generationGuard,
|
|
5222
|
+
...wsCustomIgnoreFiles !== void 0 ? { customIgnoreFiles: wsCustomIgnoreFiles } : {}
|
|
4987
5223
|
});
|
|
5224
|
+
const wsRouteFsFactory = buildOptions?.primary === true && runtimeBoundWorkspaces.length > 1 ? runtime.resolveBridgeFsFactory({
|
|
5225
|
+
boundWorkspaces: [cwd],
|
|
5226
|
+
trusted,
|
|
5227
|
+
emit: deps.fsAuditEmit,
|
|
5228
|
+
pathLocks: sharedPathLocks,
|
|
5229
|
+
generationGuard,
|
|
5230
|
+
...wsCustomIgnoreFiles !== void 0 ? { customIgnoreFiles: wsCustomIgnoreFiles } : {}
|
|
5231
|
+
}) : wsFsFactory;
|
|
4988
5232
|
const wsChannelFactory = runtime.createSpawnChannelFactory({
|
|
5233
|
+
processRegistry,
|
|
4989
5234
|
sourceEnv: wsEnv.effectiveEnv,
|
|
4990
5235
|
onDiagnosticLine: diagnosticSink,
|
|
4991
5236
|
pipeHooks: {
|
|
@@ -5019,10 +5264,15 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5019
5264
|
),
|
|
5020
5265
|
maxSessions: opts.maxSessions,
|
|
5021
5266
|
freshSessionAdmission: totalSessionAdmission.admit,
|
|
5022
|
-
sessionLifecycle:
|
|
5267
|
+
sessionLifecycle: /* @__PURE__ */ __name((event) => {
|
|
5268
|
+
if (event.type === "registered" && generationGuard.closed) return;
|
|
5269
|
+
sessionOwnerIndex.handleBridgeSessionLifecycle(event);
|
|
5270
|
+
}, "sessionLifecycle"),
|
|
5023
5271
|
...opts.maxPendingPromptsPerSession !== void 0 ? { maxPendingPromptsPerSession: opts.maxPendingPromptsPerSession } : {},
|
|
5024
5272
|
...opts.eventRingSize !== void 0 ? { eventRingSize: opts.eventRingSize } : {},
|
|
5025
5273
|
...opts.compactedReplayMaxBytes !== void 0 ? { compactedReplayMaxBytes: opts.compactedReplayMaxBytes } : {},
|
|
5274
|
+
...opts.maxJournalEvents !== void 0 ? { maxJournalEvents: opts.maxJournalEvents } : {},
|
|
5275
|
+
...opts.maxJournalBytes !== void 0 ? { maxJournalBytes: opts.maxJournalBytes } : {},
|
|
5026
5276
|
...opts.channelIdleTimeoutMs !== void 0 ? { channelIdleTimeoutMs: opts.channelIdleTimeoutMs } : {},
|
|
5027
5277
|
...opts.initializeTimeoutMs !== void 0 ? { initializeTimeoutMs: opts.initializeTimeoutMs } : {},
|
|
5028
5278
|
...opts.sessionReapIntervalMs !== void 0 ? { sessionReapIntervalMs: opts.sessionReapIntervalMs } : {},
|
|
@@ -5035,18 +5285,31 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5035
5285
|
onDiagnosticLine: diagnosticSink,
|
|
5036
5286
|
telemetry: createRuntimeBridgeTelemetry(wsHash),
|
|
5037
5287
|
...permissionPolicy !== void 0 ? { permissionPolicy } : {},
|
|
5038
|
-
...permissionConsensusQuorum !== void 0 ? {
|
|
5288
|
+
...permissionConsensusQuorum !== void 0 ? {
|
|
5289
|
+
permissionConsensusQuorum
|
|
5290
|
+
} : {},
|
|
5039
5291
|
permissionAudit: permissionAuditPublisher,
|
|
5040
5292
|
statusProvider: runtime.createDaemonStatusProvider({
|
|
5041
5293
|
env: wsEnv.effectiveEnv
|
|
5042
5294
|
}),
|
|
5043
5295
|
fileSystem: createBridgeFileSystemAdapter(wsFsFactory),
|
|
5044
5296
|
persistApprovalMode: /* @__PURE__ */ __name((workspace, mode) => withSettingsLock(workspace, async () => {
|
|
5045
|
-
|
|
5297
|
+
generationGuard.assertOpen();
|
|
5298
|
+
if (!trusted) {
|
|
5299
|
+
throw new Error(
|
|
5300
|
+
"Cannot persist approval mode for an untrusted workspace."
|
|
5301
|
+
);
|
|
5302
|
+
}
|
|
5303
|
+
const fresh = settingsRuntime.settings.loadSettings(workspace, {
|
|
5304
|
+
skipLoadEnvironment: true,
|
|
5305
|
+
workspaceTrusted: trusted
|
|
5306
|
+
});
|
|
5307
|
+
generationGuard.assertOpen();
|
|
5046
5308
|
fresh.setValue(
|
|
5047
5309
|
WORKSPACE_SETTING_SCOPE,
|
|
5048
5310
|
"tools.approvalMode",
|
|
5049
|
-
mode
|
|
5311
|
+
mode,
|
|
5312
|
+
() => generationGuard.assertOpen()
|
|
5050
5313
|
);
|
|
5051
5314
|
}), "persistApprovalMode")
|
|
5052
5315
|
});
|
|
@@ -5059,36 +5322,47 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5059
5322
|
try {
|
|
5060
5323
|
wsService = runtime.createDaemonWorkspaceService({
|
|
5061
5324
|
boundWorkspace: cwd,
|
|
5062
|
-
|
|
5325
|
+
isWorkspaceTrusted: /* @__PURE__ */ __name(() => trusted, "isWorkspaceTrusted"),
|
|
5326
|
+
assertGenerationOpen: /* @__PURE__ */ __name(() => generationGuard.assertOpen(), "assertGenerationOpen"),
|
|
5327
|
+
contextFilename: wsContextFilename,
|
|
5063
5328
|
statusProvider: runtime.createDaemonStatusProvider({
|
|
5064
5329
|
env: wsEnv.effectiveEnv
|
|
5065
5330
|
}),
|
|
5066
5331
|
workspaceProvidersStatusProvider: runtime.createWorkspaceProvidersStatusProvider({
|
|
5067
|
-
env: wsEnv.effectiveEnv
|
|
5332
|
+
env: wsEnv.effectiveEnv,
|
|
5333
|
+
workspaceTrusted: trusted
|
|
5334
|
+
}),
|
|
5335
|
+
workspaceSkillsStatusProvider: runtime.createWorkspaceSkillsStatusProvider({
|
|
5336
|
+
workspaceTrusted: trusted
|
|
5068
5337
|
}),
|
|
5069
|
-
workspaceSkillsStatusProvider: runtime.createWorkspaceSkillsStatusProvider(),
|
|
5070
5338
|
skillInstallEnv: wsEnv.effectiveEnv,
|
|
5071
5339
|
voiceEnv: wsEnv.effectiveEnv,
|
|
5072
|
-
voiceSettingsScope: WORKSPACE_SETTING_SCOPE,
|
|
5340
|
+
...buildOptions?.primary === true ? {} : { voiceSettingsScope: WORKSPACE_SETTING_SCOPE },
|
|
5073
5341
|
isChannelLive: /* @__PURE__ */ __name(() => wsBridge.isChannelLive(), "isChannelLive"),
|
|
5074
5342
|
preheatAcpChild: /* @__PURE__ */ __name(() => wsBridge.preheat(), "preheatAcpChild"),
|
|
5075
5343
|
persistDisabledTools: persistDisabledToolsFn,
|
|
5076
5344
|
persistDisabledSkills: persistDisabledSkillsFn,
|
|
5077
5345
|
persistSetting: persistSettingFn,
|
|
5078
5346
|
persistSettings: persistSettingsFn,
|
|
5079
|
-
reloadDaemonEnv: /* @__PURE__ */ __name((workspace) => withSettingsLock(workspace, async () => {
|
|
5347
|
+
reloadDaemonEnv: /* @__PURE__ */ __name((workspace, assertGenerationOpen) => withSettingsLock(workspace, async () => {
|
|
5348
|
+
assertGenerationOpen?.();
|
|
5080
5349
|
const fresh = settingsRuntime.settings.loadSettings(workspace, {
|
|
5081
|
-
skipLoadEnvironment: true
|
|
5350
|
+
skipLoadEnvironment: true,
|
|
5351
|
+
skipWorkspaceSettings: !trusted,
|
|
5352
|
+
workspaceTrusted: trusted
|
|
5082
5353
|
});
|
|
5354
|
+
assertGenerationOpen?.();
|
|
5083
5355
|
const result = settingsRuntime.settings.reloadEnvironment(
|
|
5084
5356
|
fresh.merged,
|
|
5085
|
-
workspace
|
|
5357
|
+
workspace,
|
|
5358
|
+
trusted
|
|
5086
5359
|
);
|
|
5087
5360
|
try {
|
|
5088
5361
|
const refreshedRuntimeEnv = settingsRuntime.environment.buildRuntimeEnvironment(
|
|
5089
5362
|
fresh.merged,
|
|
5090
5363
|
workspace,
|
|
5091
|
-
daemonRuntimeBaseEnv
|
|
5364
|
+
daemonRuntimeBaseEnv,
|
|
5365
|
+
trusted
|
|
5092
5366
|
);
|
|
5093
5367
|
logRuntimeEnvFileReadFailures(workspace, refreshedRuntimeEnv);
|
|
5094
5368
|
wsEnv.replace(refreshedRuntimeEnv.effectiveEnv);
|
|
@@ -5124,7 +5398,12 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5124
5398
|
queryWorkspaceStatus: /* @__PURE__ */ __name((method, idle) => wsBridge.queryWorkspaceStatus(method, idle), "queryWorkspaceStatus"),
|
|
5125
5399
|
invokeWorkspaceCommand: /* @__PURE__ */ __name((method, params, invokeOpts) => wsBridge.invokeWorkspaceCommand(method, params, invokeOpts), "invokeWorkspaceCommand"),
|
|
5126
5400
|
refreshExtensionsForAllSessions: /* @__PURE__ */ __name(() => wsBridge.refreshExtensionsForAllSessions(), "refreshExtensionsForAllSessions"),
|
|
5127
|
-
publishWorkspaceEvent: /* @__PURE__ */ __name((event) =>
|
|
5401
|
+
publishWorkspaceEvent: /* @__PURE__ */ __name((event) => {
|
|
5402
|
+
if (buildOptions?.primary === true && (event.type === "settings_changed" || event.type === "settings_reloaded")) {
|
|
5403
|
+
invalidatePrimaryServeFeaturesCache();
|
|
5404
|
+
}
|
|
5405
|
+
wsBridge.publishWorkspaceEvent(event);
|
|
5406
|
+
}, "publishWorkspaceEvent")
|
|
5128
5407
|
});
|
|
5129
5408
|
} catch (err) {
|
|
5130
5409
|
wsSubSessionLauncher.stop();
|
|
@@ -5139,31 +5418,76 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5139
5418
|
runtimeBridges.push(wsBridge);
|
|
5140
5419
|
internalRuntimeBridgesForCleanup.push(wsBridge);
|
|
5141
5420
|
subSessionStoppers.push(wsSubSessionLauncher.stop);
|
|
5142
|
-
|
|
5143
|
-
return {
|
|
5421
|
+
const wsRuntime = {
|
|
5144
5422
|
workspaceId: wsHash,
|
|
5145
5423
|
workspaceCwd: cwd,
|
|
5146
|
-
|
|
5424
|
+
sessionRuntimeBaseDir: wsEnv.sessionRuntimeBaseDir,
|
|
5425
|
+
...buildOptions?.displayName !== void 0 ? { displayName: buildOptions.displayName } : {},
|
|
5426
|
+
primary: buildOptions?.primary ?? false,
|
|
5147
5427
|
trusted,
|
|
5148
|
-
|
|
5149
|
-
|
|
5428
|
+
provenance,
|
|
5429
|
+
removable: buildOptions?.removable ?? true,
|
|
5430
|
+
registrationIds: [...buildOptions?.registrationIds ?? []],
|
|
5150
5431
|
env: wsEnv.metadata,
|
|
5151
5432
|
bridge: wsBridge,
|
|
5152
5433
|
workspaceService: wsService,
|
|
5153
|
-
routeFileSystemFactory:
|
|
5154
|
-
clientMcpSenderRegistry: wsClientMcpRegistry
|
|
5434
|
+
routeFileSystemFactory: wsRouteFsFactory,
|
|
5435
|
+
clientMcpSenderRegistry: wsClientMcpRegistry,
|
|
5436
|
+
generationGuard,
|
|
5437
|
+
trustMaterialization: buildOptions?.trustMaterialization ?? JSON.stringify({
|
|
5438
|
+
trusted,
|
|
5439
|
+
boundWorkspaces: [...runtimeBoundWorkspaces].sort()
|
|
5440
|
+
})
|
|
5155
5441
|
};
|
|
5442
|
+
subSessionStoppersByRuntime.set(wsRuntime, wsSubSessionLauncher.stop);
|
|
5443
|
+
if (provenance !== "managed-scratch" && !buildOptions?.snapshot) {
|
|
5444
|
+
const latest = await trustPolicy.readDaemonTrustPolicySnapshot();
|
|
5445
|
+
if (latest.revision !== snapshot.revision) {
|
|
5446
|
+
generationGuard.close();
|
|
5447
|
+
wsSubSessionLauncher.stop();
|
|
5448
|
+
await wsBridge.shutdown({ reason: "trust_reconfigured" }).catch(() => {
|
|
5449
|
+
try {
|
|
5450
|
+
wsBridge.killAllSync();
|
|
5451
|
+
} catch {
|
|
5452
|
+
}
|
|
5453
|
+
});
|
|
5454
|
+
subSessionStoppersByRuntime.delete(wsRuntime);
|
|
5455
|
+
removeArrayValue(subSessionStoppers, wsSubSessionLauncher.stop);
|
|
5456
|
+
removeArrayValue(runtimeBridges, wsBridge);
|
|
5457
|
+
removeArrayValue(internalRuntimeBridgesForCleanup, wsBridge);
|
|
5458
|
+
if ((buildOptions?.validationAttempt ?? 0) >= 2) {
|
|
5459
|
+
throw new Error(
|
|
5460
|
+
"Workspace trust policy kept changing during runtime creation."
|
|
5461
|
+
);
|
|
5462
|
+
}
|
|
5463
|
+
const { generationGuard: _staleGuard, ...retryOptions } = buildOptions ?? {};
|
|
5464
|
+
return createDynamicWorkspaceRuntime(cwd, {
|
|
5465
|
+
...retryOptions,
|
|
5466
|
+
validationAttempt: (buildOptions?.validationAttempt ?? 0) + 1
|
|
5467
|
+
});
|
|
5468
|
+
}
|
|
5469
|
+
}
|
|
5470
|
+
return wsRuntime;
|
|
5156
5471
|
}, "createDynamicWorkspaceRuntime");
|
|
5472
|
+
const serveAppForRuntimeLifecycle = { current: void 0 };
|
|
5157
5473
|
const workspaceRuntimeRemoval = {
|
|
5158
5474
|
async runtimeAdded(runtimeAdded) {
|
|
5159
|
-
|
|
5475
|
+
channelWebhookEnvByWorkspace.set(
|
|
5476
|
+
runtimeAdded.workspaceCwd,
|
|
5477
|
+
workspaceRuntimeEffectiveEnv(runtimeAdded, daemonRuntimeBaseEnv)
|
|
5478
|
+
);
|
|
5479
|
+
channelWebhookConfigVersion += 1;
|
|
5480
|
+
refreshChannelWebhookConfigs?.();
|
|
5481
|
+
const app3 = serveAppForRuntimeLifecycle.current ?? runtimeApp ?? runtimeAppForCleanup;
|
|
5160
5482
|
const startScheduledTaskKeepaliveForWorkspace = app3?.locals?.["startScheduledTaskKeepaliveForWorkspace"];
|
|
5161
5483
|
startScheduledTaskKeepaliveForWorkspace?.(runtimeAdded);
|
|
5162
5484
|
if (!channelWorkerManager) return;
|
|
5163
5485
|
try {
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5486
|
+
if (runtimeAdded.trusted) {
|
|
5487
|
+
await channelWorkerManager.restoreWorkspace(
|
|
5488
|
+
runtimeAdded.workspaceCwd
|
|
5489
|
+
);
|
|
5490
|
+
}
|
|
5167
5491
|
await channelWorkerManager.refreshWorkspaces();
|
|
5168
5492
|
} catch (err) {
|
|
5169
5493
|
daemonLog.error(
|
|
@@ -5175,14 +5499,51 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5175
5499
|
}
|
|
5176
5500
|
},
|
|
5177
5501
|
beginDrain(runtimeToDrain) {
|
|
5502
|
+
if (runtimeToDrain.primary) {
|
|
5503
|
+
if (bridgeRef === runtimeToDrain.bridge) bridgeRef = void 0;
|
|
5504
|
+
invalidatePrimaryServeFeaturesCache();
|
|
5505
|
+
}
|
|
5178
5506
|
totalSessionAdmission.beginWorkspaceDrain(runtimeToDrain.workspaceCwd);
|
|
5179
5507
|
channelWorkerManager?.beginWorkspaceDrain(runtimeToDrain.workspaceCwd);
|
|
5180
5508
|
workspaceVoiceCoordinator.beginWorkspaceDrain(runtimeToDrain);
|
|
5509
|
+
channelWebhookEnvByWorkspace.delete(runtimeToDrain.workspaceCwd);
|
|
5510
|
+
channelWebhookConfigVersion += 1;
|
|
5511
|
+
refreshChannelWebhookConfigs?.();
|
|
5512
|
+
const app3 = serveAppForRuntimeLifecycle.current ?? runtimeApp ?? runtimeAppForCleanup;
|
|
5513
|
+
const stopScheduledTaskKeepaliveForWorkspace = app3?.locals?.["stopScheduledTaskKeepaliveForWorkspace"];
|
|
5514
|
+
try {
|
|
5515
|
+
stopScheduledTaskKeepaliveForWorkspace?.(runtimeToDrain.workspaceCwd);
|
|
5516
|
+
} catch (err) {
|
|
5517
|
+
daemonLog.error(
|
|
5518
|
+
"workspace scheduled-task drain error",
|
|
5519
|
+
err instanceof Error ? err : null
|
|
5520
|
+
);
|
|
5521
|
+
}
|
|
5181
5522
|
},
|
|
5182
5523
|
cancelDrain(runtimeToDrain) {
|
|
5524
|
+
if (runtimeToDrain.primary && bridgeRef === void 0) {
|
|
5525
|
+
bridgeRef = runtimeToDrain.bridge;
|
|
5526
|
+
invalidatePrimaryServeFeaturesCache();
|
|
5527
|
+
}
|
|
5183
5528
|
channelWorkerManager?.cancelWorkspaceDrain(runtimeToDrain.workspaceCwd);
|
|
5184
5529
|
totalSessionAdmission.cancelWorkspaceDrain(runtimeToDrain.workspaceCwd);
|
|
5185
5530
|
workspaceVoiceCoordinator.cancelWorkspaceDrain(runtimeToDrain);
|
|
5531
|
+
channelWebhookEnvByWorkspace.set(
|
|
5532
|
+
runtimeToDrain.workspaceCwd,
|
|
5533
|
+
workspaceRuntimeEffectiveEnv(runtimeToDrain, daemonRuntimeBaseEnv)
|
|
5534
|
+
);
|
|
5535
|
+
channelWebhookConfigVersion += 1;
|
|
5536
|
+
refreshChannelWebhookConfigs?.();
|
|
5537
|
+
const app3 = serveAppForRuntimeLifecycle.current ?? runtimeApp ?? runtimeAppForCleanup;
|
|
5538
|
+
const startScheduledTaskKeepaliveForWorkspace = app3?.locals?.["startScheduledTaskKeepaliveForWorkspace"];
|
|
5539
|
+
try {
|
|
5540
|
+
startScheduledTaskKeepaliveForWorkspace?.(runtimeToDrain);
|
|
5541
|
+
} catch (err) {
|
|
5542
|
+
daemonLog.error(
|
|
5543
|
+
"workspace scheduled-task drain rollback error",
|
|
5544
|
+
err instanceof Error ? err : null
|
|
5545
|
+
);
|
|
5546
|
+
}
|
|
5186
5547
|
},
|
|
5187
5548
|
completeDrain(runtimeToDrain) {
|
|
5188
5549
|
totalSessionAdmission.completeWorkspaceDrain(
|
|
@@ -5205,18 +5566,29 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5205
5566
|
const existing = runtimeCleanupPromises.get(runtimeToDrain);
|
|
5206
5567
|
if (existing) return existing;
|
|
5207
5568
|
const cleanup = (async () => {
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
)
|
|
5569
|
+
const containmentErrors = [];
|
|
5570
|
+
try {
|
|
5571
|
+
await workspaceVoiceCoordinator.disposeRuntime(
|
|
5572
|
+
runtimeToDrain,
|
|
5573
|
+
reason
|
|
5574
|
+
);
|
|
5575
|
+
} catch (err) {
|
|
5576
|
+
daemonLog.error(
|
|
5577
|
+
"workspace voice cleanup error",
|
|
5578
|
+
err instanceof Error ? err : null
|
|
5579
|
+
);
|
|
5580
|
+
}
|
|
5581
|
+
if (reason === "trust_reconfigured" && workspaceVoiceCoordinator.getWorkspaceActivity(runtimeToDrain) > 0) {
|
|
5582
|
+
containmentErrors.push(
|
|
5583
|
+
new Error("Workspace voice sessions are still active.")
|
|
5584
|
+
);
|
|
5585
|
+
}
|
|
5586
|
+
const stopSubSessions = subSessionStoppersByRuntime.get(runtimeToDrain);
|
|
5215
5587
|
try {
|
|
5216
5588
|
stopSubSessions?.();
|
|
5217
5589
|
} catch {
|
|
5218
5590
|
}
|
|
5219
|
-
if (reason
|
|
5591
|
+
if (reason !== "daemon_shutdown" && channelWorkerManager) {
|
|
5220
5592
|
await channelWorkerManager.removeWorkspace(runtimeToDrain.workspaceCwd).catch((err) => {
|
|
5221
5593
|
daemonLog.error(
|
|
5222
5594
|
"workspace channel worker cleanup error",
|
|
@@ -5237,25 +5609,65 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5237
5609
|
);
|
|
5238
5610
|
}
|
|
5239
5611
|
writeChannelWorkerPidfile();
|
|
5612
|
+
if (reason === "trust_reconfigured" && channelWorkerManager.workspaceActivity(
|
|
5613
|
+
runtimeToDrain.workspaceCwd
|
|
5614
|
+
) > 0) {
|
|
5615
|
+
containmentErrors.push(
|
|
5616
|
+
new Error("Workspace channel workers are still active.")
|
|
5617
|
+
);
|
|
5618
|
+
}
|
|
5240
5619
|
}
|
|
5241
|
-
if (reason
|
|
5242
|
-
const app3 = runtimeApp ?? runtimeAppForCleanup;
|
|
5620
|
+
if (reason !== "daemon_shutdown") {
|
|
5621
|
+
const app3 = serveAppForRuntimeLifecycle.current ?? runtimeApp ?? runtimeAppForCleanup;
|
|
5243
5622
|
const stopWorkspaceGitStateForWorkspace = app3?.locals?.["stopWorkspaceGitStateForWorkspace"];
|
|
5244
5623
|
const stopScheduledTaskKeepaliveForWorkspace = app3?.locals?.["stopScheduledTaskKeepaliveForWorkspace"];
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5624
|
+
try {
|
|
5625
|
+
stopWorkspaceGitStateForWorkspace?.(runtimeToDrain.workspaceCwd);
|
|
5626
|
+
} catch (err) {
|
|
5627
|
+
daemonLog.error(
|
|
5628
|
+
"workspace git-state cleanup error",
|
|
5629
|
+
err instanceof Error ? err : null
|
|
5630
|
+
);
|
|
5631
|
+
}
|
|
5632
|
+
try {
|
|
5633
|
+
stopScheduledTaskKeepaliveForWorkspace?.(
|
|
5634
|
+
runtimeToDrain.workspaceCwd
|
|
5635
|
+
);
|
|
5636
|
+
} catch (err) {
|
|
5637
|
+
daemonLog.error(
|
|
5638
|
+
"workspace scheduled-task cleanup error",
|
|
5639
|
+
err instanceof Error ? err : null
|
|
5640
|
+
);
|
|
5641
|
+
}
|
|
5249
5642
|
}
|
|
5250
5643
|
let bridgeStopped = false;
|
|
5251
5644
|
try {
|
|
5252
5645
|
if (!shutdownBridges.has(runtimeToDrain.bridge)) {
|
|
5253
|
-
|
|
5646
|
+
try {
|
|
5647
|
+
await runtimeToDrain.bridge.shutdown({ reason });
|
|
5648
|
+
} catch (shutdownError) {
|
|
5649
|
+
try {
|
|
5650
|
+
runtimeToDrain.bridge.killAllSync();
|
|
5651
|
+
daemonLog.warn(
|
|
5652
|
+
"workspace bridge required forceful shutdown",
|
|
5653
|
+
{
|
|
5654
|
+
workspace: runtimeToDrain.workspaceCwd,
|
|
5655
|
+
reason,
|
|
5656
|
+
error: shutdownError instanceof Error ? shutdownError.message : String(shutdownError)
|
|
5657
|
+
}
|
|
5658
|
+
);
|
|
5659
|
+
} catch (killError) {
|
|
5660
|
+
throw new AggregateError(
|
|
5661
|
+
[shutdownError, killError],
|
|
5662
|
+
"Workspace bridge shutdown could not be confirmed."
|
|
5663
|
+
);
|
|
5664
|
+
}
|
|
5665
|
+
}
|
|
5254
5666
|
}
|
|
5255
5667
|
bridgeStopped = true;
|
|
5256
5668
|
} finally {
|
|
5257
|
-
if (bridgeStopped
|
|
5258
|
-
|
|
5669
|
+
if (bridgeStopped) {
|
|
5670
|
+
subSessionStoppersByRuntime.delete(runtimeToDrain);
|
|
5259
5671
|
if (stopSubSessions) {
|
|
5260
5672
|
removeArrayValue(subSessionStoppers, stopSubSessions);
|
|
5261
5673
|
}
|
|
@@ -5267,10 +5679,16 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5267
5679
|
shutdownBridges.add(runtimeToDrain.bridge);
|
|
5268
5680
|
}
|
|
5269
5681
|
}
|
|
5682
|
+
if (containmentErrors.length > 0) {
|
|
5683
|
+
throw new AggregateError(
|
|
5684
|
+
containmentErrors,
|
|
5685
|
+
"Workspace runtime containment could not be confirmed."
|
|
5686
|
+
);
|
|
5687
|
+
}
|
|
5270
5688
|
})();
|
|
5271
5689
|
runtimeCleanupPromises.set(runtimeToDrain, cleanup);
|
|
5272
5690
|
void cleanup.catch(() => {
|
|
5273
|
-
if (
|
|
5691
|
+
if (runtimeCleanupPromises.get(runtimeToDrain) === cleanup) {
|
|
5274
5692
|
runtimeCleanupPromises.delete(runtimeToDrain);
|
|
5275
5693
|
}
|
|
5276
5694
|
});
|
|
@@ -5292,8 +5710,8 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5292
5710
|
{ createChannelManagementService },
|
|
5293
5711
|
{ WorkspaceChannelSettingsStore }
|
|
5294
5712
|
] = await Promise.all([
|
|
5295
|
-
import("./channel-management-service-
|
|
5296
|
-
import("./channel-settings-store-
|
|
5713
|
+
import("./channel-management-service-5S7YCWX5.js"),
|
|
5714
|
+
import("./channel-settings-store-JFVRSNER.js")
|
|
5297
5715
|
]);
|
|
5298
5716
|
return createChannelManagementService({
|
|
5299
5717
|
workspaceCwd: targetRuntime.workspaceCwd,
|
|
@@ -5309,12 +5727,55 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5309
5727
|
});
|
|
5310
5728
|
return pending;
|
|
5311
5729
|
}, "channelManagementService");
|
|
5730
|
+
const validateWorkspaceRuntimeForPublication = /* @__PURE__ */ __name(async (runtimeForPublication) => {
|
|
5731
|
+
let candidate = runtimeForPublication;
|
|
5732
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
5733
|
+
const snapshot = await trustPolicy.readDaemonTrustPolicySnapshot();
|
|
5734
|
+
const decision = trustPolicy.evaluateDaemonWorkspaceTrust(
|
|
5735
|
+
snapshot,
|
|
5736
|
+
candidate.workspaceCwd
|
|
5737
|
+
);
|
|
5738
|
+
const materialization = JSON.stringify({
|
|
5739
|
+
trusted: decision.targetTrusted,
|
|
5740
|
+
boundWorkspaces: [candidate.workspaceCwd]
|
|
5741
|
+
});
|
|
5742
|
+
if (candidate.trustMaterialization === materialization) {
|
|
5743
|
+
return candidate;
|
|
5744
|
+
}
|
|
5745
|
+
candidate.generationGuard?.close();
|
|
5746
|
+
await workspaceRuntimeRemoval.disposeRuntime(
|
|
5747
|
+
candidate,
|
|
5748
|
+
"trust_reconfigured"
|
|
5749
|
+
);
|
|
5750
|
+
if (attempt === 2) {
|
|
5751
|
+
throw new Error(
|
|
5752
|
+
"Workspace trust policy kept changing before runtime publication."
|
|
5753
|
+
);
|
|
5754
|
+
}
|
|
5755
|
+
candidate = await createDynamicWorkspaceRuntime(
|
|
5756
|
+
runtimeForPublication.workspaceCwd,
|
|
5757
|
+
{
|
|
5758
|
+
primary: runtimeForPublication.primary,
|
|
5759
|
+
removable: runtimeForPublication.removable,
|
|
5760
|
+
displayName: runtimeForPublication.displayName,
|
|
5761
|
+
registrationIds: runtimeForPublication.registrationIds
|
|
5762
|
+
}
|
|
5763
|
+
);
|
|
5764
|
+
}
|
|
5765
|
+
throw new Error("Workspace runtime publication validation failed.");
|
|
5766
|
+
}, "validateWorkspaceRuntimeForPublication");
|
|
5312
5767
|
const app2 = runtime.createServeApp(opts, () => actualPort, {
|
|
5313
5768
|
workspaceRegistry,
|
|
5314
5769
|
createWorkspaceRuntime: createDynamicWorkspaceRuntime,
|
|
5770
|
+
...workspaceTrustHotReloadAvailable ? {
|
|
5771
|
+
validateWorkspaceRuntimeForPublication,
|
|
5772
|
+
runWorkspaceTrustOperation,
|
|
5773
|
+
getWorkspaceTrustPolicySnapshot: /* @__PURE__ */ __name(() => latestTrustPolicySnapshot, "getWorkspaceTrustPolicySnapshot")
|
|
5774
|
+
} : {},
|
|
5315
5775
|
managedScratchRoot,
|
|
5316
5776
|
workspaceRegistrationStore,
|
|
5317
5777
|
workspaceRuntimeRemoval,
|
|
5778
|
+
workspaceTrustHotReloadAvailable,
|
|
5318
5779
|
voiceCoordinator: workspaceVoiceCoordinator,
|
|
5319
5780
|
bridge,
|
|
5320
5781
|
webShellDir,
|
|
@@ -5393,9 +5854,10 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5393
5854
|
sessionArtifactsPersistenceAvailable: sessionArtifactsPersistenceAvailableFromSettings(
|
|
5394
5855
|
runtimeBootSettings?.merged
|
|
5395
5856
|
),
|
|
5396
|
-
installAuthProvider: /* @__PURE__ */ __name((req) => withSettingsLock(
|
|
5857
|
+
installAuthProvider: /* @__PURE__ */ __name((req, assertGenerationOpen) => withSettingsLock(
|
|
5397
5858
|
boundWorkspace,
|
|
5398
5859
|
async () => {
|
|
5860
|
+
assertGenerationOpen?.();
|
|
5399
5861
|
const provider = core.findProviderById(req.providerId);
|
|
5400
5862
|
if (!provider) {
|
|
5401
5863
|
throw new Error(`Unsupported auth provider: ${req.providerId}`);
|
|
@@ -5405,7 +5867,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5405
5867
|
resolveBaseUrl: core.resolveBaseUrl
|
|
5406
5868
|
});
|
|
5407
5869
|
const plan = core.buildInstallPlan(provider, inputs);
|
|
5408
|
-
const fresh =
|
|
5870
|
+
const fresh = loadSettingsForPersistence(boundWorkspace);
|
|
5409
5871
|
const adapter = settingsRuntime.loadedSettingsAdapter.createLoadedSettingsAdapter(
|
|
5410
5872
|
fresh
|
|
5411
5873
|
);
|
|
@@ -5413,6 +5875,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5413
5875
|
settings: adapter,
|
|
5414
5876
|
doRefreshAuth: false
|
|
5415
5877
|
});
|
|
5878
|
+
assertGenerationOpen?.();
|
|
5416
5879
|
core.emitDaemonLog("Auth provider installed.", {
|
|
5417
5880
|
"qwen-code.daemon.auth.provider_id": provider.id,
|
|
5418
5881
|
"qwen-code.daemon.auth.auth_type": plan.authType
|
|
@@ -5431,11 +5894,171 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5431
5894
|
}
|
|
5432
5895
|
), "installAuthProvider")
|
|
5433
5896
|
});
|
|
5897
|
+
serveAppForRuntimeLifecycle.current = app2;
|
|
5434
5898
|
invalidatePrimaryServeFeaturesCache = app2.locals.invalidateServeFeaturesCache ?? invalidatePrimaryServeFeaturesCache;
|
|
5435
5899
|
app2.locals.subSessionStoppers = subSessionStoppers;
|
|
5436
5900
|
subSessionStoppers.push(subSessionLauncher.stop);
|
|
5437
|
-
|
|
5438
|
-
|
|
5901
|
+
subSessionStoppersByRuntime.set(
|
|
5902
|
+
workspaceRegistry.primary,
|
|
5903
|
+
subSessionLauncher.stop
|
|
5904
|
+
);
|
|
5905
|
+
if (workspaceTrustHotReloadAvailable) {
|
|
5906
|
+
const [
|
|
5907
|
+
{ createWorkspaceTrustReconciler },
|
|
5908
|
+
{ createDaemonTrustPolicyMonitor }
|
|
5909
|
+
] = await Promise.all([
|
|
5910
|
+
import("./workspace-trust-reconciler-5FI2S3OS.js"),
|
|
5911
|
+
import("./daemon-trust-policy-monitor-V6FTE3IY.js")
|
|
5912
|
+
]);
|
|
5913
|
+
const materializationFor = /* @__PURE__ */ __name((entry, snapshot, decision) => {
|
|
5914
|
+
const boundWorkspaces2 = entry.primary && decision.targetTrusted ? runtime.resolveBoundWorkspacesFromIdeEnv(
|
|
5915
|
+
entry.workspaceCwd,
|
|
5916
|
+
void 0,
|
|
5917
|
+
(workspace, index) => index === 0 || trustPolicy.evaluateDaemonWorkspaceTrust(snapshot, workspace).targetTrusted
|
|
5918
|
+
) : [entry.workspaceCwd];
|
|
5919
|
+
return {
|
|
5920
|
+
key: JSON.stringify({
|
|
5921
|
+
trusted: decision.targetTrusted,
|
|
5922
|
+
boundWorkspaces: [...boundWorkspaces2].sort()
|
|
5923
|
+
}),
|
|
5924
|
+
boundWorkspaces: boundWorkspaces2
|
|
5925
|
+
};
|
|
5926
|
+
}, "materializationFor");
|
|
5927
|
+
const acpHandle = /* @__PURE__ */ __name(() => app2.locals?.["acpHandle"], "acpHandle");
|
|
5928
|
+
const trustReconciler = createWorkspaceTrustReconciler({
|
|
5929
|
+
registry: workspaceRegistry,
|
|
5930
|
+
readLatestSnapshot: trustPolicy.readDaemonTrustPolicySnapshot,
|
|
5931
|
+
materializationKey: /* @__PURE__ */ __name(({ entry, snapshot, decision }) => materializationFor(entry, snapshot, decision).key, "materializationKey"),
|
|
5932
|
+
isTrustDecrease: /* @__PURE__ */ __name(({
|
|
5933
|
+
runtime: current,
|
|
5934
|
+
nextMaterialization,
|
|
5935
|
+
decision
|
|
5936
|
+
}) => {
|
|
5937
|
+
if (current.trusted && !decision.targetTrusted) return true;
|
|
5938
|
+
if (!current.primary || !current.trusted) return false;
|
|
5939
|
+
try {
|
|
5940
|
+
const previous = JSON.parse(
|
|
5941
|
+
current.trustMaterialization ?? "{}"
|
|
5942
|
+
);
|
|
5943
|
+
const next = JSON.parse(nextMaterialization);
|
|
5944
|
+
if (!Array.isArray(previous.boundWorkspaces) || !Array.isArray(next.boundWorkspaces)) {
|
|
5945
|
+
return true;
|
|
5946
|
+
}
|
|
5947
|
+
const nextRoots = new Set(
|
|
5948
|
+
next.boundWorkspaces.filter(
|
|
5949
|
+
(value) => typeof value === "string"
|
|
5950
|
+
)
|
|
5951
|
+
);
|
|
5952
|
+
return previous.boundWorkspaces.some(
|
|
5953
|
+
(value) => typeof value !== "string" || !nextRoots.has(value)
|
|
5954
|
+
);
|
|
5955
|
+
} catch {
|
|
5956
|
+
return true;
|
|
5957
|
+
}
|
|
5958
|
+
}, "isTrustDecrease"),
|
|
5959
|
+
buildRuntime: /* @__PURE__ */ __name(async ({
|
|
5960
|
+
entry,
|
|
5961
|
+
trusted,
|
|
5962
|
+
snapshot,
|
|
5963
|
+
decision,
|
|
5964
|
+
generationGuard
|
|
5965
|
+
}) => {
|
|
5966
|
+
const materialized = materializationFor(
|
|
5967
|
+
entry,
|
|
5968
|
+
snapshot,
|
|
5969
|
+
trusted === decision.targetTrusted ? decision : { ...decision, targetTrusted: trusted }
|
|
5970
|
+
);
|
|
5971
|
+
return createDynamicWorkspaceRuntime(entry.workspaceCwd, {
|
|
5972
|
+
trusted,
|
|
5973
|
+
snapshot,
|
|
5974
|
+
decision,
|
|
5975
|
+
generationGuard,
|
|
5976
|
+
primary: entry.primary,
|
|
5977
|
+
removable: entry.removable,
|
|
5978
|
+
displayName: entry.displayName,
|
|
5979
|
+
registrationIds: entry.registrationIds,
|
|
5980
|
+
boundWorkspaces: materialized.boundWorkspaces,
|
|
5981
|
+
trustMaterialization: materialized.key
|
|
5982
|
+
});
|
|
5983
|
+
}, "buildRuntime"),
|
|
5984
|
+
drainRuntime: /* @__PURE__ */ __name(async (runtimeToDrain) => {
|
|
5985
|
+
workspaceRuntimeRemoval.beginDrain(runtimeToDrain);
|
|
5986
|
+
acpHandle()?.beginWorkspaceDrain(runtimeToDrain.workspaceId);
|
|
5987
|
+
}, "drainRuntime"),
|
|
5988
|
+
disposeRuntime: /* @__PURE__ */ __name(async (runtimeToDispose, reason) => {
|
|
5989
|
+
const errors = [];
|
|
5990
|
+
try {
|
|
5991
|
+
await workspaceRuntimeRemoval.disposeRuntime(
|
|
5992
|
+
runtimeToDispose,
|
|
5993
|
+
reason
|
|
5994
|
+
);
|
|
5995
|
+
} catch (error) {
|
|
5996
|
+
errors.push(error);
|
|
5997
|
+
}
|
|
5998
|
+
try {
|
|
5999
|
+
const handle = acpHandle();
|
|
6000
|
+
if (!runtimeToDispose.primary) {
|
|
6001
|
+
handle?.commitWorkspaceRemoval(runtimeToDispose.workspaceId);
|
|
6002
|
+
}
|
|
6003
|
+
handle?.disposeWorkspace(runtimeToDispose.workspaceId);
|
|
6004
|
+
const deadline = Date.now() + 1e3;
|
|
6005
|
+
while ((handle?.getWorkspaceActivity(runtimeToDispose.workspaceId).memoryTasks ?? 0) > 0 && Date.now() < deadline) {
|
|
6006
|
+
await new Promise((resolve2) => setTimeout(resolve2, 25));
|
|
6007
|
+
}
|
|
6008
|
+
if ((handle?.getWorkspaceActivity(runtimeToDispose.workspaceId).memoryTasks ?? 0) > 0) {
|
|
6009
|
+
throw new Error(
|
|
6010
|
+
"Workspace memory tasks did not stop after runtime disposal."
|
|
6011
|
+
);
|
|
6012
|
+
}
|
|
6013
|
+
} catch (error) {
|
|
6014
|
+
errors.push(error);
|
|
6015
|
+
}
|
|
6016
|
+
if (errors.length === 1) throw errors[0];
|
|
6017
|
+
if (errors.length > 1) {
|
|
6018
|
+
throw new AggregateError(
|
|
6019
|
+
errors,
|
|
6020
|
+
"Workspace runtime and ACP cleanup failed."
|
|
6021
|
+
);
|
|
6022
|
+
}
|
|
6023
|
+
}, "disposeRuntime"),
|
|
6024
|
+
runtimeActivated: /* @__PURE__ */ __name(async (runtimeAdded) => {
|
|
6025
|
+
workspaceRuntimeRemoval.cancelDrain(runtimeAdded);
|
|
6026
|
+
acpHandle()?.cancelWorkspaceDrain(runtimeAdded.workspaceId);
|
|
6027
|
+
if (runtimeAdded.primary) {
|
|
6028
|
+
bridgeRef = runtimeAdded.bridge;
|
|
6029
|
+
invalidatePrimaryServeFeaturesCache();
|
|
6030
|
+
}
|
|
6031
|
+
await workspaceRuntimeRemoval.runtimeAdded(runtimeAdded);
|
|
6032
|
+
}, "runtimeActivated"),
|
|
6033
|
+
onError: /* @__PURE__ */ __name((entry, error) => {
|
|
6034
|
+
daemonLog.error(
|
|
6035
|
+
`workspace trust reconciliation failed for ${entry.workspaceCwd}`,
|
|
6036
|
+
error instanceof Error ? error : null
|
|
6037
|
+
);
|
|
6038
|
+
}, "onError")
|
|
6039
|
+
});
|
|
6040
|
+
const trustMonitor = createDaemonTrustPolicyMonitor({
|
|
6041
|
+
onSnapshot: /* @__PURE__ */ __name((snapshot) => {
|
|
6042
|
+
latestTrustPolicySnapshot = snapshot;
|
|
6043
|
+
return runWorkspaceTrustOperation(
|
|
6044
|
+
() => trustReconciler.reconcile(snapshot)
|
|
6045
|
+
);
|
|
6046
|
+
}, "onSnapshot"),
|
|
6047
|
+
onError: /* @__PURE__ */ __name((error) => {
|
|
6048
|
+
daemonLog.error(
|
|
6049
|
+
"workspace trust policy monitor failed",
|
|
6050
|
+
error instanceof Error ? error : null
|
|
6051
|
+
);
|
|
6052
|
+
}, "onError")
|
|
6053
|
+
});
|
|
6054
|
+
app2.locals.stopTrustPolicyMonitor = () => trustMonitor.stop();
|
|
6055
|
+
app2.locals.requestTrustReconcile = () => trustMonitor.requestReconcile("manual");
|
|
6056
|
+
app2.locals.waitForTrustPolicyIdle = () => runWorkspaceTrustOperation(async () => void 0);
|
|
6057
|
+
await trustMonitor.start();
|
|
6058
|
+
}
|
|
6059
|
+
const activePrimaryBridge = workspaceRegistry.primaryEntry.current?.runtime.bridge;
|
|
6060
|
+
bridgeRef = activePrimaryBridge;
|
|
6061
|
+
return { app: app2, bridge: activePrimaryBridge };
|
|
5439
6062
|
}, "buildRuntime");
|
|
5440
6063
|
if (deps.bridge) {
|
|
5441
6064
|
const runtime = await buildRuntime();
|
|
@@ -5492,46 +6115,89 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5492
6115
|
);
|
|
5493
6116
|
}
|
|
5494
6117
|
const channelValidationSettingsRuntime = opts.channelSelection ? await loadSettingsRuntimeModules() : void 0;
|
|
6118
|
+
const channelValidationTrustPolicy = opts.channelSelection ? await import("./daemon-trust-policy-Q4KSOJTR.js") : void 0;
|
|
6119
|
+
const channelValidationTrustSnapshot = channelValidationTrustPolicy ? await channelValidationTrustPolicy.readDaemonTrustPolicySnapshot() : void 0;
|
|
5495
6120
|
const resolveChannelWorkspaceGroupsAtListen = /* @__PURE__ */ __name(() => {
|
|
5496
6121
|
if (!opts.channelSelection || !channelValidationSettingsRuntime || !channelRuntime) {
|
|
5497
6122
|
return void 0;
|
|
5498
6123
|
}
|
|
6124
|
+
const registry = (runtimeApp ?? runtimeAppForCleanup)?.locals?.["workspaceRegistry"];
|
|
6125
|
+
const resolveRuntime = /* @__PURE__ */ __name((workspaceCwd) => {
|
|
6126
|
+
const runtime = registry?.getByWorkspaceCwd(workspaceCwd);
|
|
6127
|
+
if (registry && !runtime) {
|
|
6128
|
+
throw Object.assign(
|
|
6129
|
+
new Error(`Workspace "${workspaceCwd}" is unavailable.`),
|
|
6130
|
+
{ code: "workspace_unavailable" }
|
|
6131
|
+
);
|
|
6132
|
+
}
|
|
6133
|
+
return runtime;
|
|
6134
|
+
}, "resolveRuntime");
|
|
6135
|
+
const resolveTrusted = /* @__PURE__ */ __name((workspaceCwd, primary, runtime) => {
|
|
6136
|
+
if (runtime) return runtime.trusted;
|
|
6137
|
+
if (primary && deps.trustedWorkspace !== void 0) {
|
|
6138
|
+
return deps.trustedWorkspace;
|
|
6139
|
+
}
|
|
6140
|
+
if (!channelValidationTrustPolicy || !channelValidationTrustSnapshot) {
|
|
6141
|
+
return false;
|
|
6142
|
+
}
|
|
6143
|
+
return channelValidationTrustPolicy.evaluateDaemonWorkspaceTrust(
|
|
6144
|
+
channelValidationTrustSnapshot,
|
|
6145
|
+
workspaceCwd
|
|
6146
|
+
).targetTrusted;
|
|
6147
|
+
}, "resolveTrusted");
|
|
5499
6148
|
const settingsByWorkspace = /* @__PURE__ */ new Map();
|
|
5500
6149
|
if (workspaceInputs.length === 1) {
|
|
5501
6150
|
const workspace = workspaceInputs[0];
|
|
5502
|
-
const
|
|
5503
|
-
|
|
5504
|
-
)
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
6151
|
+
const runtime = resolveRuntime(workspace.cwd);
|
|
6152
|
+
const trusted = resolveTrusted(workspace.cwd, true, runtime);
|
|
6153
|
+
if (!trusted) {
|
|
6154
|
+
throw Object.assign(
|
|
6155
|
+
new Error(
|
|
6156
|
+
`Primary workspace "${workspace.cwd}" is not trusted; cannot host channels.`
|
|
6157
|
+
),
|
|
6158
|
+
{ code: "untrusted_workspace" }
|
|
6159
|
+
);
|
|
6160
|
+
}
|
|
6161
|
+
const effectiveEnv = runtime ? workspaceRuntimeEffectiveEnv(runtime, daemonRuntimeBaseEnv) : channelValidationSettingsRuntime.environment.buildRuntimeEnvironment(
|
|
6162
|
+
channelValidationSettingsRuntime.settings.loadSettings(
|
|
5509
6163
|
workspace.cwd,
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
6164
|
+
{
|
|
6165
|
+
skipLoadEnvironment: true,
|
|
6166
|
+
skipWorkspaceSettings: false,
|
|
6167
|
+
workspaceTrusted: true
|
|
6168
|
+
}
|
|
6169
|
+
).merged,
|
|
6170
|
+
workspace.cwd,
|
|
6171
|
+
daemonRuntimeBaseEnv,
|
|
6172
|
+
trusted
|
|
6173
|
+
).effectiveEnv;
|
|
6174
|
+
channelWebhookEnvByWorkspace.set(workspace.cwd, effectiveEnv);
|
|
5513
6175
|
return void 0;
|
|
5514
6176
|
}
|
|
5515
6177
|
const workspaces = workspaceInputs.map((workspace, index) => {
|
|
6178
|
+
const runtime = resolveRuntime(workspace.cwd);
|
|
6179
|
+
const trusted = resolveTrusted(workspace.cwd, index === 0, runtime);
|
|
5516
6180
|
const settings = channelValidationSettingsRuntime.settings.loadSettings(
|
|
5517
|
-
workspace.cwd
|
|
6181
|
+
workspace.cwd,
|
|
6182
|
+
{
|
|
6183
|
+
skipLoadEnvironment: true,
|
|
6184
|
+
skipWorkspaceSettings: !trusted,
|
|
6185
|
+
workspaceTrusted: trusted
|
|
6186
|
+
}
|
|
5518
6187
|
);
|
|
5519
6188
|
settingsByWorkspace.set(workspace.cwd, settings);
|
|
5520
6189
|
channelWebhookEnvByWorkspace.set(
|
|
5521
6190
|
workspace.cwd,
|
|
5522
|
-
channelValidationSettingsRuntime.environment.buildRuntimeEnvironment(
|
|
6191
|
+
runtime ? workspaceRuntimeEffectiveEnv(runtime, daemonRuntimeBaseEnv) : channelValidationSettingsRuntime.environment.buildRuntimeEnvironment(
|
|
5523
6192
|
settings.merged,
|
|
5524
6193
|
workspace.cwd,
|
|
5525
|
-
daemonRuntimeBaseEnv
|
|
6194
|
+
daemonRuntimeBaseEnv,
|
|
6195
|
+
trusted
|
|
5526
6196
|
).effectiveEnv
|
|
5527
6197
|
);
|
|
5528
|
-
const trusted = index === 0 && deps.trustedWorkspace !== void 0 ? deps.trustedWorkspace : channelValidationSettingsRuntime.trustedFolders.getWorkspaceTrustStatus(
|
|
5529
|
-
settings.merged,
|
|
5530
|
-
workspace.cwd
|
|
5531
|
-
).effective.state === "trusted";
|
|
5532
6198
|
return {
|
|
5533
6199
|
workspaceCwd: workspace.cwd,
|
|
5534
|
-
primary: index === 0,
|
|
6200
|
+
primary: runtime?.primary ?? index === 0,
|
|
5535
6201
|
trusted
|
|
5536
6202
|
};
|
|
5537
6203
|
});
|
|
@@ -5555,7 +6221,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5555
6221
|
if (opts.channelSelection) {
|
|
5556
6222
|
reserveChannelServicePidfile(opts.channelSelection);
|
|
5557
6223
|
}
|
|
5558
|
-
return await new Promise((
|
|
6224
|
+
return await new Promise((resolve2, reject) => {
|
|
5559
6225
|
const onListening = /* @__PURE__ */ __name((error) => {
|
|
5560
6226
|
if (error) return;
|
|
5561
6227
|
startup.listenerReadyAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -5710,7 +6376,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5710
6376
|
daemonLog.error("runtime startup failed", error2);
|
|
5711
6377
|
markRuntimeFailed(error2);
|
|
5712
6378
|
if (closeServerAfterChannelWorkerStartupFailure && server.listening) {
|
|
5713
|
-
runtimeFailureListenerClose = new Promise((
|
|
6379
|
+
runtimeFailureListenerClose = new Promise((resolve3) => {
|
|
5714
6380
|
server.close((closeErr) => {
|
|
5715
6381
|
if (closeErr) {
|
|
5716
6382
|
daemonLog.error(
|
|
@@ -5718,7 +6384,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5718
6384
|
closeErr
|
|
5719
6385
|
);
|
|
5720
6386
|
}
|
|
5721
|
-
|
|
6387
|
+
resolve3();
|
|
5722
6388
|
});
|
|
5723
6389
|
});
|
|
5724
6390
|
server.closeAllConnections();
|
|
@@ -5751,9 +6417,18 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5751
6417
|
}
|
|
5752
6418
|
const runtimes = registry.list();
|
|
5753
6419
|
if (runtimes.length <= 1 && operation === "initial") {
|
|
6420
|
+
const primary = registry.primary;
|
|
6421
|
+
if (!primary.trusted) {
|
|
6422
|
+
throw Object.assign(
|
|
6423
|
+
new Error(
|
|
6424
|
+
`Primary workspace "${primary.workspaceCwd}" is not trusted; cannot host channels.`
|
|
6425
|
+
),
|
|
6426
|
+
{ code: "untrusted_workspace" }
|
|
6427
|
+
);
|
|
6428
|
+
}
|
|
5754
6429
|
return [
|
|
5755
6430
|
{
|
|
5756
|
-
workspaceCwd:
|
|
6431
|
+
workspaceCwd: primary.workspaceCwd,
|
|
5757
6432
|
selection: channelSelection
|
|
5758
6433
|
}
|
|
5759
6434
|
];
|
|
@@ -5764,7 +6439,12 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5764
6439
|
const grouping = resolveChannelWorkspaceGroups({
|
|
5765
6440
|
workspaces: runtimes.map((runtime) => {
|
|
5766
6441
|
const settings = settingsRuntime.settings.loadSettings(
|
|
5767
|
-
runtime.workspaceCwd
|
|
6442
|
+
runtime.workspaceCwd,
|
|
6443
|
+
{
|
|
6444
|
+
skipLoadEnvironment: true,
|
|
6445
|
+
skipWorkspaceSettings: !runtime.trusted,
|
|
6446
|
+
workspaceTrusted: runtime.trusted
|
|
6447
|
+
}
|
|
5768
6448
|
);
|
|
5769
6449
|
settingsByWorkspace.set(runtime.workspaceCwd, settings);
|
|
5770
6450
|
return {
|
|
@@ -5935,7 +6615,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5935
6615
|
);
|
|
5936
6616
|
return;
|
|
5937
6617
|
}
|
|
5938
|
-
if (shouldPreheat) {
|
|
6618
|
+
if (shouldPreheat && runtime.bridge) {
|
|
5939
6619
|
startBridgePreheat(runtime.bridge);
|
|
5940
6620
|
}
|
|
5941
6621
|
await completeRuntimeStartup(runtime.app);
|
|
@@ -5977,6 +6657,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
5977
6657
|
if (shuttingDown) {
|
|
5978
6658
|
daemonLog.warn(`received ${signal} during drain \u2014 forcing exit`);
|
|
5979
6659
|
try {
|
|
6660
|
+
managedProcessRegistry?.killAllSync();
|
|
5980
6661
|
channelWorkerManager?.killAllSync();
|
|
5981
6662
|
for (const runtimeBridge of getRuntimeBridgesForCleanup()) {
|
|
5982
6663
|
runtimeBridge.killAllSync();
|
|
@@ -6004,7 +6685,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
6004
6685
|
process.exit(runtimeStartupError === void 0 ? 0 : 1);
|
|
6005
6686
|
} catch (err) {
|
|
6006
6687
|
daemonLog.error("shutdown error", err instanceof Error ? err : null);
|
|
6007
|
-
if (
|
|
6688
|
+
if (err instanceof Error && retryableChannelWorkerShutdownErrors.has(err)) {
|
|
6008
6689
|
daemonLog.error(
|
|
6009
6690
|
"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)"
|
|
6010
6691
|
);
|
|
@@ -6036,7 +6717,17 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
6036
6717
|
channelControlDraining = true;
|
|
6037
6718
|
const initiallyMountedApp = runtimeApp ?? runtimeAppForCleanup;
|
|
6038
6719
|
const initiallyMountedManagement = initiallyMountedApp?.locals?.["workspaceManagementHandle"];
|
|
6720
|
+
const initiallyMountedSessionMaintenance = initiallyMountedApp?.locals?.["sessionArchiveCoordinator"];
|
|
6039
6721
|
const initialManagementWait = initiallyMountedManagement?.sealAndWait?.();
|
|
6722
|
+
const initialSessionMaintenanceWait = initiallyMountedSessionMaintenance?.sealMaintenanceAndWait?.();
|
|
6723
|
+
let processRegistryShutdown;
|
|
6724
|
+
const startProcessRegistryShutdown = /* @__PURE__ */ __name(() => {
|
|
6725
|
+
processRegistryShutdown ??= managedProcessRegistry?.shutdown().then(
|
|
6726
|
+
() => void 0,
|
|
6727
|
+
(error2) => error2 instanceof Error ? error2 : new Error(String(error2))
|
|
6728
|
+
);
|
|
6729
|
+
}, "startProcessRegistryShutdown");
|
|
6730
|
+
startProcessRegistryShutdown();
|
|
6040
6731
|
clearRuntimeStartAfterHealthTimer();
|
|
6041
6732
|
clearRuntimeStartFallbackTimer();
|
|
6042
6733
|
cancelDeferredRuntimeStartup();
|
|
@@ -6065,6 +6756,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
6065
6756
|
const finalErr = err ?? bridgeShutdownError ?? channelWorkerShutdownError;
|
|
6066
6757
|
const retryableChannelClose = channelWorkerShutdownError !== void 0 && channelWorkerManager?.state().enabled === true;
|
|
6067
6758
|
if (retryableChannelClose) {
|
|
6759
|
+
const retryableError = channelWorkerShutdownError;
|
|
6068
6760
|
await flushDaemonLogBounded(
|
|
6069
6761
|
daemonLog,
|
|
6070
6762
|
DAEMON_LOG_FORCED_FLUSH_BUDGET_MS
|
|
@@ -6072,13 +6764,18 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
6072
6764
|
closePromise = void 0;
|
|
6073
6765
|
shuttingDown = false;
|
|
6074
6766
|
channelControlDraining = false;
|
|
6075
|
-
|
|
6767
|
+
retryableChannelWorkerShutdownErrors.add(retryableError);
|
|
6768
|
+
rej(retryableError);
|
|
6076
6769
|
return;
|
|
6077
6770
|
}
|
|
6078
6771
|
if (loggerPublished || loggerSignalOwned) {
|
|
6079
|
-
writeDaemonLifecycleBestEffort(
|
|
6080
|
-
()
|
|
6081
|
-
|
|
6772
|
+
writeDaemonLifecycleBestEffort(() => {
|
|
6773
|
+
if (finalErr) {
|
|
6774
|
+
daemonLog.error("daemon shutdown incomplete", finalErr);
|
|
6775
|
+
} else {
|
|
6776
|
+
daemonLog.info("daemon stopped");
|
|
6777
|
+
}
|
|
6778
|
+
});
|
|
6082
6779
|
await daemonLog.close();
|
|
6083
6780
|
}
|
|
6084
6781
|
if (finalErr) rej(finalErr);
|
|
@@ -6097,10 +6794,24 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
6097
6794
|
);
|
|
6098
6795
|
const appForCleanup = runtimeApp ?? runtimeAppForCleanup;
|
|
6099
6796
|
const workspaceManagementHandle = appForCleanup?.locals?.["workspaceManagementHandle"];
|
|
6797
|
+
const sessionMaintenance = appForCleanup?.locals?.["sessionArchiveCoordinator"];
|
|
6100
6798
|
await initialManagementWait;
|
|
6101
6799
|
if (workspaceManagementHandle !== initiallyMountedManagement) {
|
|
6102
6800
|
await workspaceManagementHandle?.sealAndWait?.();
|
|
6103
6801
|
}
|
|
6802
|
+
await initialSessionMaintenanceWait;
|
|
6803
|
+
if (sessionMaintenance !== initiallyMountedSessionMaintenance) {
|
|
6804
|
+
await sessionMaintenance?.sealMaintenanceAndWait?.();
|
|
6805
|
+
}
|
|
6806
|
+
stopTrustPolicyMonitor(appForCleanup);
|
|
6807
|
+
const waitForTrustPolicyIdle = appForCleanup?.locals?.["waitForTrustPolicyIdle"];
|
|
6808
|
+
await waitForTrustPolicyIdle?.().catch((err) => {
|
|
6809
|
+
daemonLog.error(
|
|
6810
|
+
"workspace trust reconciliation shutdown wait failed",
|
|
6811
|
+
err instanceof Error ? err : null
|
|
6812
|
+
);
|
|
6813
|
+
});
|
|
6814
|
+
startProcessRegistryShutdown();
|
|
6104
6815
|
disposeRuntimeAppResources(appForCleanup);
|
|
6105
6816
|
disposeDaemonEventLoopMonitor();
|
|
6106
6817
|
if (channelWorkerManager) {
|
|
@@ -6151,6 +6862,14 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
6151
6862
|
bridgeShutdownError = err instanceof Error ? err : new Error(String(err));
|
|
6152
6863
|
});
|
|
6153
6864
|
}
|
|
6865
|
+
const processRegistryError = await processRegistryShutdown;
|
|
6866
|
+
if (processRegistryError) {
|
|
6867
|
+
daemonLog.error(
|
|
6868
|
+
"ACP process registry shutdown error",
|
|
6869
|
+
processRegistryError
|
|
6870
|
+
);
|
|
6871
|
+
bridgeShutdownError ??= processRegistryError;
|
|
6872
|
+
}
|
|
6154
6873
|
}).finally(() => {
|
|
6155
6874
|
if (!server.listening) {
|
|
6156
6875
|
void (runtimeFailureListenerClose ?? Promise.resolve()).then(
|
|
@@ -6213,13 +6932,13 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
6213
6932
|
if (deps.resolveOnListen) {
|
|
6214
6933
|
loggerPublished = true;
|
|
6215
6934
|
loggerLifecycle.published();
|
|
6216
|
-
|
|
6935
|
+
resolve2(handle);
|
|
6217
6936
|
} else {
|
|
6218
6937
|
void runtimeReady.then(
|
|
6219
6938
|
() => {
|
|
6220
6939
|
loggerPublished = true;
|
|
6221
6940
|
loggerLifecycle.published();
|
|
6222
|
-
|
|
6941
|
+
resolve2(handle);
|
|
6223
6942
|
},
|
|
6224
6943
|
(err) => {
|
|
6225
6944
|
void handle.close().then(
|
|
@@ -6233,7 +6952,7 @@ async function runQwenServeImpl(optsIn, deps, loggerLifecycle) {
|
|
|
6233
6952
|
closeErr instanceof Error ? closeErr : null
|
|
6234
6953
|
)
|
|
6235
6954
|
);
|
|
6236
|
-
if (
|
|
6955
|
+
if (closeErr instanceof Error && retryableChannelWorkerShutdownErrors.has(closeErr)) {
|
|
6237
6956
|
writeDaemonLifecycleBestEffort(
|
|
6238
6957
|
() => daemonLog.error(
|
|
6239
6958
|
"runtime startup failed, but qwen serve remains alive to retain the channel service lease until worker exit is confirmed"
|