gerege-cli 0.26.5 → 0.26.6
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/README.md +8 -8
- package/chunks/{MaxSizedBox-VMVLMS4X.js → MaxSizedBox-QCIXIS4P.js} +1 -1
- package/chunks/{StandaloneSessionPicker-UNORCVYY.js → StandaloneSessionPicker-BAFAIRT7.js} +1 -1
- package/chunks/{acp-subagent-executor-623ZUTJT.js → acp-subagent-executor-TPVXURLW.js} +1 -1
- package/chunks/{acpAgent-MTTDTK2C.js → acpAgent-67UN66PB.js} +3 -3
- package/chunks/{advisor-ANUGICJ5.js → advisor-SAXMI4QZ.js} +1 -1
- package/chunks/{agent-GNCQDICJ.js → agent-KV7BXY6C.js} +1 -1
- package/chunks/{agent-headless-OPUXAXQM.js → agent-headless-FQX3JGG6.js} +1 -1
- package/chunks/{agent-host-client-K6GRPTFD.js → agent-host-client-L5EHC4AC.js} +1 -1
- package/chunks/{agent-host-connections-MF3YBZU2.js → agent-host-connections-EDBMCVQF.js} +1 -1
- package/chunks/{anthropicContentGenerator-OK4PFE5Y.js → anthropicContentGenerator-V7TX2NXP.js} +1 -1
- package/chunks/{autofix-pr-MABTGEHZ.js → autofix-pr-WP34NYHL.js} +1 -1
- package/chunks/{batch-V2NJT3M5.js → batch-XFVQ4BLM.js} +1 -1
- package/chunks/{bridge-BJQ627CX.js → bridge-AE7AFEXB.js} +1 -1
- package/chunks/{channel-settings-store-4JMCI4UR.js → channel-settings-store-X63P5OVT.js} +1 -1
- package/chunks/{chunk-ZN57TOVA.js → chunk-2DU2WMTL.js} +1 -1
- package/chunks/{chunk-Z5XENA4A.js → chunk-2JGTWRZJ.js} +8 -7
- package/chunks/{chunk-MTW3A3KT.js → chunk-2LWJGXTW.js} +1 -1
- package/chunks/{chunk-OCBJCZC2.js → chunk-2N3NBTYJ.js} +1 -1
- package/chunks/{chunk-WI4UMN3Q.js → chunk-2TAJ5STJ.js} +1 -1
- package/chunks/{chunk-EIILQ6KT.js → chunk-32XHDDIA.js} +1 -1
- package/chunks/{chunk-FNXO5KWB.js → chunk-34HC2AXI.js} +2 -2
- package/chunks/{chunk-2X3UF2CF.js → chunk-3W32X2DH.js} +1 -1
- package/chunks/{chunk-CKZRJP4F.js → chunk-4ME3BUJK.js} +1 -1
- package/chunks/{chunk-NVSKOSFG.js → chunk-4NDJKNN6.js} +1 -1
- package/chunks/{chunk-BRPJ5EHA.js → chunk-5EXL4TKQ.js} +1 -1
- package/chunks/{chunk-3XBJYUWP.js → chunk-65ME4BOH.js} +1 -1
- package/chunks/{chunk-TQTIEK2W.js → chunk-7453BHJO.js} +1 -1
- package/chunks/{chunk-HSYBIGMS.js → chunk-76FSYQTG.js} +1 -1
- package/chunks/{chunk-FNB3DPQZ.js → chunk-7RNOS7R4.js} +1 -1
- package/chunks/{chunk-H57IX45A.js → chunk-AEKEZRIU.js} +1 -1
- package/chunks/{chunk-CXGGC4NO.js → chunk-AEZYXPFS.js} +1 -1
- package/chunks/{chunk-NGOIJH7K.js → chunk-AFO5ER23.js} +1 -1
- package/chunks/{chunk-UY2ET2AL.js → chunk-AYVCT5FF.js} +1 -1
- package/chunks/{chunk-QOYRDEXR.js → chunk-B37YY4XU.js} +1 -1
- package/chunks/{chunk-IDUGQMTP.js → chunk-BAUMVH4Q.js} +1 -1
- package/chunks/{chunk-CAPG7UVH.js → chunk-BCI62WSL.js} +1 -1
- package/chunks/{chunk-USJFJZ23.js → chunk-BGELKSQ4.js} +1 -1
- package/chunks/{chunk-6X73W4TL.js → chunk-BHIDG6VZ.js} +1 -1
- package/chunks/{chunk-26ISBUM7.js → chunk-BPFFRPWE.js} +6 -6
- package/chunks/{chunk-YGHM5CDT.js → chunk-BQZF3UKI.js} +1 -1
- package/chunks/{chunk-3NQESE5K.js → chunk-CBE6ZIHU.js} +1 -1
- package/chunks/{chunk-DEMXCA3K.js → chunk-CF6SZJNP.js} +1 -1
- package/chunks/{chunk-2VCDJ6UF.js → chunk-CGDFZEER.js} +1 -1
- package/chunks/{chunk-3WQPUP5U.js → chunk-CUP2TNJK.js} +1 -1
- package/chunks/{chunk-2IGE2K5V.js → chunk-DA6LOBSB.js} +1 -1
- package/chunks/{chunk-HFV6CQWE.js → chunk-EFIRES46.js} +1 -1
- package/chunks/{chunk-E5YRAQXM.js → chunk-EKRUF347.js} +1 -1
- package/chunks/{chunk-KN27BFXM.js → chunk-ELDZ4MNL.js} +1 -1
- package/chunks/{chunk-ADTFKUH2.js → chunk-ET5M5WFN.js} +1 -1
- package/chunks/{chunk-IBYFSHBB.js → chunk-EXIFPXMB.js} +1 -1
- package/chunks/{chunk-IA4K4PGK.js → chunk-EYPLBTMI.js} +1 -1
- package/chunks/{chunk-DTTC4ZKY.js → chunk-FEP6W4NJ.js} +1 -1
- package/chunks/{chunk-FHBGTZ4K.js → chunk-FKL3V5BO.js} +1 -1
- package/chunks/{chunk-Q5E5SOY2.js → chunk-FKZ46GKL.js} +1 -1
- package/chunks/{chunk-OPYGNTZP.js → chunk-FYBJGRX7.js} +1 -1
- package/chunks/{chunk-FPZPCZFS.js → chunk-G6DALGGS.js} +1 -1
- package/chunks/{chunk-3Y6LSWEW.js → chunk-GBSRWT7J.js} +1 -1
- package/chunks/{chunk-SMYBY353.js → chunk-GHIFIXNX.js} +1 -1
- package/chunks/{chunk-DE53B2R7.js → chunk-GRAECADD.js} +1 -1
- package/chunks/{chunk-UJYOILZR.js → chunk-GSPGIGO5.js} +3 -3
- package/chunks/{chunk-5UZT4SXG.js → chunk-H3IR3GIE.js} +1 -1
- package/chunks/{chunk-ADZI3OFT.js → chunk-HOG66S6K.js} +1 -1
- package/chunks/{chunk-WB34KMOT.js → chunk-HTAUIJB4.js} +1 -1
- package/chunks/{chunk-MPAR4JBP.js → chunk-I6PUY2T3.js} +1 -1
- package/chunks/{chunk-5ZQWQ3RK.js → chunk-IZ5MWA6E.js} +1 -1
- package/chunks/{chunk-7IERHQ63.js → chunk-JEDL4IKF.js} +1 -1
- package/chunks/{chunk-RVJJFDF3.js → chunk-JH3V5SPA.js} +1 -1
- package/chunks/{chunk-SELRSZFK.js → chunk-JRTOPEM3.js} +1 -1
- package/chunks/{chunk-SQQORHMS.js → chunk-JWNKPINR.js} +1 -1
- package/chunks/{chunk-55RVKT4O.js → chunk-KJGRCIVY.js} +1 -1
- package/chunks/{chunk-GSOBASYW.js → chunk-KZNYALFU.js} +1 -1
- package/chunks/{chunk-FDUXQAGW.js → chunk-LBLLWAKK.js} +1 -1
- package/chunks/{chunk-ZSVSRF4C.js → chunk-LT3J74BZ.js} +1 -1
- package/chunks/{chunk-AMTFJVDD.js → chunk-LTE4N6L3.js} +1 -1
- package/chunks/{chunk-F26LTWDZ.js → chunk-M6KB5RVD.js} +1 -1
- package/chunks/{chunk-2PY7R7GG.js → chunk-MGATL4OA.js} +1 -1
- package/chunks/{chunk-KGJ47CI5.js → chunk-MPVQDYPH.js} +1 -1
- package/chunks/{chunk-BBOJUFMW.js → chunk-MTDBCIDA.js} +1 -1
- package/chunks/{chunk-ZYTG6R7S.js → chunk-MYV7GY3H.js} +1 -1
- package/chunks/{chunk-4GC5HJZO.js → chunk-N7PWZBXV.js} +1 -1
- package/chunks/{chunk-2NOMOJWE.js → chunk-NA4ZF2FE.js} +2 -2
- package/chunks/{chunk-7MTBINFX.js → chunk-NEKPQLFY.js} +2 -2
- package/chunks/{chunk-ABJGFEES.js → chunk-NO7VTKRL.js} +1 -1
- package/chunks/{chunk-OHXQYU6S.js → chunk-NONBHCXP.js} +1 -1
- package/chunks/{chunk-ZOBX6C7E.js → chunk-NVOI6UDQ.js} +1 -1
- package/chunks/{chunk-YLAI26PX.js → chunk-OJ4K62S2.js} +1 -1
- package/chunks/{chunk-CCOUFBOY.js → chunk-OK7LBM5G.js} +1 -1
- package/chunks/{chunk-POA4NX4N.js → chunk-OOJ2AQT3.js} +1 -1
- package/chunks/{chunk-5WLKN3GD.js → chunk-OU7CEG7Q.js} +1 -1
- package/chunks/{chunk-4TYTJQWR.js → chunk-P3JEEDQZ.js} +1 -1
- package/chunks/{chunk-AQWHCRKY.js → chunk-P62S5JGM.js} +1 -1
- package/chunks/{chunk-B6D3KTUK.js → chunk-QDCUR3JB.js} +1 -1
- package/chunks/{chunk-XFLLE2J3.js → chunk-RSLTOIG5.js} +2 -2
- package/chunks/{chunk-ISGF3BVD.js → chunk-RXN7DUMP.js} +2 -2
- package/chunks/{chunk-PN62SUYK.js → chunk-SKGJ26HQ.js} +1 -1
- package/chunks/{chunk-62NLMVVT.js → chunk-SP6CQ3MO.js} +1 -1
- package/chunks/{chunk-4EQWJTJR.js → chunk-T2YTHAJW.js} +1 -1
- package/chunks/{chunk-NO26JN24.js → chunk-T53VMDXH.js} +1 -1
- package/chunks/{chunk-X4BFEDWU.js → chunk-T5DKF33F.js} +1 -1
- package/chunks/{chunk-KKBOCRPF.js → chunk-TB4AUC2L.js} +1 -1
- package/chunks/{chunk-Q6QS5JTK.js → chunk-U3Q72OGV.js} +1 -1
- package/chunks/{chunk-FLJLUMQF.js → chunk-UKLXKJKL.js} +1 -1
- package/chunks/{chunk-IH2PFVWO.js → chunk-VD2GSW64.js} +1 -1
- package/chunks/{chunk-VDRE7U3P.js → chunk-VRKYBH5G.js} +5 -5
- package/chunks/{chunk-MOPJNP5I.js → chunk-W2RQIZ6B.js} +1 -1
- package/chunks/{chunk-2LLPGSUK.js → chunk-W5Z4BWWA.js} +1 -1
- package/chunks/{chunk-CNFA5UUM.js → chunk-W66WWTOP.js} +1 -1
- package/chunks/{chunk-C56YJIEI.js → chunk-WGFX3EL3.js} +1 -1
- package/chunks/{chunk-6NI33TVK.js → chunk-X2TY7VTY.js} +1 -1
- package/chunks/{chunk-FIM7MM25.js → chunk-XISR37DQ.js} +1 -1
- package/chunks/{chunk-KDYUZBZC.js → chunk-YH2XRWRF.js} +1 -1
- package/chunks/{chunk-UBXLQ6TP.js → chunk-ZENMAISJ.js} +1 -1
- package/chunks/{codex-subagent-executor-EK3A2WBH.js → codex-subagent-executor-OLMGVPVS.js} +1 -1
- package/chunks/{config-utils-DLOK7OLM.js → config-utils-OWY5G5Y2.js} +1 -1
- package/chunks/{contextCommand-AVCUCHQC.js → contextCommand-IXFUZH65.js} +1 -1
- package/chunks/{core-runtime-QSS4ZTG6.js → core-runtime-O4LC4NY3.js} +1 -1
- package/chunks/{create-sub-session-PNF7QDKC.js → create-sub-session-6F7C3TMT.js} +1 -1
- package/chunks/{cron-create-C6JOFIU4.js → cron-create-2422NBSJ.js} +1 -1
- package/chunks/{daemon-git-worktree-guard-5XZAZ7D2.js → daemon-git-worktree-guard-EWPQA6NO.js} +1 -1
- package/chunks/{daemon-status-provider-MRNELSNJ.js → daemon-status-provider-FAHOXNFW.js} +1 -1
- package/chunks/{daemon-trust-policy-26CMW3WY.js → daemon-trust-policy-L3DM6AI5.js} +1 -1
- package/chunks/{daemon-trust-policy-monitor-3DWO6NQY.js → daemon-trust-policy-monitor-HNPY5KJ4.js} +1 -1
- package/chunks/{deferred-core-runtime-DEC3N46T.js → deferred-core-runtime-JF42NQJK.js} +1 -1
- package/chunks/{edit-3HMQPCHN.js → edit-E5LEI2LL.js} +1 -1
- package/chunks/{enterPlanMode-QHJF4JXZ.js → enterPlanMode-3COTUV5V.js} +1 -1
- package/chunks/{environment-NGIBJWOT.js → environment-XBBIB3VA.js} +1 -1
- package/chunks/{errors-MSTGCVGJ.js → errors-LNMQ7TUK.js} +1 -1
- package/chunks/{execution-tool-VR4TGOI4.js → execution-tool-QDDKJD2K.js} +1 -1
- package/chunks/{execution-worker-EJH7HIE2.js → execution-worker-TXGZRZXE.js} +1 -1
- package/chunks/{exitPlanMode-P25OHQJ6.js → exitPlanMode-Z7QEMWPE.js} +1 -1
- package/chunks/{fast-path-II433ZDP.js → fast-path-M6K2RACY.js} +1 -1
- package/chunks/{glob-4Q6DCT3F.js → glob-N2QT4U7U.js} +1 -1
- package/chunks/{goal-tools-FFMAJW6V.js → goal-tools-CUSQD3DG.js} +1 -1
- package/chunks/{handleAutoUpdate-QNM26NZK.js → handleAutoUpdate-QF2YQHF6.js} +1 -1
- package/chunks/{i18n-L5URVOBB.js → i18n-AGOA6MUI.js} +1 -1
- package/chunks/{initializer-NQ2NECYP.js → initializer-FRKYDUSX.js} +1 -1
- package/chunks/{installationInfo-BCTXASUM.js → installationInfo-OKA4WXAS.js} +1 -1
- package/chunks/{interactive-mod-session-PPTBI37E.js → interactive-mod-session-MWYN5IFK.js} +1 -1
- package/chunks/{list-7TE5TUZJ.js → list-DE7VUIR2.js} +1 -1
- package/chunks/{llm-BWWKUBBZ.js → llm-N3JGJHYC.js} +4 -4
- package/chunks/{llm-content-generator-QOTGPBYC.js → llm-content-generator-VMUBA7OJ.js} +1 -1
- package/chunks/{loadedSettingsAdapter-THAGI5M2.js → loadedSettingsAdapter-5C36OZ7N.js} +1 -1
- package/chunks/{local-7BTAGV4J.js → local-BE624O3A.js} +1 -1
- package/chunks/{local-execution-environment-S3OR4KSC.js → local-execution-environment-OPGM7Y6L.js} +1 -1
- package/chunks/{loggingContentGenerator-AXJ5E5RS.js → loggingContentGenerator-2MHAI6JR.js} +1 -1
- package/chunks/{loop-wakeup-AJTLMLRX.js → loop-wakeup-BDLATBXH.js} +1 -1
- package/chunks/{manage-memory-JHTUVMDJ.js → manage-memory-BBCEIIWB.js} +1 -1
- package/chunks/{managed-execution-engine-U6GNJ4U4.js → managed-execution-engine-SRFALTCX.js} +1 -1
- package/chunks/{managed-local-serve-P4ZXVRBU.js → managed-local-serve-ICNAS3E6.js} +1 -1
- package/chunks/{managed-npm-update-UDUILNR5.js → managed-npm-update-CTL6LH5Z.js} +1 -1
- package/chunks/{managed-runtime-attestation-worker-P34ZBNRG.js → managed-runtime-attestation-worker-ZRDWKXCI.js} +1 -1
- package/chunks/{managed-runtime-bootstrap-CLMYNPH5.js → managed-runtime-bootstrap-6NTGZXQL.js} +1 -1
- package/chunks/{managed-runtime-session-worker-7H7AZJBV.js → managed-runtime-session-worker-RKQBBFR6.js} +1 -1
- package/chunks/{managed-runtime-ssh-worker-5KEMC7FD.js → managed-runtime-ssh-worker-FCGV6FSW.js} +1 -1
- package/chunks/{managed-session-authority-CFUZ45HT.js → managed-session-authority-C7IW6TJX.js} +1 -1
- package/chunks/{mcp-YMG4RVMC.js → mcp-VC4CJPE5.js} +1 -1
- package/chunks/{memory-7STURUXK.js → memory-S6OJA3ZD.js} +1 -1
- package/chunks/mn-JMS6SWTO.js +8 -0
- package/chunks/{model-call-collection-WBWTO3EG.js → model-call-collection-MJZWRQSU.js} +1 -1
- package/chunks/{model-configuration-6KCZZSZD.js → model-configuration-SKU6L3QI.js} +1 -1
- package/chunks/{modelConfigUtils-Z2EKFSPN.js → modelConfigUtils-TJCB6NXT.js} +1 -1
- package/chunks/{monitor-U5E33JO6.js → monitor-M3PNLCYP.js} +1 -1
- package/chunks/{nonInteractiveCli-BVCL5I5R.js → nonInteractiveCli-MR7JLAWU.js} +1 -1
- package/chunks/{nonInteractiveToolExecutor-B4EUOMYF.js → nonInteractiveToolExecutor-YKA6JMTY.js} +1 -1
- package/chunks/{notebook-edit-MXKD5J2C.js → notebook-edit-ENTFB5D7.js} +1 -1
- package/chunks/{omni-I5YECZBW.js → omni-6YBX4R6K.js} +1 -1
- package/chunks/{openaiContentGenerator-Q5SINFJJ.js → openaiContentGenerator-XRXX33FY.js} +1 -1
- package/chunks/{openaiResponsesContentGenerator-R3XCZLZY.js → openaiResponsesContentGenerator-L6ONEHMR.js} +1 -1
- package/chunks/{pidfile-UOGUNUTK.js → pidfile-XR4JF2Z6.js} +1 -1
- package/chunks/{processUtils-QGQGZHBA.js → processUtils-GQYNJRBJ.js} +1 -1
- package/chunks/{prompt-terminal-ledger-L57JMVSR.js → prompt-terminal-ledger-7BM7YDLG.js} +1 -1
- package/chunks/{qwenContentGenerator-UKZ237LC.js → qwenContentGenerator-QSA32XEL.js} +1 -1
- package/chunks/{reactive-degrade-3OM3HWVA.js → reactive-degrade-TFNBAAPZ.js} +1 -1
- package/chunks/{read-file-63ZLWMOW.js → read-file-VD7OFO2E.js} +1 -1
- package/chunks/{resumeHistoryUtils-R5YQS4YQ.js → resumeHistoryUtils-2B4KPI7G.js} +1 -1
- package/chunks/{review-AT6OWVDO.js → review-C365WGCW.js} +1 -1
- package/chunks/{ripGrep-7KBZGTPV.js → ripGrep-D7WPMBXR.js} +1 -1
- package/chunks/{run-qwen-serve-CLBG7W6F.js → run-qwen-serve-NZWQHWQA.js} +1 -1
- package/chunks/{runtime-R3QIGB7U.js → runtime-J6SPBSCS.js} +1 -1
- package/chunks/{sandboxConfig-PM3ZRQYV.js → sandboxConfig-QS2XBPZG.js} +1 -1
- package/chunks/{scheduled-tasks-PUMNN5XV.js → scheduled-tasks-YNNIOOPM.js} +1 -1
- package/chunks/{scheduler-KTPM226B.js → scheduler-KCMSPHON.js} +1 -1
- package/chunks/{search-memory-7I5MGDNV.js → search-memory-EUBJ7IAV.js} +1 -1
- package/chunks/{send-message-J526AEBI.js → send-message-CWWZUPSK.js} +1 -1
- package/chunks/{serve-KLTMPK4W.js → serve-4CB4BWJ5.js} +1 -1
- package/chunks/{server-VLRNY6KG.js → server-JNANUIGC.js} +3 -3
- package/chunks/{session-2EB57NXY.js → session-3LQLXPUA.js} +1 -1
- package/chunks/{session-attachments-root-I7TESMWL.js → session-attachments-root-BWIVWFHJ.js} +1 -1
- package/chunks/{session-execution-engine-selector-5FAMSPSO.js → session-execution-engine-selector-5OLRX57L.js} +1 -1
- package/chunks/{session-pr-refresh-JCPVQPNJ.js → session-pr-refresh-RLF3EXS3.js} +1 -1
- package/chunks/{sessionService-YRW2IFPR.js → sessionService-U7ACD2HP.js} +1 -1
- package/chunks/{settings-KO2Q47JP.js → settings-FTGWYTUH.js} +1 -1
- package/chunks/{shell-OLZVNTQZ.js → shell-E4RENYQC.js} +1 -1
- package/chunks/{skill-XW2AQS7M.js → skill-OLNPHRWB.js} +1 -1
- package/chunks/{skill-settings-TKAVQ4XP.js → skill-settings-R2BV2GEK.js} +1 -1
- package/chunks/{spawnChannel-MBGCTK2J.js → spawnChannel-LOPAR5T2.js} +1 -1
- package/chunks/{standalone-update-A3YLLIAN.js → standalone-update-IGDX2RGN.js} +1 -1
- package/chunks/{start-opentui-ui-G5ROAR4V.js → start-opentui-ui-33QLBNRC.js} +1 -1
- package/chunks/{startInteractiveUI-PZQR4U53.js → startInteractiveUI-RQKHD7MM.js} +1 -1
- package/chunks/{team-create-S5ZY2UMF.js → team-create-HAVKHNU5.js} +1 -1
- package/chunks/{team-plan-approval-KX6RXEST.js → team-plan-approval-7MCQX67C.js} +1 -1
- package/chunks/{terminal-image-renderer-SCJREXE6.js → terminal-image-renderer-XT5JVEO6.js} +1 -1
- package/chunks/{theme-manager-DZSM4EBR.js → theme-manager-DR5EYGLT.js} +1 -1
- package/chunks/{tool-call-UK56SWCT.js → tool-call-LZHZ5RVH.js} +1 -1
- package/chunks/{tool-result-media-JLLSLGFL.js → tool-result-media-XCXCF4YC.js} +1 -1
- package/chunks/{tool-search-OWPFLVV5.js → tool-search-K6S3ON7M.js} +1 -1
- package/chunks/{total-session-admission-NQU4ACKH.js → total-session-admission-LGSS2VWS.js} +1 -1
- package/chunks/{trustedFolders-N7GXFYSF.js → trustedFolders-IIR2UZRL.js} +1 -1
- package/chunks/{update-relaunch-5SPXXHM2.js → update-relaunch-WVIFX5CN.js} +1 -1
- package/chunks/{updateCheck-VXUIX2XG.js → updateCheck-CMEWLLZJ.js} +1 -1
- package/chunks/{upload-config-OWLL4SRQ.js → upload-config-TCCFCNCD.js} +1 -1
- package/chunks/{useAutoAcceptIndicator-OUYRR56F.js → useAutoAcceptIndicator-5RTTH3OW.js} +1 -1
- package/chunks/{validateNonInterActiveAuth-PSVJO5HK.js → validateNonInterActiveAuth-AO336KDX.js} +1 -1
- package/chunks/{version-C26S7UAW.js → version-JYWKKMNP.js} +1 -1
- package/chunks/{web-fetch-AYOYV7R4.js → web-fetch-HWTAWXFM.js} +1 -1
- package/chunks/{web-search-DAREKD3Z.js → web-search-HAI5LW3G.js} +1 -1
- package/chunks/{workflow-WBGPKVO6.js → workflow-BZ2YFGF6.js} +1 -1
- package/chunks/{workflow-ancestor-trust-GEEB53TB.js → workflow-ancestor-trust-26TFXFPO.js} +1 -1
- package/chunks/{workspace-agents-IMAQME4W.js → workspace-agents-DLI4JQJZ.js} +1 -1
- package/chunks/{workspace-providers-status-VALHVEU2.js → workspace-providers-status-64C7DJZU.js} +1 -1
- package/chunks/{workspace-recovery-worker-AIAVRDGU.js → workspace-recovery-worker-IFRT3KKP.js} +1 -1
- package/chunks/{workspace-registration-store-FXEGZG3L.js → workspace-registration-store-MYKJM2SK.js} +1 -1
- package/chunks/{workspace-registry-GYFFHWCD.js → workspace-registry-GZJRONAY.js} +1 -1
- package/chunks/{workspace-runtime-coordinator-VZ462TLU.js → workspace-runtime-coordinator-44KW6HSN.js} +1 -1
- package/chunks/{workspace-service-5DIZM4IZ.js → workspace-service-YHTSZYYD.js} +1 -1
- package/chunks/{workspace-skills-status-DOOBVL5N.js → workspace-skills-status-NEB62X24.js} +1 -1
- package/chunks/{workspace-trust-reconciler-LOICVUVW.js → workspace-trust-reconciler-HZLOOZWM.js} +1 -1
- package/chunks/{write-file-EJNMAHQD.js → write-file-HD5LHXGL.js} +1 -1
- package/chunks/{zoom-image-S3OARMYP.js → zoom-image-W4BMRC5T.js} +1 -1
- package/cli.js +2 -2
- package/execution-worker.js +1 -1
- package/export-transcript-document.js +1 -1
- package/gerege.mjs +53 -15
- package/locales/mn.js +2702 -3774
- package/package.json +3 -3
- package/chunks/mn-YH2OTBWJ.js +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{require_semver}from"./chunk-YZUKMJW7.js";import{getInstallationInfo,getNpmCliPath,getNpmNodePath}from"./chunk-26MNTKT2.js";import{t}from"./chunk-ABJGFEES.js";import{getPackageJson}from"./chunk-O4EDHV64.js";import{isBunRuntime}from"./chunk-WGNF7FPC.js";import{createDebugLogger}from"./chunk-JAUJI56S.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name,__toESM}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var import_semver=__toESM(require_semver(),1);import{execFile}from"node:child_process";import{promisify}from"node:util";init_esbuild_shims();import*as fs from"node:fs";import*as os from"node:os";import*as path from"node:path";function npmrcValue(raw){const value=raw.trim();if(value.startsWith('"')&&value.endsWith('"')){try{const parsed=JSON.parse(value);if(typeof parsed==="string")return parsed}catch{return value}}if(value.startsWith("'")&&value.endsWith("'"))return value.slice(1,-1);return value.replace(/\\([\\;#])|[;#].*$/g,(_match,escaped)=>escaped??"").trim()}__name(npmrcValue,"npmrcValue");function expandEnv(value){return value.replace(/(\\*)\$\{([^}]+)\}/g,(match,escapes,name)=>{if(escapes.length%2)return match.slice(1);return escapes+(process.env[name]??`\${${name}}`)})}__name(expandEnv,"expandEnv");function readNpmrc(filename){let content;try{content=fs.readFileSync(filename,"utf8")}catch(error){if(error.code==="ENOENT")return new Map;throw new Error("Unable to read npm registry configuration")}const config=new Map;let inSection=false;for(const line of content.split(/\r?\n/)){if(/^\s*\[/.test(line))inSection=true;if(inSection||/^\s*[;#]/.test(line))continue;const match=line.match(/^\s*([^=]+?)\s*=(.*)$/);if(!match)continue;config.set(expandEnv(npmrcValue(match[1])),expandEnv(npmrcValue(match[2])))}return config}__name(readNpmrc,"readNpmrc");function getGlobalNpmRegistryConfig(packageName){const env=new Map;for(const[key,value]of Object.entries(process.env)){if(!/^npm_config_/i.test(key)||!value)continue;const suffix=key.slice("npm_config_".length);const name=suffix.startsWith("//")?suffix:suffix.toLowerCase().replace(/(?!^)_/g,"-");env.set(expandEnv(name),expandEnv(value.trim()))}const home=os.homedir();const configPath=__name(value=>{if(/^~(?=\/|$)/.test(value)){if(!path.isAbsolute(home)){throw new Error("Cannot resolve npm configuration without an absolute home directory")}value=value.replace(/^~/,home)}return path.resolve(value)},"configPath");const builtin=readNpmrc(path.join(path.dirname(process.execPath),...process.platform==="win32"?["node_modules","npm","npmrc"]:["..","lib","node_modules","npm","npmrc"]));const userConfig=env.get("userconfig")??builtin.get("userconfig")??(path.isAbsolute(home)?path.join(home,".npmrc"):void 0);const user=userConfig?readNpmrc(configPath(userConfig)):new Map;let defaultPrefix=path.dirname(process.execPath);if(process.platform!=="win32"){defaultPrefix=path.dirname(defaultPrefix);if(process.env["DESTDIR"]){defaultPrefix=path.join(process.env["DESTDIR"],defaultPrefix)}}if(process.env["PREFIX"])defaultPrefix=process.env["PREFIX"];const prefix=env.get("prefix")??user.get("prefix")??builtin.get("prefix")??defaultPrefix;const global=readNpmrc(configPath(env.get("globalconfig")??user.get("globalconfig")??builtin.get("globalconfig")??path.join(prefix,"etc","npmrc")));const config=new Map([...builtin,...global,...user,...env]);const scope=packageName.startsWith("@")?packageName.split("/")[0]:void 0;let registry;try{registry=new URL(scope&&config.get(`${scope}:registry`)||config.get("registry")||"https://registry.npmjs.org/")}catch{throw new Error("Invalid npm registry configuration")}if(!["https:","http:"].includes(registry.protocol)||registry.username||registry.password){throw new Error("Invalid npm registry configuration")}if(!registry.pathname.endsWith("/"))registry.pathname+="/";registry.search="";registry.hash="";let authPath=registry.pathname;for(;;){const key=`//${registry.host}${authPath}:`;const token=config.get(`${key}_authToken`);const auth=config.get(`${key}_auth`);const username=config.get(`${key}username`);const password=config.get(`${key}_password`);let authorization;if(token)authorization=`Bearer ${token}`;else if(auth)authorization=`Basic ${auth}`;else if(username&&password){const decodedPassword=Buffer.from(password,"base64").toString("utf8");authorization=`Basic ${Buffer.from(`${username}:${decodedPassword}`).toString("base64")}`}if(authorization){try{new Headers({Authorization:authorization})}catch{throw new Error("Invalid npm registry authentication configuration")}return{registry,authorization}}if(authPath==="")break;authPath=authPath.replace(/([^/]+|\/)$/,"")}return{registry}}__name(getGlobalNpmRegistryConfig,"getGlobalNpmRegistryConfig");var debugLogger=createDebugLogger("UPDATE_CHECK");var FETCH_TIMEOUT_MS=5e3;var UpdateCheckTimeoutError=class extends Error{static{__name(this,"UpdateCheckTimeoutError")}distTag;constructor(timeoutMs,distTag){const suffix=distTag?` for ${distTag}`:"";super(`update check timed out after ${timeoutMs}ms${suffix}`);this.name="UpdateCheckTimeoutError";this.distTag=distTag}};var NETWORK_ERROR_CODES=["ENOTFOUND","ECONNREFUSED","EAI_AGAIN","ETIMEDOUT","ENETUNREACH"];function classifyUpdateCheckError(error){if(error instanceof UpdateCheckTimeoutError)return"timeout";if(error instanceof Error){if(error.name==="TimeoutError")return"timeout";if("killed"in error&&error.killed===true&&"signal"in error&&error.signal==="SIGTERM"){return"timeout"}const errors=[error];if(error.cause instanceof Error)errors.push(error.cause);const matchesCode=__name(code=>errors.some(error2=>error2.code===code||error2.message.includes(code)),"matchesCode");if(NETWORK_ERROR_CODES.some(matchesCode))return"offline"}return"registry"}__name(classifyUpdateCheckError,"classifyUpdateCheckError");function describeUpdateCheckFailure(error,timeoutMs=FETCH_TIMEOUT_MS){switch(classifyUpdateCheckError(error)){case"timeout":return t("registry did not respond within {{seconds}}s",{seconds:String(Math.round(timeoutMs/1e3))});case"offline":return t("registry unreachable");default:return t("registry error")}}__name(describeUpdateCheckFailure,"describeUpdateCheckFailure");async function fetchInfoWithTimeout(notifier,timeoutMs,distTag){let timer;try{return await Promise.race([Promise.resolve(notifier.fetchInfo()),new Promise((_,reject)=>{timer=setTimeout(()=>reject(new UpdateCheckTimeoutError(timeoutMs,distTag)),timeoutMs)})])}finally{if(timer!==void 0)clearTimeout(timer)}}__name(fetchInfoWithTimeout,"fetchInfoWithTimeout");var execFileAsync=promisify(execFile);async function runGlobalNpm(args,run=execFileAsync,platform=process.platform,nodePath=getNpmNodePath(),resolveNpmCliPath=getNpmCliPath){const{stdout}=await run(nodePath,[resolveNpmCliPath(nodePath,platform),...args],{encoding:"utf8",timeout:FETCH_TIMEOUT_MS});return String(stdout).trim()}__name(runGlobalNpm,"runGlobalNpm");async function fetchGlobalNpmUpdateInfo(packageName,currentVersion,distTag,run=execFileAsync){if(isBunRuntime()&&getInstallationInfo("",false).isStandalone){const{registry,authorization}=getGlobalNpmRegistryConfig(packageName);let url=new URL(`-/package/${encodeURIComponent(packageName)}/dist-tags`,registry);const signal=AbortSignal.timeout(FETCH_TIMEOUT_MS);let auth=authorization;let response;for(let redirects=0;;redirects++){response=await fetch(url,{signal,headers:auth?{Authorization:auth}:void 0,redirect:"manual"});if(![301,302,303,307,308].includes(response.status))break;const location=response.headers.get("location");await response.body?.cancel();if(!location||redirects===5){throw new Error("Invalid npm registry redirect")}let next;try{next=new URL(location,url)}catch{throw new Error("Invalid npm registry redirect")}if(!["https:","http:"].includes(next.protocol)||next.username||next.password){throw new Error("Invalid npm registry redirect")}if(next.origin!==url.origin)auth=void 0;url=next}if(!response.ok)throw new Error(`Registry returned HTTP ${response.status}`);const tags=await response.json();if(typeof tags!=="object"||tags===null||Array.isArray(tags)){throw new Error("Invalid registry dist-tags response")}const latest2=Reflect.get(tags,distTag);if(latest2!==void 0&&typeof latest2!=="string"){throw new Error(`Invalid registry ${distTag} version response`)}return{latest:latest2??currentVersion,current:currentVersion,type:"latest",name:packageName}}const output=await runGlobalNpm(["view",packageName,`dist-tags.${distTag}`,"--json","--global"],run);if(output===""){return{latest:currentVersion,current:currentVersion,type:"latest",name:packageName}}const parsed=JSON.parse(output);const latest=typeof parsed==="string"?parsed:Array.isArray(parsed)&&parsed.length===1&&typeof parsed[0]==="string"?parsed[0]:void 0;if(latest===void 0){throw new Error(`Invalid npm ${distTag} version response`)}return{latest,current:currentVersion,type:"latest",name:packageName}}__name(fetchGlobalNpmUpdateInfo,"fetchGlobalNpmUpdateInfo");function getBestAvailableUpdate(nightly,stable){if(!nightly)return stable||null;if(!stable)return nightly||null;const nightlyVer=nightly.latest;const stableVer=stable.latest;if(import_semver.default.coerce(stableVer)?.version===import_semver.default.coerce(nightlyVer)?.version){return nightly}return import_semver.default.gt(stableVer,nightlyVer)?stable:nightly}__name(getBestAvailableUpdate,"getBestAvailableUpdate");async function checkForUpdatesDetailed(fetchGlobalNpm=fetchGlobalNpmUpdateInfo){let currentVersion;try{if(process.env["DEV"]==="true"){return{status:"skipped",reason:"development mode"}}const packageJson=await getPackageJson();if(!packageJson||!packageJson.name||!packageJson.version){return{status:"skipped",reason:"package metadata unavailable"}}const{name,version}=packageJson;currentVersion=version;const isNightly=version.includes("nightly");const createNotifier=__name(distTag=>({fetchInfo:__name(()=>fetchGlobalNpm(name,version,distTag),"fetchInfo")}),"createNotifier");if(isNightly){const[nightlyUpdateInfo,latestUpdateInfo]=await Promise.all([fetchInfoWithTimeout(createNotifier("nightly"),FETCH_TIMEOUT_MS,"nightly"),fetchInfoWithTimeout(createNotifier("latest"),FETCH_TIMEOUT_MS,"latest")]);debugLogger.debug(`fetchInfo returned nightly=${JSON.stringify(nightlyUpdateInfo)} latest=${JSON.stringify(latestUpdateInfo)} for current=${version}`);const bestUpdate=getBestAvailableUpdate(nightlyUpdateInfo,latestUpdateInfo);if(bestUpdate&&import_semver.default.gt(bestUpdate.latest,version)){return{status:"update",info:{message:t("A new version of Qwen Code is available! {{current}} \u2192 {{latest}}",{current:version,latest:bestUpdate.latest}),update:{...bestUpdate,current:version}}}}}else{const updateInfo=await fetchInfoWithTimeout(createNotifier("latest"),FETCH_TIMEOUT_MS,"latest");debugLogger.debug(`fetchInfo returned ${JSON.stringify(updateInfo)} for current=${version}`);if(updateInfo&&import_semver.default.gt(updateInfo.latest,version)){return{status:"update",info:{message:t("Qwen Code update available! {{current}} \u2192 {{latest}}",{current:version,latest:updateInfo.latest}),update:{...updateInfo,current:version}}}}}return{status:"up-to-date",currentVersion:version}}catch(e){const error=e instanceof Error?e:new Error(String(e));debugLogger.warn("Failed to check for updates: "+error);return{status:"error",error,currentVersion}}}__name(checkForUpdatesDetailed,"checkForUpdatesDetailed");async function checkForUpdates(fetchGlobalNpm=fetchGlobalNpmUpdateInfo){const result=await checkForUpdatesDetailed(fetchGlobalNpm);return result.status==="update"?result.info:null}__name(checkForUpdates,"checkForUpdates");export{FETCH_TIMEOUT_MS,UpdateCheckTimeoutError,classifyUpdateCheckError,describeUpdateCheckFailure,runGlobalNpm,fetchGlobalNpmUpdateInfo,checkForUpdatesDetailed,checkForUpdates};
|
|
3
|
+
import{require_semver}from"./chunk-YZUKMJW7.js";import{getInstallationInfo,getNpmCliPath,getNpmNodePath}from"./chunk-26MNTKT2.js";import{t}from"./chunk-NO7VTKRL.js";import{getPackageJson}from"./chunk-O4EDHV64.js";import{isBunRuntime}from"./chunk-WGNF7FPC.js";import{createDebugLogger}from"./chunk-JAUJI56S.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name,__toESM}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var import_semver=__toESM(require_semver(),1);import{execFile}from"node:child_process";import{promisify}from"node:util";init_esbuild_shims();import*as fs from"node:fs";import*as os from"node:os";import*as path from"node:path";function npmrcValue(raw){const value=raw.trim();if(value.startsWith('"')&&value.endsWith('"')){try{const parsed=JSON.parse(value);if(typeof parsed==="string")return parsed}catch{return value}}if(value.startsWith("'")&&value.endsWith("'"))return value.slice(1,-1);return value.replace(/\\([\\;#])|[;#].*$/g,(_match,escaped)=>escaped??"").trim()}__name(npmrcValue,"npmrcValue");function expandEnv(value){return value.replace(/(\\*)\$\{([^}]+)\}/g,(match,escapes,name)=>{if(escapes.length%2)return match.slice(1);return escapes+(process.env[name]??`\${${name}}`)})}__name(expandEnv,"expandEnv");function readNpmrc(filename){let content;try{content=fs.readFileSync(filename,"utf8")}catch(error){if(error.code==="ENOENT")return new Map;throw new Error("Unable to read npm registry configuration")}const config=new Map;let inSection=false;for(const line of content.split(/\r?\n/)){if(/^\s*\[/.test(line))inSection=true;if(inSection||/^\s*[;#]/.test(line))continue;const match=line.match(/^\s*([^=]+?)\s*=(.*)$/);if(!match)continue;config.set(expandEnv(npmrcValue(match[1])),expandEnv(npmrcValue(match[2])))}return config}__name(readNpmrc,"readNpmrc");function getGlobalNpmRegistryConfig(packageName){const env=new Map;for(const[key,value]of Object.entries(process.env)){if(!/^npm_config_/i.test(key)||!value)continue;const suffix=key.slice("npm_config_".length);const name=suffix.startsWith("//")?suffix:suffix.toLowerCase().replace(/(?!^)_/g,"-");env.set(expandEnv(name),expandEnv(value.trim()))}const home=os.homedir();const configPath=__name(value=>{if(/^~(?=\/|$)/.test(value)){if(!path.isAbsolute(home)){throw new Error("Cannot resolve npm configuration without an absolute home directory")}value=value.replace(/^~/,home)}return path.resolve(value)},"configPath");const builtin=readNpmrc(path.join(path.dirname(process.execPath),...process.platform==="win32"?["node_modules","npm","npmrc"]:["..","lib","node_modules","npm","npmrc"]));const userConfig=env.get("userconfig")??builtin.get("userconfig")??(path.isAbsolute(home)?path.join(home,".npmrc"):void 0);const user=userConfig?readNpmrc(configPath(userConfig)):new Map;let defaultPrefix=path.dirname(process.execPath);if(process.platform!=="win32"){defaultPrefix=path.dirname(defaultPrefix);if(process.env["DESTDIR"]){defaultPrefix=path.join(process.env["DESTDIR"],defaultPrefix)}}if(process.env["PREFIX"])defaultPrefix=process.env["PREFIX"];const prefix=env.get("prefix")??user.get("prefix")??builtin.get("prefix")??defaultPrefix;const global=readNpmrc(configPath(env.get("globalconfig")??user.get("globalconfig")??builtin.get("globalconfig")??path.join(prefix,"etc","npmrc")));const config=new Map([...builtin,...global,...user,...env]);const scope=packageName.startsWith("@")?packageName.split("/")[0]:void 0;let registry;try{registry=new URL(scope&&config.get(`${scope}:registry`)||config.get("registry")||"https://registry.npmjs.org/")}catch{throw new Error("Invalid npm registry configuration")}if(!["https:","http:"].includes(registry.protocol)||registry.username||registry.password){throw new Error("Invalid npm registry configuration")}if(!registry.pathname.endsWith("/"))registry.pathname+="/";registry.search="";registry.hash="";let authPath=registry.pathname;for(;;){const key=`//${registry.host}${authPath}:`;const token=config.get(`${key}_authToken`);const auth=config.get(`${key}_auth`);const username=config.get(`${key}username`);const password=config.get(`${key}_password`);let authorization;if(token)authorization=`Bearer ${token}`;else if(auth)authorization=`Basic ${auth}`;else if(username&&password){const decodedPassword=Buffer.from(password,"base64").toString("utf8");authorization=`Basic ${Buffer.from(`${username}:${decodedPassword}`).toString("base64")}`}if(authorization){try{new Headers({Authorization:authorization})}catch{throw new Error("Invalid npm registry authentication configuration")}return{registry,authorization}}if(authPath==="")break;authPath=authPath.replace(/([^/]+|\/)$/,"")}return{registry}}__name(getGlobalNpmRegistryConfig,"getGlobalNpmRegistryConfig");var debugLogger=createDebugLogger("UPDATE_CHECK");var FETCH_TIMEOUT_MS=5e3;var UpdateCheckTimeoutError=class extends Error{static{__name(this,"UpdateCheckTimeoutError")}distTag;constructor(timeoutMs,distTag){const suffix=distTag?` for ${distTag}`:"";super(`update check timed out after ${timeoutMs}ms${suffix}`);this.name="UpdateCheckTimeoutError";this.distTag=distTag}};var NETWORK_ERROR_CODES=["ENOTFOUND","ECONNREFUSED","EAI_AGAIN","ETIMEDOUT","ENETUNREACH"];function classifyUpdateCheckError(error){if(error instanceof UpdateCheckTimeoutError)return"timeout";if(error instanceof Error){if(error.name==="TimeoutError")return"timeout";if("killed"in error&&error.killed===true&&"signal"in error&&error.signal==="SIGTERM"){return"timeout"}const errors=[error];if(error.cause instanceof Error)errors.push(error.cause);const matchesCode=__name(code=>errors.some(error2=>error2.code===code||error2.message.includes(code)),"matchesCode");if(NETWORK_ERROR_CODES.some(matchesCode))return"offline"}return"registry"}__name(classifyUpdateCheckError,"classifyUpdateCheckError");function describeUpdateCheckFailure(error,timeoutMs=FETCH_TIMEOUT_MS){switch(classifyUpdateCheckError(error)){case"timeout":return t("registry did not respond within {{seconds}}s",{seconds:String(Math.round(timeoutMs/1e3))});case"offline":return t("registry unreachable");default:return t("registry error")}}__name(describeUpdateCheckFailure,"describeUpdateCheckFailure");async function fetchInfoWithTimeout(notifier,timeoutMs,distTag){let timer;try{return await Promise.race([Promise.resolve(notifier.fetchInfo()),new Promise((_,reject)=>{timer=setTimeout(()=>reject(new UpdateCheckTimeoutError(timeoutMs,distTag)),timeoutMs)})])}finally{if(timer!==void 0)clearTimeout(timer)}}__name(fetchInfoWithTimeout,"fetchInfoWithTimeout");var execFileAsync=promisify(execFile);async function runGlobalNpm(args,run=execFileAsync,platform=process.platform,nodePath=getNpmNodePath(),resolveNpmCliPath=getNpmCliPath){const{stdout}=await run(nodePath,[resolveNpmCliPath(nodePath,platform),...args],{encoding:"utf8",timeout:FETCH_TIMEOUT_MS});return String(stdout).trim()}__name(runGlobalNpm,"runGlobalNpm");async function fetchGlobalNpmUpdateInfo(packageName,currentVersion,distTag,run=execFileAsync){if(isBunRuntime()&&getInstallationInfo("",false).isStandalone){const{registry,authorization}=getGlobalNpmRegistryConfig(packageName);let url=new URL(`-/package/${encodeURIComponent(packageName)}/dist-tags`,registry);const signal=AbortSignal.timeout(FETCH_TIMEOUT_MS);let auth=authorization;let response;for(let redirects=0;;redirects++){response=await fetch(url,{signal,headers:auth?{Authorization:auth}:void 0,redirect:"manual"});if(![301,302,303,307,308].includes(response.status))break;const location=response.headers.get("location");await response.body?.cancel();if(!location||redirects===5){throw new Error("Invalid npm registry redirect")}let next;try{next=new URL(location,url)}catch{throw new Error("Invalid npm registry redirect")}if(!["https:","http:"].includes(next.protocol)||next.username||next.password){throw new Error("Invalid npm registry redirect")}if(next.origin!==url.origin)auth=void 0;url=next}if(!response.ok)throw new Error(`Registry returned HTTP ${response.status}`);const tags=await response.json();if(typeof tags!=="object"||tags===null||Array.isArray(tags)){throw new Error("Invalid registry dist-tags response")}const latest2=Reflect.get(tags,distTag);if(latest2!==void 0&&typeof latest2!=="string"){throw new Error(`Invalid registry ${distTag} version response`)}return{latest:latest2??currentVersion,current:currentVersion,type:"latest",name:packageName}}const output=await runGlobalNpm(["view",packageName,`dist-tags.${distTag}`,"--json","--global"],run);if(output===""){return{latest:currentVersion,current:currentVersion,type:"latest",name:packageName}}const parsed=JSON.parse(output);const latest=typeof parsed==="string"?parsed:Array.isArray(parsed)&&parsed.length===1&&typeof parsed[0]==="string"?parsed[0]:void 0;if(latest===void 0){throw new Error(`Invalid npm ${distTag} version response`)}return{latest,current:currentVersion,type:"latest",name:packageName}}__name(fetchGlobalNpmUpdateInfo,"fetchGlobalNpmUpdateInfo");function getBestAvailableUpdate(nightly,stable){if(!nightly)return stable||null;if(!stable)return nightly||null;const nightlyVer=nightly.latest;const stableVer=stable.latest;if(import_semver.default.coerce(stableVer)?.version===import_semver.default.coerce(nightlyVer)?.version){return nightly}return import_semver.default.gt(stableVer,nightlyVer)?stable:nightly}__name(getBestAvailableUpdate,"getBestAvailableUpdate");async function checkForUpdatesDetailed(fetchGlobalNpm=fetchGlobalNpmUpdateInfo){let currentVersion;try{if(process.env["DEV"]==="true"){return{status:"skipped",reason:"development mode"}}const packageJson=await getPackageJson();if(!packageJson||!packageJson.name||!packageJson.version){return{status:"skipped",reason:"package metadata unavailable"}}const{name,version}=packageJson;currentVersion=version;const isNightly=version.includes("nightly");const createNotifier=__name(distTag=>({fetchInfo:__name(()=>fetchGlobalNpm(name,version,distTag),"fetchInfo")}),"createNotifier");if(isNightly){const[nightlyUpdateInfo,latestUpdateInfo]=await Promise.all([fetchInfoWithTimeout(createNotifier("nightly"),FETCH_TIMEOUT_MS,"nightly"),fetchInfoWithTimeout(createNotifier("latest"),FETCH_TIMEOUT_MS,"latest")]);debugLogger.debug(`fetchInfo returned nightly=${JSON.stringify(nightlyUpdateInfo)} latest=${JSON.stringify(latestUpdateInfo)} for current=${version}`);const bestUpdate=getBestAvailableUpdate(nightlyUpdateInfo,latestUpdateInfo);if(bestUpdate&&import_semver.default.gt(bestUpdate.latest,version)){return{status:"update",info:{message:t("A new version of Qwen Code is available! {{current}} \u2192 {{latest}}",{current:version,latest:bestUpdate.latest}),update:{...bestUpdate,current:version}}}}}else{const updateInfo=await fetchInfoWithTimeout(createNotifier("latest"),FETCH_TIMEOUT_MS,"latest");debugLogger.debug(`fetchInfo returned ${JSON.stringify(updateInfo)} for current=${version}`);if(updateInfo&&import_semver.default.gt(updateInfo.latest,version)){return{status:"update",info:{message:t("Qwen Code update available! {{current}} \u2192 {{latest}}",{current:version,latest:updateInfo.latest}),update:{...updateInfo,current:version}}}}}return{status:"up-to-date",currentVersion:version}}catch(e){const error=e instanceof Error?e:new Error(String(e));debugLogger.warn("Failed to check for updates: "+error);return{status:"error",error,currentVersion}}}__name(checkForUpdatesDetailed,"checkForUpdatesDetailed");async function checkForUpdates(fetchGlobalNpm=fetchGlobalNpmUpdateInfo){const result=await checkForUpdatesDetailed(fetchGlobalNpm);return result.status==="update"?result.info:null}__name(checkForUpdates,"checkForUpdates");export{FETCH_TIMEOUT_MS,UpdateCheckTimeoutError,classifyUpdateCheckError,describeUpdateCheckFailure,runGlobalNpm,fetchGlobalNpmUpdateInfo,checkForUpdatesDetailed,checkForUpdates};
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2026 Alibaba Inc.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{sanitizeProviderBaseUrl}from"./chunk-GT4TCQ3R.js";import{resolveModelConfig}from"./chunk-
|
|
3
|
+
import{sanitizeProviderBaseUrl}from"./chunk-GT4TCQ3R.js";import{resolveModelConfig}from"./chunk-2JGTWRZJ.js";import{getBuiltinDeepSeekReasoning,resolveModelSelectionAuthType,resolveProviderProtocol,stripRuntimeSnapshotPrefix,tryResolveModelProtocol}from"./chunk-ET2Z7ZGF.js";import{MODEL_GENERATION_CONFIG_FIELDS,REASONING_EFFORT_TIERS,normalizeReasoningEffort}from"./chunk-GOR7FFVE.js";import{AuthType}from"./chunk-ZZZAYAJW.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var AUTH_ENV_MODEL_VARS={["openai"]:["OPENAI_MODEL","QWEN_MODEL"],["openai-responses"]:["OPENAI_MODEL"],["gemini"]:["GEMINI_MODEL"],["vertex-ai"]:["GOOGLE_MODEL"],["anthropic"]:["ANTHROPIC_MODEL"],["qwen-oauth"]:[]};function collectProviderModelsForProtocol(modelProviders,providerProtocol,protocol){if(!modelProviders){return[]}const out=[];for(const[providerId,models]of Object.entries(modelProviders)){if(!Array.isArray(models)){continue}out.push(...models.filter(model=>tryResolveModelProtocol(providerId,model,providerProtocol)===protocol))}return out}__name(collectProviderModelsForProtocol,"collectProviderModelsForProtocol");function findProviderIdForModel(modelProviders,providerProtocol,protocol,modelProvider){if(!modelProviders||!modelProvider){return void 0}for(const[providerId,models]of Object.entries(modelProviders)){if(!Array.isArray(models)){continue}if(models.includes(modelProvider)&&tryResolveModelProtocol(providerId,modelProvider,providerProtocol)===protocol){return providerId}}return void 0}__name(findProviderIdForModel,"findProviderIdForModel");function buildSkippedProviderWarnings(modelProviders,providerProtocol){if(!modelProviders){return[]}const warnings=[];const known=Object.values(AuthType).filter(value=>value!=="openai-responses").join(", ");for(const[providerId,models]of Object.entries(modelProviders)){if(!Array.isArray(models)||models.length===0){continue}const protocol=resolveProviderProtocol(providerId,providerProtocol);if(protocol==="qwen-oauth"&&providerId!=="qwen-oauth"){warnings.push(`Warning: modelProviders provider "${providerId}" maps to "qwen-oauth" via providerProtocol, but qwen-oauth uses hard-coded models only; its ${models.length} model(s) are ignored.`);continue}if(protocol!==void 0){continue}const mapped=providerProtocol&&Object.hasOwn(providerProtocol,providerId)?providerProtocol[providerId]:void 0;warnings.push(mapped!==void 0?`Warning: providerProtocol["${providerId}"] = "${mapped}" is not a known protocol (expected one of: ${known}); its ${models.length} model(s) are ignored.`:`Warning: modelProviders provider "${providerId}" is not a built-in protocol (${known}) and has no providerProtocol mapping; its ${models.length} model(s) are ignored. Add providerProtocol["${providerId}"] (e.g. "openai") to enable them.`)}return warnings}__name(buildSkippedProviderWarnings,"buildSkippedProviderWarnings");function getIgnoredTopLevelGenerationConfigFields(settingsGenerationConfig,modelProvider){if(!settingsGenerationConfig||!modelProvider){return[]}const providerGenerationConfig=modelProvider.generationConfig??{};return MODEL_GENERATION_CONFIG_FIELDS.filter(field=>Object.hasOwn(settingsGenerationConfig,field)&&!Object.hasOwn(providerGenerationConfig,field))}__name(getIgnoredTopLevelGenerationConfigFields,"getIgnoredTopLevelGenerationConfigFields");function buildIgnoredTopLevelGenerationConfigWarning(providerId,modelProvider,ignoredFields){if(ignoredFields.length===0){return void 0}const fieldList=ignoredFields.map(field=>`model.generationConfig.${field}`).join(", ");const isSingular=ignoredFields.length===1;const verb=isSingular?"is":"are";const fieldReference=isSingular?"this field":"these fields";const pronoun=isSingular?"it":"them";return`Warning: ${fieldList} ${verb} ignored for provider model "${modelProvider.id}" from modelProviders.${providerId}. Move ${fieldReference} to modelProviders.${providerId}[].generationConfig for that model if you want ${pronoun} to apply.`}__name(buildIgnoredTopLevelGenerationConfigWarning,"buildIgnoredTopLevelGenerationConfigWarning");function getAuthTypeFromEnv(env=process.env){if(env["QWEN_OAUTH"]){return"qwen-oauth"}if(env["OPENAI_API_KEY"]&&(env["OPENAI_MODEL"]||env["QWEN_MODEL"])&&env["OPENAI_BASE_URL"]){return"openai"}if(env["GEMINI_API_KEY"]&&env["GEMINI_MODEL"]){return"gemini"}if(env["GOOGLE_API_KEY"]&&env["GOOGLE_MODEL"]){return"vertex-ai"}if(env["GOOGLE_CLOUD_PROJECT"]&&env["GOOGLE_MODEL"]){return"vertex-ai"}if(env["ANTHROPIC_API_KEY"]&&env["ANTHROPIC_MODEL"]&&env["ANTHROPIC_BASE_URL"]){return"anthropic"}return void 0}__name(getAuthTypeFromEnv,"getAuthTypeFromEnv");function resolveCliGenerationConfig(inputs){const{argv,settings,selectedAuthType}=inputs;const env=inputs.env??process.env;let resolvedModel;let sourceEnvVar;let resolvedFromSettings=false;if(argv.model){resolvedModel=argv.model}else if(settings.model?.name){resolvedModel=stripRuntimeSnapshotPrefix(settings.model.name);resolvedFromSettings=true}else if(selectedAuthType&&AUTH_ENV_MODEL_VARS[selectedAuthType]){for(const envVar of AUTH_ENV_MODEL_VARS[selectedAuthType]){if(env[envVar]){resolvedModel=env[envVar];sourceEnvVar=envVar;break}}}const authType=selectedAuthType&&resolvedModel!==void 0?resolveModelSelectionAuthType(selectedAuthType,resolvedModel,settings.modelProviders,settings.providerProtocol,resolvedFromSettings?settings.model?.baseUrl:void 0):selectedAuthType;let modelProvider;let disambiguationWarning;if(resolvedModel&&authType&&settings.modelProviders){const providers=collectProviderModelsForProtocol(settings.modelProviders,settings.providerProtocol,authType);if(providers.length>0){const persistedBaseUrl=settings.model?.baseUrl;if(resolvedFromSettings&&persistedBaseUrl){const exactMatch=providers.find(p=>p.id===resolvedModel&&p.baseUrl===persistedBaseUrl);modelProvider=exactMatch??providers.find(p=>p.id===resolvedModel);if(!exactMatch&&modelProvider){const fallbackBaseUrl=modelProvider.baseUrl===void 0?"(default baseUrl)":sanitizeProviderBaseUrl(modelProvider.baseUrl);disambiguationWarning=`Persisted model.baseUrl '${sanitizeProviderBaseUrl(persistedBaseUrl)}' no longer matches any provider for model '${resolvedModel}' (authType '${authType}'); using the first id match ('${fallbackBaseUrl}'). Re-select the model to update it.`}}else{modelProvider=providers.find(p=>p.id===resolvedModel)}}}const allModelEnvVars=Object.values(AUTH_ENV_MODEL_VARS).flat();const filteredEnv={...env};if(sourceEnvVar){for(const envVar of allModelEnvVars){if(envVar!==sourceEnvVar){delete filteredEnv[envVar]}}}else{for(const envVar of allModelEnvVars){delete filteredEnv[envVar]}}const configSources={authType,cli:{model:argv.model,apiKey:argv.openaiApiKey,baseUrl:argv.openaiBaseUrl},settings:{model:settings.model?.name?stripRuntimeSnapshotPrefix(settings.model.name):void 0,apiKey:settings.security?.auth?.apiKey,baseUrl:settings.security?.auth?.baseUrl,generationConfig:settings.model?.generationConfig},modelProvider,env:filteredEnv};const resolved=resolveModelConfig(configSources);const ignoredGenerationConfigWarning=authType&&modelProvider?buildIgnoredTopLevelGenerationConfigWarning(findProviderIdForModel(settings.modelProviders,settings.providerProtocol,authType,modelProvider)??authType,modelProvider,getIgnoredTopLevelGenerationConfigFields(settings.model?.generationConfig,modelProvider)):void 0;const enableOpenAILogging=(typeof argv.openaiLogging==="undefined"?settings.model?.enableOpenAILogging:argv.openaiLogging)??false;const openAILoggingDir=argv.openaiLoggingDir||settings.model?.openAILoggingDir;const generationConfig={...resolved.config,enableOpenAILogging,openAILoggingDir};const rawReasoningEffort=settings.model?.reasoningEffort;const reasoningDisabled=rawReasoningEffort==="none";const reasoningEffort=reasoningDisabled?void 0:normalizeReasoningEffort(rawReasoningEffort);const invalidReasoningEffortWarning=rawReasoningEffort&&!reasoningDisabled&&!reasoningEffort?`Ignoring invalid model.reasoningEffort "${rawReasoningEffort}"; expected one of: none, ${REASONING_EFFORT_TIERS.join(", ")}.`:void 0;if(reasoningDisabled&&generationConfig.thinkingMandatory!==true){generationConfig.reasoning=false;if(getBuiltinDeepSeekReasoning({...generationConfig,authType})){resolved.sources["reasoning"]={kind:"settings",settingsPath:"model.reasoningEffort"}}}else if(reasoningEffort&&generationConfig.reasoning!==false){generationConfig.reasoning={...generationConfig.reasoning??{},effort:reasoningEffort}}return{authType,model:resolved.config.model||"",apiKey:resolved.config.apiKey||"",baseUrl:resolved.config.baseUrl||"",generationConfig,...modelProvider?{registryBaseUrl:modelProvider.baseUrl??null}:{},sources:resolved.sources,warnings:[...resolved.warnings,...invalidReasoningEffortWarning?[invalidReasoningEffortWarning]:[],...disambiguationWarning?[disambiguationWarning]:[],...ignoredGenerationConfigWarning?[ignoredGenerationConfigWarning]:[],...buildSkippedProviderWarnings(settings.modelProviders,settings.providerProtocol)]}}__name(resolveCliGenerationConfig,"resolveCliGenerationConfig");export{collectProviderModelsForProtocol,getAuthTypeFromEnv,resolveCliGenerationConfig};
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2025 Qwen Team
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{runExitCleanup}from"./chunk-
|
|
3
|
+
import{runExitCleanup}from"./chunk-AYVCT5FF.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var RELAUNCH_EXIT_CODE=42;var UPDATE_RELAUNCH_EXIT_CODE=43;var UPDATE_COMPLETE_EXIT_CODE=44;var SKIP_UPDATE_CHECK_ENV_VAR="QWEN_CODE_SKIP_UPDATE_CHECK_ONCE";var CUSTOM_SANDBOX_IMAGE_ENV_VAR="QWEN_CODE_CUSTOM_SANDBOX_IMAGE";var HOST_UPDATE_RELAUNCH_ENV_VAR="QWEN_CODE_HOST_UPDATE_RELAUNCH";var UPDATE_ON_EXIT_MESSAGE="qwen-code:update-on-exit";var inProcessUpdateRelaunch;var supervisedInProcess=false;var updateOnExitRequested=false;var updatingOnExit=false;function superviseInProcess(onUpdateRelaunch){supervisedInProcess=true;inProcessUpdateRelaunch=onUpdateRelaunch}__name(superviseInProcess,"superviseInProcess");function getRelaunchExecArgv(){const needsExposeGc=typeof globalThis.gc==="function"&&!process.execArgv.includes("--expose-gc");return needsExposeGc?[...process.execArgv,"--expose-gc"]:[...process.execArgv]}__name(getRelaunchExecArgv,"getRelaunchExecArgv");async function relaunchApp(){await runExitCleanup();const proc=process;if(supervisedInProcess&&proc.execve){proc.execve(process.execPath,[process.execPath,...getRelaunchExecArgv(),...process.argv.slice(1)])}process.exit(RELAUNCH_EXIT_CODE)}__name(relaunchApp,"relaunchApp");async function exitCleanly(code){if(updatingOnExit)return new Promise(()=>{});if(code===0&&updateOnExitRequested&&inProcessUpdateRelaunch){updateOnExitRequested=false;updatingOnExit=true;try{code=await inProcessUpdateRelaunch(false)}catch{code=1}}process.exit(code)}__name(exitCleanly,"exitCleanly");async function relaunchForUpdate(){await runExitCleanup();if(inProcessUpdateRelaunch){process.exit(await inProcessUpdateRelaunch(true))}process.exit(UPDATE_RELAUNCH_EXIT_CODE)}__name(relaunchForUpdate,"relaunchForUpdate");function requestUpdateOnExit(){if(inProcessUpdateRelaunch){updateOnExitRequested=true;return true}if(!process.send)return false;try{process.send({type:UPDATE_ON_EXIT_MESSAGE});return true}catch{return false}}__name(requestUpdateOnExit,"requestUpdateOnExit");export{RELAUNCH_EXIT_CODE,UPDATE_RELAUNCH_EXIT_CODE,UPDATE_COMPLETE_EXIT_CODE,SKIP_UPDATE_CHECK_ENV_VAR,CUSTOM_SANDBOX_IMAGE_ENV_VAR,HOST_UPDATE_RELAUNCH_ENV_VAR,UPDATE_ON_EXIT_MESSAGE,superviseInProcess,getRelaunchExecArgv,relaunchApp,exitCleanly,relaunchForUpdate,requestUpdateOnExit};
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2025 Google LLC
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{JsonOutputAdapter}from"./chunk-
|
|
3
|
+
import{JsonOutputAdapter}from"./chunk-NVOI6UDQ.js";import{runAgentLoop}from"./chunk-CBE6ZIHU.js";import{normalizePartList}from"./chunk-HIO3M52C.js";import{formatLoopDetectedMessage,settleChatRecording,subscribeToHeadlessChatRecordingFailures}from"./chunk-BGELKSQ4.js";import{StreamJsonOutputAdapter}from"./chunk-WGFX3EL3.js";import{handleAtCommand}from"./chunk-NEKPQLFY.js";import{buildInitialSystemReminders,buildSystemMessage,computeUsageFromMetrics,createAgentToolProgressHandler,createToolProgressHandler,extractPartsFromUserMessage,handleSlashCommand,insertAfterFunctionResponses,isSlashCommand}from"./chunk-GSPGIGO5.js";import{ModSession}from"./chunk-H3IR3GIE.js";import{formatDuration}from"./chunk-ET5M5WFN.js";import{cleanupReviewWorktreeLeases}from"./chunk-OOJ2AQT3.js";import{RunBudgetEnforcer}from"./chunk-VRKYBH5G.js";import{sanitizeTerminalText}from"./chunk-64CA3W6G.js";import{isInlineModelOverrideAllowed}from"./chunk-GT4TCQ3R.js";import{AlreadyReportedError,handleBudgetExceededError,handleCancellationError,handleError,handleMaxTurnsExceededError,handleToolError}from"./chunk-ZENMAISJ.js";import{buildGoalContinuationParts,buildSessionRecoveryPlanFromApiHistory,detectAutonomousSentinel,detectLoopSentinel}from"./chunk-OU7CEG7Q.js";import{restoreWorktreeContext}from"./chunk-OMDTFGTX.js";import{executeToolCall}from"./chunk-CGDFZEER.js";import{GoalPersistenceUnavailableError,PLAN_MODE_ENTRY_SIBLING_SKIP_MESSAGE,createDuplicateProviderToolCallResponse,finalizeToolResponses,findPlanModeEntryBatchBoundaryIndex,findRepeatedDuplicateProviderToolCall,getCachedToolCallFingerprint,getLastApiPromptCancellation,goalToolResultProvenance,isReplayOfHandledToolCall,isToolCallConcurrencySafe,markDuplicateProviderToolCallResponseSent,parseAndFormatApiError,partitionByConcurrencySafety,recordHandledToolCall}from"./chunk-2JGTWRZJ.js";import{shellResultText}from"./chunk-T7CHK6C2.js";import{GOAL_PAUSE_REASON_HEADLESS_RUN_ENDED,GOAL_PAUSE_REASON_USER_INTERRUPT,addAgentOutputMessageAttributes,goalPauseReasonForHeadlessFailure,goalPauseReasonForRunBudget}from"./chunk-HW6AWS7W.js";import{parsePositiveIntegerEnv}from"./chunk-BG67XABA.js";import{promptIdContext}from"./chunk-MWGB5RCF.js";import{formatFullTurnVisionNotice,formatVisionBridgeNotice,getFullTurnVisionModelSelector,hasImageParts,runVisionBridge,shouldRunVisionBridge,splitImageParts,uiTelemetryService}from"./chunk-ZWPSBU7K.js";import{clampInlineMediaPart}from"./chunk-Q6UAOTP3.js";import{endInteractionSpan,getActiveInteractionSpan,isTelemetrySdkInitialized,shutdownTelemetry}from"./chunk-3XVPZY7X.js";import{registerCleanup}from"./chunk-AYVCT5FF.js";import{isWrappedSystemReminderPart}from"./chunk-B3ZFUGTC.js";import{ToolNames,canonicalToolName}from"./chunk-SBZFGYYS.js";import{createDebugLogger}from"./chunk-JAUJI56S.js";import{FatalInputError,getErrorType}from"./chunk-XYB7GC5U.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var debugLogger=createDebugLogger("NON_INTERACTIVE_CLI");var TurnInterruptedError=class extends Error{static{__name(this,"TurnInterruptedError")}constructor(){super("Operation cancelled.");this.name="TurnInterruptedError"}};var ModTurnAbortedError=class extends TurnInterruptedError{static{__name(this,"ModTurnAbortedError")}constructor(){super();this.message="A Mod ended the turn."}};var restoredBackgroundAgentSessions=new WeakMap;var STRUCTURED_SHUTDOWN_HOLDBACK_MS=500;function isHeadlessLoopSentinel(prompt){return detectLoopSentinel(prompt)!==null||detectAutonomousSentinel(prompt)!==null}__name(isHeadlessLoopSentinel,"isHeadlessLoopSentinel");var SUPPRESSED_OUTPUT_SUCCESS="Skipped: this turn's structured_output contract took precedence as the terminal output.";var SUPPRESSED_OUTPUT_RETRY=`${SUPPRESSED_OUTPUT_SUCCESS} Re-issue this call in a separate turn if needed.`;function suppressedOutputBody(structuredCaptured){return structuredCaptured?SUPPRESSED_OUTPUT_SUCCESS:SUPPRESSED_OUTPUT_RETRY}__name(suppressedOutputBody,"suppressedOutputBody");function sameGoalPermit(left,right){return left?.goalId===right.goalId&&left.revision===right.revision&&left.turnId===right.turnId}__name(sameGoalPermit,"sameGoalPermit");function formatGoalState(snapshot,operation){const goal=snapshot.goal;if(!goal){return operation==="clear"?"Goal cleared.":"No Goal is set."}const status=goal.status==="usage_limited"?"usage limited":goal.status;const summary=`Goal ${status}: ${goal.objective}`;const usage=[];if(goal.turnCount>0){const turns=goal.turnBudget??goal.turnCount;usage.push(`${goal.turnCount}${goal.turnBudget===void 0?"":` of ${goal.turnBudget}`} ${turns===1?"turn":"turns"}`)}if(goal.activeTimeMs>0&&goal.activeTimeBudgetMs!==void 0){usage.push(`${formatDuration(goal.activeTimeMs,{hideTrailingZeros:true})} of ${formatDuration(goal.activeTimeBudgetMs,{hideTrailingZeros:true})} active`)}if(goal.tokensUsed>0){const used=goal.tokensUsed.toLocaleString("en-US");usage.push(goal.tokenBudget===void 0?`${used} tokens`:`${used} of ${goal.tokenBudget.toLocaleString("en-US")} tokens`)}const lines=[summary];if(usage.length>0)lines.push(`Usage: ${usage.join(" \xB7 ")}`);if(goal.status!=="active"&&goal.lastReason){lines.push(`Reason: ${sanitizeTerminalText(goal.lastReason)}`)}return lines.join("\n")}__name(formatGoalState,"formatGoalState");async function claimUserGoalTurn(runtime,turnKey,signal){const immediate=runtime.permitForTurn(turnKey)??runtime.beginTurn(turnKey);if(immediate||runtime.getSnapshot().goal?.status!=="active"){return immediate}return new Promise((resolve,reject)=>{let settled=false;let unsubscribe=__name(()=>{},"unsubscribe");const finish=__name((permit,error)=>{if(settled)return;settled=true;unsubscribe();signal.removeEventListener("abort",onAbort);if(error!==void 0)reject(error);else resolve(permit)},"finish");const inspect=__name(()=>{try{const permit=runtime.permitForTurn(turnKey);if(permit||runtime.getSnapshot().goal?.status!=="active"){finish(permit)}}catch(error){finish(void 0,error)}},"inspect");const onAbort=__name(()=>finish(void 0),"onAbort");unsubscribe=runtime.subscribe(inspect);signal.addEventListener("abort",onAbort,{once:true});if(signal.aborted)onAbort();else inspect()})}__name(claimUserGoalTurn,"claimUserGoalTurn");function skipHeadlessLoopSentinel(scheduler,job){if(!isHeadlessLoopSentinel(job.prompt)){return false}if(job.recurring&&!job.durable){debugLogger.debug("skipHeadlessLoopSentinel: cleaning up recurring session loop.md cron in headless mode",{jobId:job.id});void scheduler.delete(job.id).catch(()=>{})}return true}__name(skipHeadlessLoopSentinel,"skipHeadlessLoopSentinel");var PROVIDER_DUPLICATE_ID_LOOP_STOP={loopType:"global_tool_call_duplicate",loopReason:"provider_duplicate_id"};function emitLoopDetectedMessage(config,stop){const message=formatLoopDetectedMessage(stop);if(config.getOutputFormat()!=="text"){return message}process.stderr.write(`${message}
|
|
4
4
|
`);return message}__name(emitLoopDetectedMessage,"emitLoopDetectedMessage");async function emitNonInteractiveFinalMessage(params){const{message,isError,adapter,config}=params;adapter.startAssistantMessage();adapter.processEvent({type:"content",value:message});adapter.finalizeAssistantMessage();const metrics=uiTelemetryService.getMetrics();const usage=computeUsageFromMetrics(metrics);const outputFormat=config.getOutputFormat();const stats=outputFormat==="json"?uiTelemetryService.getMetrics():void 0;await params.beforeEmit();adapter.emitResult({isError,durationMs:Date.now()-params.startTimeMs,apiDurationMs:0,numTurns:0,errorMessage:isError?message:void 0,usage,stats,summary:message})}__name(emitNonInteractiveFinalMessage,"emitNonInteractiveFinalMessage");function partitionHeadlessToolCalls(requests,config){let skillBefore=false;return partitionByConcurrencySafety(requests,request=>{const executionRequest=getHeadlessExecutionRequest(request,config);const canonicalName=canonicalToolName(executionRequest.name);const kind=config.getToolRegistry().getTool(canonicalName)?.kind;const inputMayChange=kind==="execute"&&(skillBefore||!config.getDisableAllHooks()&&(config.hasHooksForEvent("PreToolUse")||config.hasHooksForEvent("PermissionRequest")));skillBefore||=canonicalName===ToolNames.SKILL;return!inputMayChange&&isToolCallConcurrencySafe(executionRequest.name,kind,executionRequest.args)})}__name(partitionHeadlessToolCalls,"partitionHeadlessToolCalls");function getHeadlessExecutionRequest(request,config){if(canonicalToolName(request.name)!==ToolNames.TOOL_CALL){return request}const targetName=request.args["name"];let targetArgs=request.args["arguments"];if(typeof targetArgs==="string"){try{targetArgs=JSON.parse(targetArgs)}catch{return request}}if(typeof targetName!=="string"||typeof targetArgs!=="object"||targetArgs===null||Array.isArray(targetArgs)){return request}const registry=config.getToolRegistry();const target=registry.getTool(canonicalToolName(targetName));if(!target||!registry.isDeferredAndHidden(target.name)){return request}return{...request,name:target.name,args:targetArgs}}__name(getHeadlessExecutionRequest,"getHeadlessExecutionRequest");async function runNonInteractive(config,settings,input,prompt_id,options={}){return promptIdContext.run(prompt_id,async()=>{let adapter;const outputFormat=config.getOutputFormat();if(options.adapter){adapter=options.adapter}else if(outputFormat==="stream-json"){adapter=new StreamJsonOutputAdapter(config,config.getIncludePartialMessages())}else{adapter=new JsonOutputAdapter(config)}const ownsAdapter=options.adapter===void 0;const modSession=options.modSession??ModSession.create(config,settings,adapter);const ownsModSession=options.modSession===void 0;let modTurn;const unsubscribeRecordingFailure=ownsAdapter?subscribeToHeadlessChatRecordingFailures(config,adapter):void 0;let chatRecordingSettlement;const settleBeforeTerminalOutput=__name(()=>{chatRecordingSettlement??=(async()=>{await modTurn?.complete(abortController.signal.aborted&&!budgetEnforcer.getExceeded()?"aborted":"error");if(ownsModSession)await modSession?.close();modSession?.flushLogs();await settleChatRecording(config,{finalize:ownsAdapter})})();return chatRecordingSettlement},"settleBeforeTerminalOutput");const emitResult=__name(async result=>{await settleBeforeTerminalOutput();adapter.emitResult(result);options.onResultEmitted?.();await modSession?.flushOutput()},"emitResult");const sessionId=config.getSessionId();const permissionMode=config.getApprovalMode();const cleanupReviewWorktrees=__name(gitTimeout=>{if(config.getShellExecutionSandbox?.())return;cleanupReviewWorktreeLeases({sessionId,promptId:prompt_id,repositoryRoot:config.getProjectRoot(),gitTimeout})},"cleanupReviewWorktrees");const unregisterReviewWorktreeCleanup=registerCleanup(()=>cleanupReviewWorktrees(1e3));let turnCount=0;let limitedTurnCount=0;let totalApiDurationMs=0;const startTime=Date.now();let activeInteractionPromptId=prompt_id;let activeInteractionOwner;const selectActiveInteraction=__name((promptId,startsInteraction=false)=>{if(startsInteraction||activeInteractionPromptId!==promptId){activeInteractionOwner=void 0}activeInteractionPromptId=promptId},"selectActiveInteraction");const captureActiveInteractionOwner=__name(()=>{activeInteractionOwner??=getActiveInteractionSpan(activeInteractionPromptId);return activeInteractionOwner},"captureActiveInteractionOwner");const endActiveInteraction=__name((status,metadata={})=>{const owner=captureActiveInteractionOwner();if(!owner||getActiveInteractionSpan(activeInteractionPromptId)!==owner){return}endInteractionSpan(status,{promptId:activeInteractionPromptId,...metadata})},"endActiveInteraction");const llmClient=config.getLlmClient();const abortController=options.abortController??new AbortController;const queuedGoalTurns=[];let activeGoalTurn;let goalRuntimeUnsubscribe;const emitGoalSnapshot=__name(snapshot=>{adapter.processEvent({type:"goal_state",value:snapshot})},"emitGoalSnapshot");const observeGoalRuntime=__name(runtime=>{goalRuntimeUnsubscribe??=runtime.subscribe(emitGoalSnapshot)},"observeGoalRuntime");const enforceSessionTurnLimit=__name(async isRuntimeGoalTurn=>{if(isRuntimeGoalTurn)return;limitedTurnCount++;const maxSessionTurns=config.getMaxSessionTurns();if(maxSessionTurns>=0&&limitedTurnCount>maxSessionTurns){await failClosedActiveGoalTurn("Headless Goal stopped after the session turn limit");await settleBeforeTerminalOutput();await handleMaxTurnsExceededError(config)}},"enforceSessionTurnLimit");let goalHostUnbind;const goalHost={startGoalTurn:__name(async input2=>{if(queuedGoalTurns.some(({permit:permit2})=>permit2.turnId===input2.permit.turnId)){return}const{permit,...continuation}=input2;queuedGoalTurns.push({permit:{...permit},turnKey:`goal-runtime:${permit.turnId}`,controller:new AbortController,origin:"runtime",...continuation})},"startGoalTurn"),preemptGoalTurn:__name(reason=>{for(const turn of queuedGoalTurns.splice(0)){turn.controller.abort(reason)}activeGoalTurn?.controller.abort(reason)},"preemptGoalTurn")};const bindGoalHost=__name(()=>{goalHostUnbind??=config.bindGoalTurnHost(goalHost)},"bindGoalHost");const markGoalTurnDelivered=__name(turn=>{try{config.getGoalRuntime().markTurnDelivered(turn.turnKey)}catch{}},"markGoalTurnDelivered");let settlingGoalTurn;let goalTurnSettlement;const failClosedActiveGoalTurn=__name((reason,pauseReason)=>{const turn=activeGoalTurn;if(!turn)return Promise.resolve();if(settlingGoalTurn===turn&&goalTurnSettlement){return goalTurnSettlement}settlingGoalTurn=turn;goalTurnSettlement=(async()=>{if(!turn.controller.signal.aborted){turn.controller.abort(reason)}try{const runtime=await config.getGoalRuntimeReady();if(!sameGoalPermit(runtime.permitForTurn(turn.turnKey),turn.permit)){return}if(runtime.getSnapshot().goal?.status==="active"){try{await runtime.dispatch({action:"pause",expectedGoalId:turn.permit.goalId,expectedRevision:turn.permit.revision,reason:pauseReason??goalPauseReasonForHeadlessFailure(reason)})}catch(error){debugLogger.warn("Failed to pause terminal headless Goal",error)}}try{await config.getChatRecordingService?.()?.flush()}catch(error){debugLogger.warn("Failed to flush terminal headless Goal",error)}if(sameGoalPermit(runtime.permitForTurn(turn.turnKey),turn.permit)){await runtime.finishTurn(turn.permit)}}catch(error){debugLogger.warn("Failed to close terminal headless Goal",error)}finally{if(activeGoalTurn===turn){activeGoalTurn=void 0}if(settlingGoalTurn===turn){settlingGoalTurn=void 0;goalTurnSettlement=void 0}}})();return goalTurnSettlement},"failClosedActiveGoalTurn");const finishGoalTurn=__name(async turn=>{const runtime=await config.getGoalRuntimeReady();if(!sameGoalPermit(runtime.permitForTurn(turn.turnKey),turn.permit)){return}let abortSettlement;const pauseOnAbort=__name(()=>{const exceeded=budgetEnforcer.getExceeded();abortSettlement??=runtime.dispatch({action:"pause",expectedGoalId:turn.permit.goalId,expectedRevision:turn.permit.revision,reason:exceeded?goalPauseReasonForRunBudget(exceeded.kind):GOAL_PAUSE_REASON_USER_INTERRUPT}).then(()=>void 0).catch(error=>{debugLogger.warn("Failed to pause aborted headless Goal",error)})},"pauseOnAbort");abortController.signal.addEventListener("abort",pauseOnAbort,{once:true});if(abortController.signal.aborted)pauseOnAbort();try{if(!abortController.signal.aborted){await runtime.finishTurn(turn.permit)}}finally{abortController.signal.removeEventListener("abort",pauseOnAbort);await abortSettlement}},"finishGoalTurn");const budgetEnforcer=new RunBudgetEnforcer({maxWallTimeSeconds:config.getMaxWallTimeSeconds(),maxToolCalls:config.getMaxToolCalls()},abortController);const stampBudgetAbort=__name(()=>{const exceeded=budgetEnforcer.getExceeded();if(!exceeded)return;endActiveInteraction("error",{errorMessage:exceeded.message,errorType:"run_budget_exceeded"})},"stampBudgetAbort");abortController.signal.addEventListener("abort",stampBudgetAbort,{once:true});budgetEnforcer.start();const routeAbort=__name(async()=>{const exceeded=budgetEnforcer.getExceeded();endActiveInteraction(exceeded?"error":"cancelled",{...exceeded?{errorMessage:exceeded.message,errorType:"run_budget_exceeded"}:{}});await failClosedActiveGoalTurn(exceeded?.message??"Headless Goal execution was cancelled",exceeded?goalPauseReasonForRunBudget(exceeded.kind):GOAL_PAUSE_REASON_USER_INTERRUPT);await settleBeforeTerminalOutput();if(exceeded){await handleBudgetExceededError(config,exceeded);throw new Error(exceeded.message)}const reason=abortController.signal.reason;if(reason instanceof TurnInterruptedError&&(options.recoverableCancellation===true||reason instanceof ModTurnAbortedError)){throw reason}await handleCancellationError(config);throw new Error("Operation cancelled.")},"routeAbort");const localQueue=[];const sdkOnlyMonitorQueue=[];const isCancelledMonitorEvent=__name(item=>Boolean(item.monitorId&&item.sdkNotification?.status==="running"&&config.getMonitorRegistry().get(item.monitorId)?.status==="cancelled"),"isCancelledMonitorEvent");const emitNotificationToSdk=__name(item=>{if(item.sendMessageType!=="notification")return;adapter.emitUserMessage([{text:item.displayText}]);if(item.sdkNotification){adapter.emitSystemMessage("task_notification",item.sdkNotification)}},"emitNotificationToSdk");const flushQueuedNotificationsToSdk=__name(queue=>{while(queue.length>0){const item=queue.shift();if(!isCancelledMonitorEvent(item)){emitNotificationToSdk(item)}}},"flushQueuedNotificationsToSdk");let captureMonitorTurnsInLocalQueue=true;let oneShotMonitorsFinalized=false;const finalizeOneShotMonitors=__name(()=>{if(options.captureMonitorNotifications===false||oneShotMonitorsFinalized)return;oneShotMonitorsFinalized=true;captureMonitorTurnsInLocalQueue=false;config.getMonitorRegistry().abortAll();flushQueuedNotificationsToSdk(sdkOnlyMonitorQueue)},"finalizeOneShotMonitors");let pipeBroken=false;let workflowApprovalChannelRegistered=false;const stdoutErrorHandler=__name(err=>{if(err.code==="EPIPE"&&!pipeBroken){pipeBroken=true;process.stdout.destroy()}},"stdoutErrorHandler");const shutdownHandler=__name(()=>{debugLogger.debug("[runNonInteractive] Shutdown signal received");abortController.abort()},"shutdownHandler");const pendingTeammateMessages=[];let boundManager=null;let approvalListener=null;const detachFromManager=__name(m=>{m.setLeaderMessageCallback(null);if(approvalListener){m.getEventEmitter().off("teammate_approval_request",approvalListener);approvalListener=null}},"detachFromManager");const onTeamManagerChangeHandler=__name(manager=>{if(boundManager&&boundManager!==manager){detachFromManager(boundManager)}boundManager=manager;if(manager){manager.setLeaderMessageCallback(formatted=>{pendingTeammateMessages.push(formatted)});if(options.controlService){approvalListener=__name(event=>{options.controlService.permission.handleTeammateApproval(event).catch(err=>{debugLogger.warn("Teammate approval handling failed:",err)})},"approvalListener")}else{approvalListener=__name(event=>{const mode=config.getApprovalMode();const confirmationDetails=event.confirmationDetails;const requiresExplicitHostApproval=confirmationDetails?.type!=="plan"&&confirmationDetails!==void 0&&"hideAlwaysAllow"in confirmationDetails&&confirmationDetails.hideAlwaysAllow===true;if(mode==="yolo"&&!requiresExplicitHostApproval){event.respond("proceed_once").catch(err=>{debugLogger.warn("Teammate approval ProceedOnce failed:",err)});return}const reason=requiresExplicitHostApproval?mode==="yolo"?`Auto-cancelling tool ${event.toolName} requested by teammate "${event.teammateName}": this request requires an explicit interactive approval surface and cannot be bypassed by YOLO mode.`:`Auto-cancelling tool ${event.toolName} requested by teammate "${event.teammateName}": this request requires an explicit interactive approval surface, which is unavailable in non-stream-json mode with the current approval mode (${mode}). Use --input-format stream-json --output-format stream-json to review it.`:`Auto-cancelling tool ${event.toolName} requested by teammate "${event.teammateName}": current approval mode (${mode}) cannot prompt in non-stream-json mode. Use --yolo or stream-json to allow teammate tool calls.`;process.stderr.write(`[team] ${reason}
|
|
5
5
|
`);pendingTeammateMessages.push(`<team_notice>
|
|
6
6
|
${reason}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{captureEnvironmentBeforeLoad,publishPendingCompileCache,resetEnvironmentSnapshotForTesting}from"./chunk-PKK2D2W4.js";import{DEFAULT_EXCLUDED_ENV_VARS,HOME_ENV_BOOTSTRAP_KEYS,PROJECT_ENV_HARDCODED_EXCLUSIONS,VERIFY_PR_COORDINATE_ENV,isHardcodedProjectEnvExclusion,isLoaderEnvKey,isPrivateProvenanceEnvKey,reportRejectedLoaderKeys,resetLoaderKeyRejectionReportingForTesting}from"./chunk-N3AQAZ7D.js";import{PRIVATE_RELAUNCH_ENV_PROVENANCE}from"./chunk-E5T4R2PM.js";import{isWorkspaceTrusted}from"./chunk-BBOJUFMW.js";import{require_main}from"./chunk-ZOTKZI2P.js";import{writeStderrLineSafe}from"./chunk-M4ECEHLX.js";import{Storage}from"./chunk-EPODBRBP.js";import{QWEN_DIR}from"./chunk-OKN3Z5C5.js";import{getErrorMessage}from"./chunk-XYB7GC5U.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name,__toESM}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var dotenv=__toESM(require_main(),1);import*as fs from"node:fs";import*as path from"node:path";import*as os from"node:os";var SETTINGS_DIRECTORY_NAME=QWEN_DIR;var RELOAD_EXCLUDED_KEYS=new Set([...PROJECT_ENV_HARDCODED_EXCLUSIONS,"LD_LIBRARY_PATH","DYLD_LIBRARY_PATH","ENV","PATH","HOME"]);var RELOAD_EXCLUDED_KEYS_CASEFOLDED=new Set([...RELOAD_EXCLUDED_KEYS].map(key=>key.toLowerCase()));function isReloadExcludedKey(key){return RELOAD_EXCLUDED_KEYS_CASEFOLDED.has(key.toLowerCase())||isHardcodedProjectEnvExclusion(key)}__name(isReloadExcludedKey,"isReloadExcludedKey");var dotEnvSourcedKeys=new Set;var settingsEnvSourcedKeys=new Set;var inheritedDotEnvKeys=new Set;var inheritedSettingsEnvKeys=new Set;var inheritedProvenance=process.env[PRIVATE_RELAUNCH_ENV_PROVENANCE];delete process.env[PRIVATE_RELAUNCH_ENV_PROVENANCE];if(inheritedProvenance){const sources=JSON.parse(inheritedProvenance);if(!sources||typeof sources!=="object"||!("dotEnv"in sources)||!("settingsEnv"in sources)||!Array.isArray(sources.dotEnv)||!Array.isArray(sources.settingsEnv)||!sources.dotEnv.every(key=>typeof key==="string")||!sources.settingsEnv.every(key=>typeof key==="string")){throw new Error("Invalid inherited environment provenance.")}for(const key of sources.dotEnv)inheritedDotEnvKeys.add(key);for(const key of sources.settingsEnv)inheritedSettingsEnvKeys.add(key);Object.assign(process.env,getRelaunchEnvProvenance())}var DOCUMENTED_MODEL_ENV_KEYS=["OPENAI_API_KEY","OPENAI_BASE_URL","OPENAI_MODEL","QWEN_MODEL","ANTHROPIC_API_KEY","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","GEMINI_API_KEY","GEMINI_MODEL","GOOGLE_API_KEY","GOOGLE_MODEL"];var requestTimeEnvKeys=new Set;function rememberRequestTimeEnvKeys(settings){requestTimeEnvKeys.clear();for(const key of DOCUMENTED_MODEL_ENV_KEYS)requestTimeEnvKeys.add(key);for(const models of Object.values(settings.modelProviders??{})){if(!Array.isArray(models))continue;for(const model of models){const envKey=model?.envKey;if(typeof envKey==="string"&&envKey&&!isHardcodedProjectEnvExclusion(envKey)&&!isLoaderEnvKey(envKey)){requestTimeEnvKeys.add(envKey)}}}}__name(rememberRequestTimeEnvKeys,"rememberRequestTimeEnvKeys");function hasLoadedEnvironmentValues(){for(const keys of[dotEnvSourcedKeys,settingsEnvSourcedKeys]){for(const key of keys){if(!requestTimeEnvKeys.has(key))return true}}return false}__name(hasLoadedEnvironmentValues,"hasLoadedEnvironmentValues");function getRelaunchEnvProvenance(){return{[PRIVATE_RELAUNCH_ENV_PROVENANCE]:JSON.stringify({dotEnv:[...new Set([...inheritedDotEnvKeys,...dotEnvSourcedKeys])],settingsEnv:[...new Set([...inheritedSettingsEnvKeys,...settingsEnvSourcedKeys])]})}}__name(getRelaunchEnvProvenance,"getRelaunchEnvProvenance");var lastReloadSnapshot=new Map;var lastReloadSnapshotSeeded=false;function getUserLevelEnvPaths(){const homeDir=os.homedir();const globalQwenDir=Storage.getGlobalQwenDir();const paths=new Set([path.normalize(path.join(homeDir,".env")),path.normalize(path.join(globalQwenDir,".env"))]);const legacyQwenEnv=path.normalize(path.join(homeDir,QWEN_DIR,".env"));paths.add(legacyQwenEnv);return paths}__name(getUserLevelEnvPaths,"getUserLevelEnvPaths");var homeEnvBootstrapped=false;function preResolveHomeEnvOverrides(){if(homeEnvBootstrapped){return}homeEnvBootstrapped=true;if(HOME_ENV_BOOTSTRAP_KEYS.every(key=>process.env[key])){return}const initialQwenHome=process.env["QWEN_HOME"];const initialQwenDir=Storage.getGlobalQwenDir();const candidates=[path.join(initialQwenDir,".env")];if(!initialQwenHome){candidates.push(path.join(path.dirname(initialQwenDir),".env"))}for(const candidate of candidates){readHomeEnvInto(candidate)}const discoveredQwenHome=process.env["QWEN_HOME"];if(discoveredQwenHome&&discoveredQwenHome!==initialQwenHome){const discoveredDir=Storage.getGlobalQwenDir();if(discoveredDir!==initialQwenDir){readHomeEnvInto(path.join(discoveredDir,".env"))}}}__name(preResolveHomeEnvOverrides,"preResolveHomeEnvOverrides");function readHomeEnvInto(file){if(!fs.existsSync(file)){return}try{const parsed=dotenv.parse(fs.readFileSync(file,"utf-8"));for(const key of HOME_ENV_BOOTSTRAP_KEYS){if(parsed[key]&&!Object.hasOwn(process.env,key)){process.env[key]=parsed[key]}}}catch(_e){}}__name(readHomeEnvInto,"readHomeEnvInto");function resetHomeEnvBootstrapForTesting(){homeEnvBootstrapped=false}__name(resetHomeEnvBootstrapForTesting,"resetHomeEnvBootstrapForTesting");function resetEnvironmentTrackingForTesting(){resetLoaderKeyRejectionReportingForTesting();resetEnvironmentSnapshotForTesting();dotEnvSourcedKeys.clear();settingsEnvSourcedKeys.clear();inheritedDotEnvKeys.clear();inheritedSettingsEnvKeys.clear();requestTimeEnvKeys.clear();delete process.env[PRIVATE_RELAUNCH_ENV_PROVENANCE];lastReloadSnapshot.clear();lastReloadSnapshotSeeded=false}__name(resetEnvironmentTrackingForTesting,"resetEnvironmentTrackingForTesting");function isFileSourcedEnvKey(key){const sources=[dotEnvSourcedKeys,settingsEnvSourcedKeys,inheritedDotEnvKeys,inheritedSettingsEnvKeys];if(sources.some(keys=>keys.has(key))){return true}if(process.platform!=="win32")return false;const lower=key.toLowerCase();for(const keys of sources){for(const tracked of keys){if(tracked.toLowerCase()===lower)return true}}return false}__name(isFileSourcedEnvKey,"isFileSourcedEnvKey");function getHomeEnvFallbackVars(onReadError){const globalQwenDir=Storage.getGlobalQwenDir();const candidates=[path.join(globalQwenDir,".env")];if(!process.env["QWEN_HOME"]){candidates.push(path.join(path.dirname(globalQwenDir),".env"))}const result={};for(const candidate of candidates){if(!fs.existsSync(candidate)){continue}try{const parsed=dotenv.parse(fs.readFileSync(candidate,"utf-8"));for(const key in parsed){if(Object.hasOwn(parsed,key)&&!Object.hasOwn(process.env,key)){result[key]??=parsed[key]}}}catch(e){onReadError?.(`Failed to read home .env candidate ${candidate}: ${getErrorMessage(e)}`)}}return result}__name(getHomeEnvFallbackVars,"getHomeEnvFallbackVars");function findEnvFiles(settings,startDir,userLevelPaths=getUserLevelEnvPaths(),workspaceTrusted){const homeDir=os.homedir();let realStartDir=path.resolve(startDir);try{realStartDir=fs.realpathSync(realStartDir)}catch{}const globalQwenDir=Storage.getGlobalQwenDir();const legacyQwenDir=path.normalize(path.join(homeDir,QWEN_DIR));const hasCustomConfigDir=path.normalize(globalQwenDir)!==legacyQwenDir;const found=[];const seen=new Set;const workspaceIsTrusted=workspaceTrusted??isWorkspaceTrusted(settings,void 0,realStartDir).isTrusted===true;const canUseEnvFile=__name(filePath=>{const normalized=path.normalize(filePath);if(userLevelPaths.has(normalized))return true;if(!workspaceIsTrusted)return false;const dirPath=path.dirname(normalized);const workspaceDir=path.basename(dirPath)===SETTINGS_DIRECTORY_NAME?path.dirname(dirPath):dirPath;if(workspaceDir===realStartDir)return true;return isWorkspaceTrusted(settings,void 0,workspaceDir).isTrusted!==false},"canUseEnvFile");const pushCandidate=__name(filePath=>{const normalized=path.normalize(filePath);if(!seen.has(normalized)&&fs.existsSync(filePath)&&canUseEnvFile(filePath)){seen.add(normalized);found.push(filePath);return true}return false},"pushCandidate");const pushHomeCandidates=__name(()=>{const candidates=[path.join(globalQwenDir,".env")];if(hasCustomConfigDir){candidates.push(path.join(legacyQwenDir,".env"))}candidates.push(path.join(homeDir,".env"));for(const candidate of candidates){pushCandidate(candidate)}},"pushHomeCandidates");if(path.resolve(startDir)===path.resolve(homeDir)){pushHomeCandidates();return found}let currentDir=realStartDir;let visitedHomeDir=false;while(true){if(currentDir===homeDir){visitedHomeDir=true;pushHomeCandidates();return found}else{const geminiEnvPath=path.join(currentDir,QWEN_DIR,".env");if(pushCandidate(geminiEnvPath)){pushHomeCandidates();return found}const envPath=path.join(currentDir,".env");if(pushCandidate(envPath)){pushHomeCandidates();return found}}const parentDir=path.dirname(currentDir);if(parentDir===currentDir||!parentDir){if(!visitedHomeDir){pushHomeCandidates()}return found}currentDir=parentDir}}__name(findEnvFiles,"findEnvFiles");function setUpCloudShellEnvironment(envFilePath){if(envFilePath&&fs.existsSync(envFilePath)){const envFileContent=fs.readFileSync(envFilePath);const parsedEnv=dotenv.parse(envFileContent);if(parsedEnv["GOOGLE_CLOUD_PROJECT"]){process.env["GOOGLE_CLOUD_PROJECT"]=parsedEnv["GOOGLE_CLOUD_PROJECT"]}else{process.env["GOOGLE_CLOUD_PROJECT"]="cloudshell-gca"}}else{process.env["GOOGLE_CLOUD_PROJECT"]="cloudshell-gca"}}__name(setUpCloudShellEnvironment,"setUpCloudShellEnvironment");function setUpCloudShellEnvironmentInEnv(env,envFiles){for(const envFile of envFiles){if(envFile.parsedEnv["GOOGLE_CLOUD_PROJECT"]){env["GOOGLE_CLOUD_PROJECT"]=envFile.parsedEnv["GOOGLE_CLOUD_PROJECT"];return}}env["GOOGLE_CLOUD_PROJECT"]="cloudshell-gca"}__name(setUpCloudShellEnvironmentInEnv,"setUpCloudShellEnvironmentInEnv");function parseEnvFiles(envFilePaths,userLevelPaths){const files=[];const readFailures=[];for(const envFilePath of envFilePaths){try{const envFileContent=fs.readFileSync(envFilePath,"utf-8");const parsedEnv=dotenv.parse(envFileContent);const normalizedEnvFilePath=path.normalize(envFilePath);const isHomeScopedEnvFile=userLevelPaths.has(normalizedEnvFilePath);const isQwenScopedEnvFile=isHomeScopedEnvFile||path.basename(path.dirname(normalizedEnvFilePath))===QWEN_DIR;files.push({path:envFilePath,parsedEnv,isHomeScopedEnvFile,isQwenScopedEnvFile})}catch(err){readFailures.push({path:envFilePath,error:getErrorMessage(err)})}}return{files,readFailed:readFailures.length>0,readFailures}}__name(parseEnvFiles,"parseEnvFiles");function canApplyParsedEnvKey(envFile,key,excludedVars,options={}){if(!Object.hasOwn(envFile.parsedEnv,key))return false;if(isLoaderEnvKey(key))return false;if(isPrivateProvenanceEnvKey(key))return false;if(options.reload&&isReloadExcludedKey(key))return false;if(!envFile.isHomeScopedEnvFile&&isHardcodedProjectEnvExclusion(key)){return false}return envFile.isQwenScopedEnvFile||!excludedVars.includes(key)}__name(canApplyParsedEnvKey,"canApplyParsedEnvKey");function isEffectivelyUnset(env,key){const existingValue=env[key];return!Object.hasOwn(env,key)||existingValue===""}__name(isEffectivelyUnset,"isEffectivelyUnset");function setRuntimeEnvIfUnset(env,key,value){if(isEffectivelyUnset(env,key)){env[key]=value}}__name(setRuntimeEnvIfUnset,"setRuntimeEnvIfUnset");function reportRejectedSettingsEnv(env,startDir){const source=`settings.env (${startDir})`;reportRejectedLoaderKeys(source,Object.keys(env));if(Object.entries(env).some(([key,value])=>key.toUpperCase()==="QWEN_AGENT_EXECUTION_BACKEND"&&typeof value==="string"&&value.trim()!=="")){writeStderrLineSafe(`qwen: ${source} cannot set QWEN_AGENT_EXECUTION_BACKEND; ignored. Export it in the launch environment instead.`)}for(const[setting,key]of Object.entries(VERIFY_PR_COORDINATE_ENV)){const entry=Object.entries(env).find(([candidate,value])=>candidate.toUpperCase()===key&&typeof value==="string"&&value.trim()!=="");if(!entry)continue;writeStderrLineSafe(`qwen: ${source} cannot set ${entry[0]}; ignored. Set verifyPr.${setting} at user scope in settings.json, or export it in the launch environment.`)}}__name(reportRejectedSettingsEnv,"reportRejectedSettingsEnv");function buildRuntimeEnvironment(settings,startDir=process.cwd(),baseEnv=process.env,workspaceTrusted){const userLevelPaths=getUserLevelEnvPaths();const envFilePaths=findEnvFiles(settings,startDir,userLevelPaths,workspaceTrusted);const parsedEnvFiles=parseEnvFiles(envFilePaths,userLevelPaths);const effectiveEnv={...baseEnv};if(baseEnv["CLOUD_SHELL"]==="true"){setUpCloudShellEnvironmentInEnv(effectiveEnv,parsedEnvFiles.files)}for(const envFile of parsedEnvFiles.files){const excludedVars=settings?.advanced?.excludedEnvVars||DEFAULT_EXCLUDED_ENV_VARS;for(const key in envFile.parsedEnv){if(!canApplyParsedEnvKey(envFile,key,excludedVars,{reload:true})){continue}setRuntimeEnvIfUnset(effectiveEnv,key,envFile.parsedEnv[key])}reportRejectedLoaderKeys(`.env file ${envFile.path}`,Object.keys(envFile.parsedEnv))}if(settings.env){const excludedVars=settings?.advanced?.excludedEnvVars||DEFAULT_EXCLUDED_ENV_VARS;for(const[key,value]of Object.entries(settings.env)){if(isLoaderEnvKey(key))continue;if(isReloadExcludedKey(key))continue;if(isHardcodedProjectEnvExclusion(key))continue;if(excludedVars.includes(key))continue;if(typeof value!=="string")continue;setRuntimeEnvIfUnset(effectiveEnv,key,value)}reportRejectedSettingsEnv(settings.env,startDir)}const overlayKeys=Object.keys(effectiveEnv).filter(key=>effectiveEnv[key]!==baseEnv[key]).sort();return{effectiveEnv:Object.freeze({...effectiveEnv}),overlayKeys:Object.freeze(overlayKeys),envFilePaths:Object.freeze([...envFilePaths]),envFileReadFailed:parsedEnvFiles.readFailed,envFileReadFailures:Object.freeze([...parsedEnvFiles.readFailures])}}__name(buildRuntimeEnvironment,"buildRuntimeEnvironment");function loadEnvironment(settings,startDir=process.cwd()){captureEnvironmentBeforeLoad();rememberRequestTimeEnvKeys(settings);const userLevelPaths=getUserLevelEnvPaths();const envFilePaths=findEnvFiles(settings,startDir,userLevelPaths);const parsedEnvFiles=parseEnvFiles(envFilePaths,userLevelPaths);if(process.env["CLOUD_SHELL"]==="true"){setUpCloudShellEnvironmentInEnv(process.env,parsedEnvFiles.files)}for(const envFile of parsedEnvFiles.files){const excludedVars=settings?.advanced?.excludedEnvVars||DEFAULT_EXCLUDED_ENV_VARS;for(const key in envFile.parsedEnv){if(!canApplyParsedEnvKey(envFile,key,excludedVars))continue;const existingValue=process.env[key];const isEffectivelyUnset2=!Object.hasOwn(process.env,key)||existingValue==="";if(isEffectivelyUnset2){process.env[key]=envFile.parsedEnv[key];dotEnvSourcedKeys.add(key)}if(!lastReloadSnapshotSeeded&&!lastReloadSnapshot.has(key)){lastReloadSnapshot.set(key,envFile.parsedEnv[key])}}reportRejectedLoaderKeys(`.env file ${envFile.path}`,Object.keys(envFile.parsedEnv))}if(settings.env){for(const[key,value]of Object.entries(settings.env)){if(isLoaderEnvKey(key)){continue}if(isReloadExcludedKey(key)){continue}if(isHardcodedProjectEnvExclusion(key)){continue}const existingValue=process.env[key];const isEffectivelyUnset2=!Object.hasOwn(process.env,key)||existingValue==="";if(isEffectivelyUnset2&&typeof value==="string"){process.env[key]=value;settingsEnvSourcedKeys.add(key)}if(!lastReloadSnapshotSeeded&&typeof value==="string"&&!lastReloadSnapshot.has(key)){lastReloadSnapshot.set(key,value)}}reportRejectedSettingsEnv(settings.env,startDir)}lastReloadSnapshotSeeded=true;Object.assign(process.env,getRelaunchEnvProvenance());publishPendingCompileCache()}__name(loadEnvironment,"loadEnvironment");function reloadEnvironment(settings,workspaceCwd,workspaceTrusted,options={}){const userLevelPaths=getUserLevelEnvPaths();const envFilePaths=findEnvFiles(settings,workspaceCwd,userLevelPaths,workspaceTrusted);const parsedEnvFiles=parseEnvFiles(envFilePaths,userLevelPaths);if(parsedEnvFiles.readFailed&&options.failClosedOnEnvFileReadError){return{updatedKeys:[],removedKeys:[],envFileReadFailed:true}}if(process.env["CLOUD_SHELL"]==="true"){setUpCloudShellEnvironmentInEnv(process.env,parsedEnvFiles.files)}const dotEnvReadFailed=parsedEnvFiles.readFailed;const newDotEnvKeys=new Map;const newSettingsEnvKeys=new Map;for(const envFile of parsedEnvFiles.files){const excludedVars=settings?.advanced?.excludedEnvVars||DEFAULT_EXCLUDED_ENV_VARS;for(const key in envFile.parsedEnv){if(!canApplyParsedEnvKey(envFile,key,excludedVars,{reload:true})){continue}if(!newDotEnvKeys.has(key)){newDotEnvKeys.set(key,envFile.parsedEnv[key])}}reportRejectedLoaderKeys(`.env file ${envFile.path}`,Object.keys(envFile.parsedEnv))}if(settings.env){for(const[key,value]of Object.entries(settings.env)){if(isLoaderEnvKey(key))continue;if(isReloadExcludedKey(key))continue;if(isHardcodedProjectEnvExclusion(key))continue;if(typeof value!=="string")continue;const dotEnvValue=newDotEnvKeys.get(key);if(dotEnvValue!==void 0&&dotEnvValue!=="")continue;if(dotEnvReadFailed&&lastReloadSnapshot.has(key))continue;newSettingsEnvKeys.set(key,value)}reportRejectedSettingsEnv(settings.env,workspaceCwd)}const allNewKeys=new Set([...newDotEnvKeys.keys(),...newSettingsEnvKeys.keys()]);const updatedKeys=[];const removedKeys=[];if(!dotEnvReadFailed){const previouslyKnown=new Set([...lastReloadSnapshot.keys(),...dotEnvSourcedKeys,...settingsEnvSourcedKeys]);for(const key of previouslyKnown){if(!allNewKeys.has(key)&&!isReloadExcludedKey(key)){delete process.env[key];inheritedDotEnvKeys.delete(key);inheritedSettingsEnvKeys.delete(key);removedKeys.push(key)}}}for(const[key,value]of newDotEnvKeys){if(value===""&&newSettingsEnvKeys.has(key))continue;if(process.env[key]!==value){updatedKeys.push(key)}process.env[key]=value}for(const[key,value]of newSettingsEnvKeys){if(process.env[key]!==value){updatedKeys.push(key)}process.env[key]=value}if(!dotEnvReadFailed){for(const sources of[dotEnvSourcedKeys,settingsEnvSourcedKeys]){for(const key of sources){if(!isReloadExcludedKey(key))sources.delete(key)}}lastReloadSnapshot.clear();for(const[key,value]of newDotEnvKeys){lastReloadSnapshot.set(key,value)}for(const[key,value]of newSettingsEnvKeys){lastReloadSnapshot.set(key,value)}}for(const key of newDotEnvKeys.keys()){dotEnvSourcedKeys.add(key)}for(const key of newSettingsEnvKeys.keys()){settingsEnvSourcedKeys.add(key)}Object.assign(process.env,getRelaunchEnvProvenance());return{updatedKeys,removedKeys,...dotEnvReadFailed?{envFileReadFailed:true}:{}}}__name(reloadEnvironment,"reloadEnvironment");export{SETTINGS_DIRECTORY_NAME,hasLoadedEnvironmentValues,getRelaunchEnvProvenance,preResolveHomeEnvOverrides,resetHomeEnvBootstrapForTesting,resetEnvironmentTrackingForTesting,isFileSourcedEnvKey,getHomeEnvFallbackVars,findEnvFiles,setUpCloudShellEnvironment,buildRuntimeEnvironment,loadEnvironment,reloadEnvironment};
|
|
3
|
+
import{captureEnvironmentBeforeLoad,publishPendingCompileCache,resetEnvironmentSnapshotForTesting}from"./chunk-PKK2D2W4.js";import{DEFAULT_EXCLUDED_ENV_VARS,HOME_ENV_BOOTSTRAP_KEYS,PROJECT_ENV_HARDCODED_EXCLUSIONS,VERIFY_PR_COORDINATE_ENV,isHardcodedProjectEnvExclusion,isLoaderEnvKey,isPrivateProvenanceEnvKey,reportRejectedLoaderKeys,resetLoaderKeyRejectionReportingForTesting}from"./chunk-N3AQAZ7D.js";import{PRIVATE_RELAUNCH_ENV_PROVENANCE}from"./chunk-E5T4R2PM.js";import{isWorkspaceTrusted}from"./chunk-MTDBCIDA.js";import{require_main}from"./chunk-ZOTKZI2P.js";import{writeStderrLineSafe}from"./chunk-M4ECEHLX.js";import{Storage}from"./chunk-EPODBRBP.js";import{QWEN_DIR}from"./chunk-OKN3Z5C5.js";import{getErrorMessage}from"./chunk-XYB7GC5U.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name,__toESM}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var dotenv=__toESM(require_main(),1);import*as fs from"node:fs";import*as path from"node:path";import*as os from"node:os";var SETTINGS_DIRECTORY_NAME=QWEN_DIR;var RELOAD_EXCLUDED_KEYS=new Set([...PROJECT_ENV_HARDCODED_EXCLUSIONS,"LD_LIBRARY_PATH","DYLD_LIBRARY_PATH","ENV","PATH","HOME"]);var RELOAD_EXCLUDED_KEYS_CASEFOLDED=new Set([...RELOAD_EXCLUDED_KEYS].map(key=>key.toLowerCase()));function isReloadExcludedKey(key){return RELOAD_EXCLUDED_KEYS_CASEFOLDED.has(key.toLowerCase())||isHardcodedProjectEnvExclusion(key)}__name(isReloadExcludedKey,"isReloadExcludedKey");var dotEnvSourcedKeys=new Set;var settingsEnvSourcedKeys=new Set;var inheritedDotEnvKeys=new Set;var inheritedSettingsEnvKeys=new Set;var inheritedProvenance=process.env[PRIVATE_RELAUNCH_ENV_PROVENANCE];delete process.env[PRIVATE_RELAUNCH_ENV_PROVENANCE];if(inheritedProvenance){const sources=JSON.parse(inheritedProvenance);if(!sources||typeof sources!=="object"||!("dotEnv"in sources)||!("settingsEnv"in sources)||!Array.isArray(sources.dotEnv)||!Array.isArray(sources.settingsEnv)||!sources.dotEnv.every(key=>typeof key==="string")||!sources.settingsEnv.every(key=>typeof key==="string")){throw new Error("Invalid inherited environment provenance.")}for(const key of sources.dotEnv)inheritedDotEnvKeys.add(key);for(const key of sources.settingsEnv)inheritedSettingsEnvKeys.add(key);Object.assign(process.env,getRelaunchEnvProvenance())}var DOCUMENTED_MODEL_ENV_KEYS=["OPENAI_API_KEY","OPENAI_BASE_URL","OPENAI_MODEL","QWEN_MODEL","ANTHROPIC_API_KEY","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","GEMINI_API_KEY","GEMINI_MODEL","GOOGLE_API_KEY","GOOGLE_MODEL"];var requestTimeEnvKeys=new Set;function rememberRequestTimeEnvKeys(settings){requestTimeEnvKeys.clear();for(const key of DOCUMENTED_MODEL_ENV_KEYS)requestTimeEnvKeys.add(key);for(const models of Object.values(settings.modelProviders??{})){if(!Array.isArray(models))continue;for(const model of models){const envKey=model?.envKey;if(typeof envKey==="string"&&envKey&&!isHardcodedProjectEnvExclusion(envKey)&&!isLoaderEnvKey(envKey)){requestTimeEnvKeys.add(envKey)}}}}__name(rememberRequestTimeEnvKeys,"rememberRequestTimeEnvKeys");function hasLoadedEnvironmentValues(){for(const keys of[dotEnvSourcedKeys,settingsEnvSourcedKeys]){for(const key of keys){if(!requestTimeEnvKeys.has(key))return true}}return false}__name(hasLoadedEnvironmentValues,"hasLoadedEnvironmentValues");function getRelaunchEnvProvenance(){return{[PRIVATE_RELAUNCH_ENV_PROVENANCE]:JSON.stringify({dotEnv:[...new Set([...inheritedDotEnvKeys,...dotEnvSourcedKeys])],settingsEnv:[...new Set([...inheritedSettingsEnvKeys,...settingsEnvSourcedKeys])]})}}__name(getRelaunchEnvProvenance,"getRelaunchEnvProvenance");var lastReloadSnapshot=new Map;var lastReloadSnapshotSeeded=false;function getUserLevelEnvPaths(){const homeDir=os.homedir();const globalQwenDir=Storage.getGlobalQwenDir();const paths=new Set([path.normalize(path.join(homeDir,".env")),path.normalize(path.join(globalQwenDir,".env"))]);const legacyQwenEnv=path.normalize(path.join(homeDir,QWEN_DIR,".env"));paths.add(legacyQwenEnv);return paths}__name(getUserLevelEnvPaths,"getUserLevelEnvPaths");var homeEnvBootstrapped=false;function preResolveHomeEnvOverrides(){if(homeEnvBootstrapped){return}homeEnvBootstrapped=true;if(HOME_ENV_BOOTSTRAP_KEYS.every(key=>process.env[key])){return}const initialQwenHome=process.env["QWEN_HOME"];const initialQwenDir=Storage.getGlobalQwenDir();const candidates=[path.join(initialQwenDir,".env")];if(!initialQwenHome){candidates.push(path.join(path.dirname(initialQwenDir),".env"))}for(const candidate of candidates){readHomeEnvInto(candidate)}const discoveredQwenHome=process.env["QWEN_HOME"];if(discoveredQwenHome&&discoveredQwenHome!==initialQwenHome){const discoveredDir=Storage.getGlobalQwenDir();if(discoveredDir!==initialQwenDir){readHomeEnvInto(path.join(discoveredDir,".env"))}}}__name(preResolveHomeEnvOverrides,"preResolveHomeEnvOverrides");function readHomeEnvInto(file){if(!fs.existsSync(file)){return}try{const parsed=dotenv.parse(fs.readFileSync(file,"utf-8"));for(const key of HOME_ENV_BOOTSTRAP_KEYS){if(parsed[key]&&!Object.hasOwn(process.env,key)){process.env[key]=parsed[key]}}}catch(_e){}}__name(readHomeEnvInto,"readHomeEnvInto");function resetHomeEnvBootstrapForTesting(){homeEnvBootstrapped=false}__name(resetHomeEnvBootstrapForTesting,"resetHomeEnvBootstrapForTesting");function resetEnvironmentTrackingForTesting(){resetLoaderKeyRejectionReportingForTesting();resetEnvironmentSnapshotForTesting();dotEnvSourcedKeys.clear();settingsEnvSourcedKeys.clear();inheritedDotEnvKeys.clear();inheritedSettingsEnvKeys.clear();requestTimeEnvKeys.clear();delete process.env[PRIVATE_RELAUNCH_ENV_PROVENANCE];lastReloadSnapshot.clear();lastReloadSnapshotSeeded=false}__name(resetEnvironmentTrackingForTesting,"resetEnvironmentTrackingForTesting");function isFileSourcedEnvKey(key){const sources=[dotEnvSourcedKeys,settingsEnvSourcedKeys,inheritedDotEnvKeys,inheritedSettingsEnvKeys];if(sources.some(keys=>keys.has(key))){return true}if(process.platform!=="win32")return false;const lower=key.toLowerCase();for(const keys of sources){for(const tracked of keys){if(tracked.toLowerCase()===lower)return true}}return false}__name(isFileSourcedEnvKey,"isFileSourcedEnvKey");function getHomeEnvFallbackVars(onReadError){const globalQwenDir=Storage.getGlobalQwenDir();const candidates=[path.join(globalQwenDir,".env")];if(!process.env["QWEN_HOME"]){candidates.push(path.join(path.dirname(globalQwenDir),".env"))}const result={};for(const candidate of candidates){if(!fs.existsSync(candidate)){continue}try{const parsed=dotenv.parse(fs.readFileSync(candidate,"utf-8"));for(const key in parsed){if(Object.hasOwn(parsed,key)&&!Object.hasOwn(process.env,key)){result[key]??=parsed[key]}}}catch(e){onReadError?.(`Failed to read home .env candidate ${candidate}: ${getErrorMessage(e)}`)}}return result}__name(getHomeEnvFallbackVars,"getHomeEnvFallbackVars");function findEnvFiles(settings,startDir,userLevelPaths=getUserLevelEnvPaths(),workspaceTrusted){const homeDir=os.homedir();let realStartDir=path.resolve(startDir);try{realStartDir=fs.realpathSync(realStartDir)}catch{}const globalQwenDir=Storage.getGlobalQwenDir();const legacyQwenDir=path.normalize(path.join(homeDir,QWEN_DIR));const hasCustomConfigDir=path.normalize(globalQwenDir)!==legacyQwenDir;const found=[];const seen=new Set;const workspaceIsTrusted=workspaceTrusted??isWorkspaceTrusted(settings,void 0,realStartDir).isTrusted===true;const canUseEnvFile=__name(filePath=>{const normalized=path.normalize(filePath);if(userLevelPaths.has(normalized))return true;if(!workspaceIsTrusted)return false;const dirPath=path.dirname(normalized);const workspaceDir=path.basename(dirPath)===SETTINGS_DIRECTORY_NAME?path.dirname(dirPath):dirPath;if(workspaceDir===realStartDir)return true;return isWorkspaceTrusted(settings,void 0,workspaceDir).isTrusted!==false},"canUseEnvFile");const pushCandidate=__name(filePath=>{const normalized=path.normalize(filePath);if(!seen.has(normalized)&&fs.existsSync(filePath)&&canUseEnvFile(filePath)){seen.add(normalized);found.push(filePath);return true}return false},"pushCandidate");const pushHomeCandidates=__name(()=>{const candidates=[path.join(globalQwenDir,".env")];if(hasCustomConfigDir){candidates.push(path.join(legacyQwenDir,".env"))}candidates.push(path.join(homeDir,".env"));for(const candidate of candidates){pushCandidate(candidate)}},"pushHomeCandidates");if(path.resolve(startDir)===path.resolve(homeDir)){pushHomeCandidates();return found}let currentDir=realStartDir;let visitedHomeDir=false;while(true){if(currentDir===homeDir){visitedHomeDir=true;pushHomeCandidates();return found}else{const geminiEnvPath=path.join(currentDir,QWEN_DIR,".env");if(pushCandidate(geminiEnvPath)){pushHomeCandidates();return found}const envPath=path.join(currentDir,".env");if(pushCandidate(envPath)){pushHomeCandidates();return found}}const parentDir=path.dirname(currentDir);if(parentDir===currentDir||!parentDir){if(!visitedHomeDir){pushHomeCandidates()}return found}currentDir=parentDir}}__name(findEnvFiles,"findEnvFiles");function setUpCloudShellEnvironment(envFilePath){if(envFilePath&&fs.existsSync(envFilePath)){const envFileContent=fs.readFileSync(envFilePath);const parsedEnv=dotenv.parse(envFileContent);if(parsedEnv["GOOGLE_CLOUD_PROJECT"]){process.env["GOOGLE_CLOUD_PROJECT"]=parsedEnv["GOOGLE_CLOUD_PROJECT"]}else{process.env["GOOGLE_CLOUD_PROJECT"]="cloudshell-gca"}}else{process.env["GOOGLE_CLOUD_PROJECT"]="cloudshell-gca"}}__name(setUpCloudShellEnvironment,"setUpCloudShellEnvironment");function setUpCloudShellEnvironmentInEnv(env,envFiles){for(const envFile of envFiles){if(envFile.parsedEnv["GOOGLE_CLOUD_PROJECT"]){env["GOOGLE_CLOUD_PROJECT"]=envFile.parsedEnv["GOOGLE_CLOUD_PROJECT"];return}}env["GOOGLE_CLOUD_PROJECT"]="cloudshell-gca"}__name(setUpCloudShellEnvironmentInEnv,"setUpCloudShellEnvironmentInEnv");function parseEnvFiles(envFilePaths,userLevelPaths){const files=[];const readFailures=[];for(const envFilePath of envFilePaths){try{const envFileContent=fs.readFileSync(envFilePath,"utf-8");const parsedEnv=dotenv.parse(envFileContent);const normalizedEnvFilePath=path.normalize(envFilePath);const isHomeScopedEnvFile=userLevelPaths.has(normalizedEnvFilePath);const isQwenScopedEnvFile=isHomeScopedEnvFile||path.basename(path.dirname(normalizedEnvFilePath))===QWEN_DIR;files.push({path:envFilePath,parsedEnv,isHomeScopedEnvFile,isQwenScopedEnvFile})}catch(err){readFailures.push({path:envFilePath,error:getErrorMessage(err)})}}return{files,readFailed:readFailures.length>0,readFailures}}__name(parseEnvFiles,"parseEnvFiles");function canApplyParsedEnvKey(envFile,key,excludedVars,options={}){if(!Object.hasOwn(envFile.parsedEnv,key))return false;if(isLoaderEnvKey(key))return false;if(isPrivateProvenanceEnvKey(key))return false;if(options.reload&&isReloadExcludedKey(key))return false;if(!envFile.isHomeScopedEnvFile&&isHardcodedProjectEnvExclusion(key)){return false}return envFile.isQwenScopedEnvFile||!excludedVars.includes(key)}__name(canApplyParsedEnvKey,"canApplyParsedEnvKey");function isEffectivelyUnset(env,key){const existingValue=env[key];return!Object.hasOwn(env,key)||existingValue===""}__name(isEffectivelyUnset,"isEffectivelyUnset");function setRuntimeEnvIfUnset(env,key,value){if(isEffectivelyUnset(env,key)){env[key]=value}}__name(setRuntimeEnvIfUnset,"setRuntimeEnvIfUnset");function reportRejectedSettingsEnv(env,startDir){const source=`settings.env (${startDir})`;reportRejectedLoaderKeys(source,Object.keys(env));if(Object.entries(env).some(([key,value])=>key.toUpperCase()==="QWEN_AGENT_EXECUTION_BACKEND"&&typeof value==="string"&&value.trim()!=="")){writeStderrLineSafe(`qwen: ${source} cannot set QWEN_AGENT_EXECUTION_BACKEND; ignored. Export it in the launch environment instead.`)}for(const[setting,key]of Object.entries(VERIFY_PR_COORDINATE_ENV)){const entry=Object.entries(env).find(([candidate,value])=>candidate.toUpperCase()===key&&typeof value==="string"&&value.trim()!=="");if(!entry)continue;writeStderrLineSafe(`qwen: ${source} cannot set ${entry[0]}; ignored. Set verifyPr.${setting} at user scope in settings.json, or export it in the launch environment.`)}}__name(reportRejectedSettingsEnv,"reportRejectedSettingsEnv");function buildRuntimeEnvironment(settings,startDir=process.cwd(),baseEnv=process.env,workspaceTrusted){const userLevelPaths=getUserLevelEnvPaths();const envFilePaths=findEnvFiles(settings,startDir,userLevelPaths,workspaceTrusted);const parsedEnvFiles=parseEnvFiles(envFilePaths,userLevelPaths);const effectiveEnv={...baseEnv};if(baseEnv["CLOUD_SHELL"]==="true"){setUpCloudShellEnvironmentInEnv(effectiveEnv,parsedEnvFiles.files)}for(const envFile of parsedEnvFiles.files){const excludedVars=settings?.advanced?.excludedEnvVars||DEFAULT_EXCLUDED_ENV_VARS;for(const key in envFile.parsedEnv){if(!canApplyParsedEnvKey(envFile,key,excludedVars,{reload:true})){continue}setRuntimeEnvIfUnset(effectiveEnv,key,envFile.parsedEnv[key])}reportRejectedLoaderKeys(`.env file ${envFile.path}`,Object.keys(envFile.parsedEnv))}if(settings.env){const excludedVars=settings?.advanced?.excludedEnvVars||DEFAULT_EXCLUDED_ENV_VARS;for(const[key,value]of Object.entries(settings.env)){if(isLoaderEnvKey(key))continue;if(isReloadExcludedKey(key))continue;if(isHardcodedProjectEnvExclusion(key))continue;if(excludedVars.includes(key))continue;if(typeof value!=="string")continue;setRuntimeEnvIfUnset(effectiveEnv,key,value)}reportRejectedSettingsEnv(settings.env,startDir)}const overlayKeys=Object.keys(effectiveEnv).filter(key=>effectiveEnv[key]!==baseEnv[key]).sort();return{effectiveEnv:Object.freeze({...effectiveEnv}),overlayKeys:Object.freeze(overlayKeys),envFilePaths:Object.freeze([...envFilePaths]),envFileReadFailed:parsedEnvFiles.readFailed,envFileReadFailures:Object.freeze([...parsedEnvFiles.readFailures])}}__name(buildRuntimeEnvironment,"buildRuntimeEnvironment");function loadEnvironment(settings,startDir=process.cwd()){captureEnvironmentBeforeLoad();rememberRequestTimeEnvKeys(settings);const userLevelPaths=getUserLevelEnvPaths();const envFilePaths=findEnvFiles(settings,startDir,userLevelPaths);const parsedEnvFiles=parseEnvFiles(envFilePaths,userLevelPaths);if(process.env["CLOUD_SHELL"]==="true"){setUpCloudShellEnvironmentInEnv(process.env,parsedEnvFiles.files)}for(const envFile of parsedEnvFiles.files){const excludedVars=settings?.advanced?.excludedEnvVars||DEFAULT_EXCLUDED_ENV_VARS;for(const key in envFile.parsedEnv){if(!canApplyParsedEnvKey(envFile,key,excludedVars))continue;const existingValue=process.env[key];const isEffectivelyUnset2=!Object.hasOwn(process.env,key)||existingValue==="";if(isEffectivelyUnset2){process.env[key]=envFile.parsedEnv[key];dotEnvSourcedKeys.add(key)}if(!lastReloadSnapshotSeeded&&!lastReloadSnapshot.has(key)){lastReloadSnapshot.set(key,envFile.parsedEnv[key])}}reportRejectedLoaderKeys(`.env file ${envFile.path}`,Object.keys(envFile.parsedEnv))}if(settings.env){for(const[key,value]of Object.entries(settings.env)){if(isLoaderEnvKey(key)){continue}if(isReloadExcludedKey(key)){continue}if(isHardcodedProjectEnvExclusion(key)){continue}const existingValue=process.env[key];const isEffectivelyUnset2=!Object.hasOwn(process.env,key)||existingValue==="";if(isEffectivelyUnset2&&typeof value==="string"){process.env[key]=value;settingsEnvSourcedKeys.add(key)}if(!lastReloadSnapshotSeeded&&typeof value==="string"&&!lastReloadSnapshot.has(key)){lastReloadSnapshot.set(key,value)}}reportRejectedSettingsEnv(settings.env,startDir)}lastReloadSnapshotSeeded=true;Object.assign(process.env,getRelaunchEnvProvenance());publishPendingCompileCache()}__name(loadEnvironment,"loadEnvironment");function reloadEnvironment(settings,workspaceCwd,workspaceTrusted,options={}){const userLevelPaths=getUserLevelEnvPaths();const envFilePaths=findEnvFiles(settings,workspaceCwd,userLevelPaths,workspaceTrusted);const parsedEnvFiles=parseEnvFiles(envFilePaths,userLevelPaths);if(parsedEnvFiles.readFailed&&options.failClosedOnEnvFileReadError){return{updatedKeys:[],removedKeys:[],envFileReadFailed:true}}if(process.env["CLOUD_SHELL"]==="true"){setUpCloudShellEnvironmentInEnv(process.env,parsedEnvFiles.files)}const dotEnvReadFailed=parsedEnvFiles.readFailed;const newDotEnvKeys=new Map;const newSettingsEnvKeys=new Map;for(const envFile of parsedEnvFiles.files){const excludedVars=settings?.advanced?.excludedEnvVars||DEFAULT_EXCLUDED_ENV_VARS;for(const key in envFile.parsedEnv){if(!canApplyParsedEnvKey(envFile,key,excludedVars,{reload:true})){continue}if(!newDotEnvKeys.has(key)){newDotEnvKeys.set(key,envFile.parsedEnv[key])}}reportRejectedLoaderKeys(`.env file ${envFile.path}`,Object.keys(envFile.parsedEnv))}if(settings.env){for(const[key,value]of Object.entries(settings.env)){if(isLoaderEnvKey(key))continue;if(isReloadExcludedKey(key))continue;if(isHardcodedProjectEnvExclusion(key))continue;if(typeof value!=="string")continue;const dotEnvValue=newDotEnvKeys.get(key);if(dotEnvValue!==void 0&&dotEnvValue!=="")continue;if(dotEnvReadFailed&&lastReloadSnapshot.has(key))continue;newSettingsEnvKeys.set(key,value)}reportRejectedSettingsEnv(settings.env,workspaceCwd)}const allNewKeys=new Set([...newDotEnvKeys.keys(),...newSettingsEnvKeys.keys()]);const updatedKeys=[];const removedKeys=[];if(!dotEnvReadFailed){const previouslyKnown=new Set([...lastReloadSnapshot.keys(),...dotEnvSourcedKeys,...settingsEnvSourcedKeys]);for(const key of previouslyKnown){if(!allNewKeys.has(key)&&!isReloadExcludedKey(key)){delete process.env[key];inheritedDotEnvKeys.delete(key);inheritedSettingsEnvKeys.delete(key);removedKeys.push(key)}}}for(const[key,value]of newDotEnvKeys){if(value===""&&newSettingsEnvKeys.has(key))continue;if(process.env[key]!==value){updatedKeys.push(key)}process.env[key]=value}for(const[key,value]of newSettingsEnvKeys){if(process.env[key]!==value){updatedKeys.push(key)}process.env[key]=value}if(!dotEnvReadFailed){for(const sources of[dotEnvSourcedKeys,settingsEnvSourcedKeys]){for(const key of sources){if(!isReloadExcludedKey(key))sources.delete(key)}}lastReloadSnapshot.clear();for(const[key,value]of newDotEnvKeys){lastReloadSnapshot.set(key,value)}for(const[key,value]of newSettingsEnvKeys){lastReloadSnapshot.set(key,value)}}for(const key of newDotEnvKeys.keys()){dotEnvSourcedKeys.add(key)}for(const key of newSettingsEnvKeys.keys()){settingsEnvSourcedKeys.add(key)}Object.assign(process.env,getRelaunchEnvProvenance());return{updatedKeys,removedKeys,...dotEnvReadFailed?{envFileReadFailed:true}:{}}}__name(reloadEnvironment,"reloadEnvironment");export{SETTINGS_DIRECTORY_NAME,hasLoadedEnvironmentValues,getRelaunchEnvProvenance,preResolveHomeEnvOverrides,resetHomeEnvBootstrapForTesting,resetEnvironmentTrackingForTesting,isFileSourcedEnvKey,getHomeEnvFallbackVars,findEnvFiles,setUpCloudShellEnvironment,buildRuntimeEnvironment,loadEnvironment,reloadEnvironment};
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2025 Qwen Team
|