@qwen-code/qwen-code 0.25.2-preview.1 → 0.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunks/{MaxSizedBox-CF4NN4Y7.js → MaxSizedBox-CGJP7S5S.js} +1 -1
- package/chunks/{StandaloneSessionPicker-Q23KTB6U.js → StandaloneSessionPicker-H6NONKPP.js} +1 -1
- package/chunks/{acp-subagent-executor-LXOLDTFY.js → acp-subagent-executor-7OCKCTA5.js} +1 -1
- package/chunks/{acpAgent-QRKZVQAG.js → acpAgent-VCKTBLFO.js} +3 -3
- package/chunks/{advisor-VZZJU7BR.js → advisor-UQJ45FLG.js} +1 -1
- package/chunks/{agent-LP66VBC4.js → agent-KMSCVRSG.js} +1 -1
- package/chunks/{agent-headless-W5P4KPX4.js → agent-headless-3FWQ5QNO.js} +1 -1
- package/chunks/{agent-host-client-OW4HBXRL.js → agent-host-client-PXIIFCCS.js} +1 -1
- package/chunks/{agent-host-connections-D7IC6WWL.js → agent-host-connections-QUYGQNJX.js} +1 -1
- package/chunks/{anthropicContentGenerator-6I25Q3Y6.js → anthropicContentGenerator-MDETV5LU.js} +1 -1
- package/chunks/{batch-7E5KJ625.js → batch-RQO2HWFV.js} +1 -1
- package/chunks/{bridge-BITC2AVN.js → bridge-OA3GEU2I.js} +1 -1
- package/chunks/{channel-settings-store-VAVG6ONF.js → channel-settings-store-YN23NP2H.js} +1 -1
- package/chunks/{chunk-4NCTKE4Z.js → chunk-2PQ5ZRTI.js} +1 -1
- package/chunks/{chunk-OJHTHXBC.js → chunk-32UFT5HU.js} +1 -1
- package/chunks/{chunk-2HJZ3OYW.js → chunk-3C34EMBZ.js} +1 -1
- package/chunks/{chunk-UXFLNZNB.js → chunk-3FPPMGVC.js} +1 -1
- package/chunks/{chunk-74YXI5IJ.js → chunk-445NIH5T.js} +1 -1
- package/chunks/{chunk-MXXYBMBZ.js → chunk-45EKBDFD.js} +1 -1
- package/chunks/{chunk-JV5FCFG4.js → chunk-4WFWZWR3.js} +1 -1
- package/chunks/{chunk-AAOAX46J.js → chunk-56NX3ASC.js} +1 -1
- package/chunks/{chunk-IBS4PHD2.js → chunk-5FY6TL3Z.js} +1 -1
- package/chunks/{chunk-UGI3XPRM.js → chunk-5GJPVNHI.js} +1 -1
- package/chunks/{chunk-7BZGY7AH.js → chunk-5XAVUYY6.js} +6 -6
- package/chunks/{chunk-V3WNU4F5.js → chunk-655XEN5H.js} +1 -1
- package/chunks/{chunk-APX7ODYT.js → chunk-6PHAGUA6.js} +1 -1
- package/chunks/{chunk-CD6C4OHZ.js → chunk-7YX6LW5H.js} +1 -1
- package/chunks/{chunk-C2NFZSGI.js → chunk-AAVRYR5T.js} +1 -1
- package/chunks/{chunk-EO35BRIG.js → chunk-ANUAITTH.js} +1 -1
- package/chunks/{chunk-CNQ6AOFN.js → chunk-AZ5GFEKG.js} +1 -1
- package/chunks/{chunk-KAEW65QP.js → chunk-B5XDGUAK.js} +1 -1
- package/chunks/{chunk-X6QHNKUW.js → chunk-BCNBZOGV.js} +1 -1
- package/chunks/{chunk-W5DIWPQB.js → chunk-BDXWLZJD.js} +1 -1
- package/chunks/{chunk-ZASVUARY.js → chunk-BPX4A433.js} +1 -1
- package/chunks/{chunk-CDSI44GJ.js → chunk-BUI6W6CU.js} +1 -1
- package/chunks/{chunk-ZEYCGUHI.js → chunk-BVARURDD.js} +1 -1
- package/chunks/{chunk-PZ5UPKIG.js → chunk-BW5CHWEJ.js} +2 -2
- package/chunks/{chunk-7TUP75C2.js → chunk-C4DSH4A3.js} +1 -1
- package/chunks/{chunk-R4KMBENY.js → chunk-CCBWBPJL.js} +1 -1
- package/chunks/{chunk-TU6DWKVI.js → chunk-CKJ3OUIV.js} +2 -2
- package/chunks/{chunk-SG5P4CK4.js → chunk-CRZ7QRFB.js} +1 -1
- package/chunks/{chunk-UYFL7K4Z.js → chunk-CTEBIP2S.js} +1 -1
- package/chunks/{chunk-WSIDVWGO.js → chunk-DBOWUORN.js} +1 -1
- package/chunks/{chunk-NAHKSVYI.js → chunk-DPBXGGQX.js} +1 -1
- package/chunks/{chunk-BMOJDKDZ.js → chunk-DSSSLNXD.js} +3 -3
- package/chunks/{chunk-FP2RLPWJ.js → chunk-EKGFFEH4.js} +1 -1
- package/chunks/{chunk-L7W3J427.js → chunk-EMEQR2LX.js} +1 -1
- package/chunks/{chunk-YRYMLJAC.js → chunk-ENUYA7BO.js} +1 -1
- package/chunks/{chunk-4CWBH6LP.js → chunk-EORORGZC.js} +1 -1
- package/chunks/{chunk-RBH3BOVF.js → chunk-EUK64V6Z.js} +1 -1
- package/chunks/{chunk-AII4DN7M.js → chunk-FBV4LUUL.js} +1 -1
- package/chunks/{chunk-YVEPPENZ.js → chunk-FFLFTXO7.js} +1 -1
- package/chunks/{chunk-2HSFO66N.js → chunk-FHXH3GSI.js} +1 -1
- package/chunks/{chunk-RH6PMH32.js → chunk-FVBDVZD7.js} +1 -1
- package/chunks/{chunk-Y2HLDUZG.js → chunk-I2D2ZUKF.js} +1 -1
- package/chunks/{chunk-6PUZWUMQ.js → chunk-I3FZ733S.js} +1 -1
- package/chunks/{chunk-GG7RNHZW.js → chunk-IFAUFERF.js} +5 -5
- package/chunks/{chunk-JQ7BCB3L.js → chunk-IYFUH3JB.js} +1 -1
- package/chunks/{chunk-VAMQAYF3.js → chunk-JB5I5QAD.js} +1 -1
- package/chunks/{chunk-Z3UZTCKY.js → chunk-JD3QDS7D.js} +1 -1
- package/chunks/{chunk-TFVPY43T.js → chunk-JG2UNQOW.js} +1 -1
- package/chunks/{chunk-E4MRBL4O.js → chunk-JSXHTTFE.js} +1 -1
- package/chunks/{chunk-QTYA6TES.js → chunk-LJLS3MDJ.js} +1 -1
- package/chunks/{chunk-RZISIEQL.js → chunk-MEIW5WVJ.js} +1 -1
- package/chunks/{chunk-ZD4U3GR4.js → chunk-MGL36H3B.js} +1 -1
- package/chunks/{chunk-HXA3X4PB.js → chunk-MJUFVFH3.js} +1 -1
- package/chunks/{chunk-SYIDPXVT.js → chunk-MSR6LYHS.js} +1 -1
- package/chunks/{chunk-4MJ67O5W.js → chunk-MTXJRB7G.js} +2 -2
- package/chunks/{chunk-F5P3BWS7.js → chunk-MXFBSMIM.js} +1 -1
- package/chunks/{chunk-W6TNBCKX.js → chunk-MYHJ4WUH.js} +1 -1
- package/chunks/{chunk-CWU5NJOB.js → chunk-NHXKNS7F.js} +1 -1
- package/chunks/{chunk-6OIJIF6G.js → chunk-NT74NPQT.js} +1 -1
- package/chunks/{chunk-O47FCWNF.js → chunk-NWXW4UNC.js} +1 -1
- package/chunks/{chunk-JASL4RZR.js → chunk-O77LM4EW.js} +1 -1
- package/chunks/{chunk-ZDNTENP2.js → chunk-OB7T2MDO.js} +1 -1
- package/chunks/{chunk-L7WFW57T.js → chunk-PODFLAH7.js} +1 -1
- package/chunks/{chunk-R3ZMQ7WR.js → chunk-Q2G675WT.js} +1 -1
- package/chunks/{chunk-H3QROVUO.js → chunk-QT27SK62.js} +1 -1
- package/chunks/{chunk-UELAXFT7.js → chunk-QZPNBV4F.js} +1 -1
- package/chunks/{chunk-B3L4LODR.js → chunk-RV54BGL2.js} +1 -1
- package/chunks/{chunk-KLXL3FSI.js → chunk-SFETIBPP.js} +1 -1
- package/chunks/{chunk-F3YGAXZ5.js → chunk-SGKINIQB.js} +1 -1
- package/chunks/{chunk-MBPT3YYO.js → chunk-SHJNP7OV.js} +1 -1
- package/chunks/{chunk-U3YSYIQE.js → chunk-SPFRORFN.js} +1 -1
- package/chunks/{chunk-S3B4TZVJ.js → chunk-SPLINFM7.js} +1 -1
- package/chunks/{chunk-ORIS5AVH.js → chunk-SYO5FPHL.js} +1 -1
- package/chunks/{chunk-AGHGPOH6.js → chunk-TEE4MM5S.js} +1 -1
- package/chunks/{chunk-WHF3HYZI.js → chunk-TPZTO4K3.js} +1 -1
- package/chunks/{chunk-KJO757RN.js → chunk-UY2CSL5W.js} +1 -1
- package/chunks/{chunk-VCTZRPKP.js → chunk-W7QYXFWW.js} +1 -1
- package/chunks/{chunk-T3ECMT6I.js → chunk-WQOZJ6V7.js} +2 -2
- package/chunks/{chunk-INEI2ZW2.js → chunk-WZK7RC36.js} +1 -1
- package/chunks/{chunk-Y5JLH3SN.js → chunk-X22435IN.js} +4 -4
- package/chunks/{chunk-WHNAY3QQ.js → chunk-X2KF6AUQ.js} +1 -1
- package/chunks/{chunk-MUEIZGTI.js → chunk-YHPHQX6M.js} +1 -1
- package/chunks/{chunk-5OOO3YIH.js → chunk-YL7QMYOX.js} +1 -1
- package/chunks/{chunk-43E3XC2W.js → chunk-YQEOEO5V.js} +1 -1
- package/chunks/{chunk-624P32LD.js → chunk-YZ374XTK.js} +1 -1
- package/chunks/{codex-subagent-executor-2MPLWNLD.js → codex-subagent-executor-MC3QB2AN.js} +1 -1
- package/chunks/{config-utils-MJEEBLQW.js → config-utils-FYT7PUIC.js} +1 -1
- package/chunks/{contextCommand-BP566QVE.js → contextCommand-DXMSMSR7.js} +1 -1
- package/chunks/{core-runtime-BOAIFYAZ.js → core-runtime-ZLB6QZ3Z.js} +1 -1
- package/chunks/{create-sub-session-HJVK7AXV.js → create-sub-session-YUI3G5AF.js} +1 -1
- package/chunks/{daemon-git-worktree-guard-KA2Y6FHL.js → daemon-git-worktree-guard-5PYZMC6T.js} +1 -1
- package/chunks/{daemon-status-provider-JGR5JT2T.js → daemon-status-provider-GC567FVE.js} +1 -1
- package/chunks/{daemon-trust-policy-EP4DHXOW.js → daemon-trust-policy-LLD2UMPF.js} +1 -1
- package/chunks/{daemon-trust-policy-monitor-W3VZRKOK.js → daemon-trust-policy-monitor-MRMB2CRJ.js} +1 -1
- package/chunks/{deferred-core-runtime-Q3JH7XDL.js → deferred-core-runtime-4HLTINJ6.js} +1 -1
- package/chunks/{edit-S7DCBMAL.js → edit-CZ6FEXDU.js} +1 -1
- package/chunks/{enterPlanMode-UX7B6KWX.js → enterPlanMode-O3CJ3I2J.js} +1 -1
- package/chunks/{environment-ZBW6HDG3.js → environment-OJWH4FYL.js} +1 -1
- package/chunks/{errors-7ZRLUHEB.js → errors-NWKSQVL3.js} +1 -1
- package/chunks/{execution-tool-R244Q3GW.js → execution-tool-7UCADALN.js} +1 -1
- package/chunks/{execution-worker-JR44JTC4.js → execution-worker-LWHQMPBV.js} +1 -1
- package/chunks/{exitPlanMode-2PTTZXGO.js → exitPlanMode-JDM6ZZWI.js} +1 -1
- package/chunks/{fast-path-NQQ42XUR.js → fast-path-4WHPMNMD.js} +1 -1
- package/chunks/{glob-4JP6RQNK.js → glob-LAU4YJ6J.js} +1 -1
- package/chunks/{goal-tools-MO7NIH7B.js → goal-tools-AF2FQO3H.js} +1 -1
- package/chunks/{handleAutoUpdate-STUVMCIU.js → handleAutoUpdate-WBWK4775.js} +1 -1
- package/chunks/{i18n-UTIILRKE.js → i18n-O4Q2KHOA.js} +1 -1
- package/chunks/{initializer-YI2WT6LZ.js → initializer-2AH3EKBL.js} +1 -1
- package/chunks/{installationInfo-PW2JHHJV.js → installationInfo-77WYXG4W.js} +1 -1
- package/chunks/{list-SAOL2OZI.js → list-RAU3ZJQS.js} +1 -1
- package/chunks/{llm-LMY62H6Z.js → llm-MJMQ34KB.js} +4 -4
- package/chunks/{llm-content-generator-6RPOZ2YR.js → llm-content-generator-MJPR2TWC.js} +1 -1
- package/chunks/{loadedSettingsAdapter-RNXWDDE2.js → loadedSettingsAdapter-WRWWNGHZ.js} +1 -1
- package/chunks/{local-execution-environment-GIWY2LO6.js → local-execution-environment-VVJ7OYBT.js} +1 -1
- package/chunks/{loggingContentGenerator-AOKEDXK6.js → loggingContentGenerator-722BJL7T.js} +1 -1
- package/chunks/{manage-memory-WKPWLYDD.js → manage-memory-GN56UQHG.js} +1 -1
- package/chunks/{managed-npm-update-LFFWFATA.js → managed-npm-update-5VE662JS.js} +1 -1
- package/chunks/{managed-runtime-attestation-worker-IV6ZNIAK.js → managed-runtime-attestation-worker-ASGGZMFM.js} +1 -1
- package/chunks/{managed-runtime-session-worker-3NU4FOXD.js → managed-runtime-session-worker-YUSO7WFB.js} +1 -1
- package/chunks/{mcp-RDDGN4JK.js → mcp-6D236MEH.js} +1 -1
- package/chunks/{model-call-collection-JARTJD6S.js → model-call-collection-UAE2W6VV.js} +1 -1
- package/chunks/{model-configuration-7H6PEOLY.js → model-configuration-VHPSBCQI.js} +1 -1
- package/chunks/{modelConfigUtils-Q63ZZTXY.js → modelConfigUtils-XKDXYQRJ.js} +1 -1
- package/chunks/{monitor-HLO366TQ.js → monitor-JIKXBXDK.js} +1 -1
- package/chunks/{nonInteractiveCli-JO5EG6OK.js → nonInteractiveCli-IXTK5V4Q.js} +1 -1
- package/chunks/{nonInteractiveToolExecutor-T7AKBX25.js → nonInteractiveToolExecutor-3MSROJV5.js} +1 -1
- package/chunks/{notebook-edit-XKULPMG7.js → notebook-edit-VDWBIBMG.js} +1 -1
- package/chunks/{omni-H3GFC6KR.js → omni-MEUE65XC.js} +1 -1
- package/chunks/{openaiContentGenerator-RT4S6OYR.js → openaiContentGenerator-KNZTYVNK.js} +1 -1
- package/chunks/{openaiResponsesContentGenerator-JD4ZBCAL.js → openaiResponsesContentGenerator-G7GRJXES.js} +1 -1
- package/chunks/{pidfile-JXCPPGC6.js → pidfile-HMEKKPWO.js} +1 -1
- package/chunks/{processUtils-FF7LHGHW.js → processUtils-KHWNT3KU.js} +1 -1
- package/chunks/{prompt-terminal-ledger-VLIEJ5BB.js → prompt-terminal-ledger-EY72RU3D.js} +1 -1
- package/chunks/{qwenContentGenerator-6SGQI4ES.js → qwenContentGenerator-A7WREYLV.js} +1 -1
- package/chunks/{reactive-degrade-2UJPX4AU.js → reactive-degrade-O6WBGQ5X.js} +1 -1
- package/chunks/{read-file-27DWTM5N.js → read-file-A4MQWC6T.js} +1 -1
- package/chunks/{resumeHistoryUtils-KRF2LD7T.js → resumeHistoryUtils-KNUVMH5J.js} +1 -1
- package/chunks/{review-IPFFTVGV.js → review-OC76PLQ4.js} +1 -1
- package/chunks/{ripGrep-75QL35XD.js → ripGrep-JR6DHTIW.js} +1 -1
- package/chunks/{run-qwen-serve-WW74NSUL.js → run-qwen-serve-NFPGPJJ2.js} +2 -2
- package/chunks/{runtime-Z2NIOF6Y.js → runtime-BPHFAZOP.js} +1 -1
- package/chunks/{sandboxConfig-WMQAKX7Q.js → sandboxConfig-KXTV3QBG.js} +1 -1
- package/chunks/{scheduled-tasks-LMJJ5ZM7.js → scheduled-tasks-2GNFZH4N.js} +1 -1
- package/chunks/{scheduler-KHWWXW6H.js → scheduler-CKLZCETX.js} +1 -1
- package/chunks/{search-memory-WEO3M674.js → search-memory-ICNU2EJA.js} +1 -1
- package/chunks/{send-message-E2EVXDU4.js → send-message-T32PFXX5.js} +1 -1
- package/chunks/{serve-E7ZGE7PD.js → serve-O7XBFM36.js} +1 -1
- package/chunks/{server-SSHP5IO4.js → server-7H2EGX7C.js} +3 -3
- package/chunks/{session-UWUQU3NV.js → session-SO4TKKO3.js} +1 -1
- package/chunks/{session-attachments-root-I35OUD7P.js → session-attachments-root-QPBJB3Y2.js} +1 -1
- package/chunks/{session-execution-engine-selector-S7HXLYKG.js → session-execution-engine-selector-73JQ7AG6.js} +1 -1
- package/chunks/{session-pr-refresh-34FLQB2Z.js → session-pr-refresh-XPDBRBQV.js} +1 -1
- package/chunks/{sessionService-BBC2563F.js → sessionService-DDLWVLNC.js} +1 -1
- package/chunks/{settings-BXCTAYMU.js → settings-TUEKBNAX.js} +1 -1
- package/chunks/{shell-ORZNRZKX.js → shell-SXSN7UYK.js} +1 -1
- package/chunks/{skill-3MJ6V2VQ.js → skill-XAYT7HGV.js} +1 -1
- package/chunks/{skill-settings-A7TTYJGH.js → skill-settings-X3O75XUN.js} +1 -1
- package/chunks/{spawnChannel-UPHPUPIJ.js → spawnChannel-3523LPUW.js} +1 -1
- package/chunks/{standalone-update-GGHQ54QB.js → standalone-update-T7AUODLV.js} +1 -1
- package/chunks/{start-opentui-ui-O6WMWLGS.js → start-opentui-ui-IKBADQQS.js} +1 -1
- package/chunks/{startInteractiveUI-N3ZPR2FK.js → startInteractiveUI-PV2JETB4.js} +1 -1
- package/chunks/{team-create-EYLFAQVU.js → team-create-ZKTBFE7Z.js} +1 -1
- package/chunks/{team-plan-approval-2WFSX4XE.js → team-plan-approval-SCTAN2HM.js} +1 -1
- package/chunks/{terminal-image-renderer-A5HEJZTW.js → terminal-image-renderer-EDBYTK3B.js} +1 -1
- package/chunks/{theme-manager-TQHNJSKQ.js → theme-manager-ZLXHLO2Y.js} +1 -1
- package/chunks/{tool-call-UBLAA45C.js → tool-call-ULUE3W3P.js} +1 -1
- package/chunks/{tool-result-media-53AD3EHK.js → tool-result-media-VXS7QTX7.js} +1 -1
- package/chunks/{tool-search-D6PSBDDZ.js → tool-search-VWM6VCVU.js} +1 -1
- package/chunks/{total-session-admission-CUMMWSM2.js → total-session-admission-FZDBG232.js} +1 -1
- package/chunks/{trustedFolders-TERXKVJ6.js → trustedFolders-VIPEDZNB.js} +1 -1
- package/chunks/{update-relaunch-PXCI66U2.js → update-relaunch-N6TNUHQE.js} +1 -1
- package/chunks/{updateCheck-2P4ANPL7.js → updateCheck-367IR3FW.js} +1 -1
- package/chunks/{upload-config-G2WZG4DM.js → upload-config-5W4WTLML.js} +1 -1
- package/chunks/{useAutoAcceptIndicator-H7I7JP34.js → useAutoAcceptIndicator-SGT7EBCJ.js} +1 -1
- package/chunks/{validateNonInterActiveAuth-VLRV5LCK.js → validateNonInterActiveAuth-7WEBPZ4S.js} +1 -1
- package/chunks/{version-AOKDKXXZ.js → version-3OKRQ6LC.js} +1 -1
- package/chunks/{web-fetch-OUJS56AV.js → web-fetch-BV7BK5NT.js} +1 -1
- package/chunks/{web-search-3S4ZIGLP.js → web-search-DFQ74G7V.js} +1 -1
- package/chunks/{workflow-6W4WB4L5.js → workflow-EXSCHLQK.js} +1 -1
- package/chunks/{workspace-agents-7GB2RLY5.js → workspace-agents-HPOPFXKJ.js} +1 -1
- package/chunks/{workspace-providers-status-OMD57CUW.js → workspace-providers-status-UQCSR2PB.js} +1 -1
- package/chunks/{workspace-registration-store-WKLFVMQ2.js → workspace-registration-store-Q5U4WD5M.js} +1 -1
- package/chunks/{workspace-registry-6WJOPYIS.js → workspace-registry-I2O2LXTZ.js} +1 -1
- package/chunks/{workspace-runtime-coordinator-XG7G7DG3.js → workspace-runtime-coordinator-MVVDZYYX.js} +1 -1
- package/chunks/{workspace-service-YLX46RJM.js → workspace-service-CFJ2EUB7.js} +1 -1
- package/chunks/{workspace-skills-status-JZZR7QHN.js → workspace-skills-status-LLNIK3NS.js} +1 -1
- package/chunks/{workspace-trust-reconciler-AO3I5KYO.js → workspace-trust-reconciler-VLGJXLCZ.js} +1 -1
- package/chunks/{write-file-MGYLC32T.js → write-file-RG7HHIYP.js} +1 -1
- package/chunks/{zoom-image-TZ527ASZ.js → zoom-image-AKW6CA4K.js} +1 -1
- package/cli.js +2 -2
- package/execution-worker.js +1 -1
- package/export-transcript-document.js +1 -1
- package/package.json +3 -3
- package/web-shell/assets/{PierreFilePreview-Cq9imG0c.js → PierreFilePreview-Cij36lF-.js} +1 -1
- package/web-shell/assets/{SpreadsheetPreview-Blho0kkO.js → SpreadsheetPreview-kDlHrK21.js} +1 -1
- package/web-shell/assets/{WorkspaceFileBrowser-DjeX-ArR.js → WorkspaceFileBrowser-DBXW9l-s.js} +1 -1
- package/web-shell/assets/{abnfDiagram-VCTEODGH-mEfLgGao.js → abnfDiagram-VCTEODGH-DBrfOx4O.js} +1 -1
- package/web-shell/assets/{agents-route-Bg4_tLdL.js → agents-route-6E_3XRjk.js} +1 -1
- package/web-shell/assets/{arc-DEVpMJqB.js → arc-RwrvKU6y.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-CGhqKvd1.js → architectureDiagram-5GKGNRK7-B2_hfNn6.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-DxpWdCdl.js → blockDiagram-NRAW4CY4-C755qTFO.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-CE1W0_yu.js → c4Diagram-UCG6FXSJ-CARC2uHQ.js} +1 -1
- package/web-shell/assets/channel-U9JRrjem.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-ibHTXjoH.js → chunk-2Q5K7J3B-BS1ldEp9.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-BEZ2-gCE.js → chunk-5VM5RSS4-DckOEd3N.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-CKyPZ7Jh.js → chunk-F27PBJKO-fZstOLLL.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-WHNRb7iQ.js → chunk-G27WJ6UU-Bf4QkrJ7.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-Dm4G-fLP.js → chunk-JWPE2WC7-uBW51XO_.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-BvTm39E-.js → chunk-LCL6LL3I-D2MYZdE_.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-C0zAbzIo.js → chunk-POPQ4Y6H-CzTHTST7.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-B36K-VPq.js → chunk-SVP7TREG-fL48tjL5.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-D1opdtZ1.js → chunk-XXDRQBXY-R1jjDz-e.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-r255RW6f.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-r255RW6f.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-S_IO4ZW5.js → cose-bilkent-JH36ORCC-DTK6Alrt.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-CGUKfurr.js → cynefin-OW5HDTMX-C1JYDjN4.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-BqUpO_VD.js → cynefinDiagram-5FMLGOSQ-C3bR18IM.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-CiKqZpUi.js → dagre-3AP2YEHR-D4oUlW7g.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-B3CQED4o.js → diagram-S7CK7UJ4-m-a-vk_2.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-BewunX5H.js → diagram-UQ7AKVKN-CVGSVvpJ.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-C5j1hiVn.js → diagram-VSXAHHWV-DcLovKfd.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-CWDIIA61.js → diagram-VX7I27RA-DAwY09qQ.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-COa1V8UD.js → diagram-Z3DM3KII-D4BWV8Yb.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-CP33EIO8.js → ebnfDiagram-PWID7BFC-AhqQLlAR.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-V2pL2JAp.js → erDiagram-SSCWMZ5O-DcIpsPuK.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-CF-YQlR_.js → flowDiagram-A5DVABFB-Cdu3v56D.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-TXUid-Q2.js → ganttDiagram-EL5Y4UJY-D8o98Muo.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-QNcIYsgn.js → gitGraphDiagram-WWUBYQGX-fIAd56jC.js} +1 -1
- package/web-shell/assets/{index-CKa6aZMZ.js → index-CJmvuO8Q.js} +1 -1
- package/web-shell/assets/{index-N9F4X44H.js → index-DSh5Yfsf.js} +5 -5
- package/web-shell/assets/{infoDiagram-RXCK75RN-Dn1biwuc.js → infoDiagram-RXCK75RN-dPnP0Koe.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-iBYO7WCt.js → ishikawaDiagram-5VMMS53U-f9Oq8YH7.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-D98LzO4k.js → journeyDiagram-EYS64GPL-CqwSlUQ1.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-lQMIgDSM.js → kanban-definition-3QL26DDD-Bh_KTp2S.js} +1 -1
- package/web-shell/assets/{layout-BgOy6tFo.js → layout-0e-hGnuM.js} +1 -1
- package/web-shell/assets/{linear-En8RXsBs.js → linear-BtxWFISv.js} +1 -1
- package/web-shell/assets/{mermaid.core-BneKXyZr.js → mermaid.core-Dik4l-jM.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-NkP_9BC4.js → mindmap-definition-FBJOCRG2-B7gext3e.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-B0ie-nkt.js → pegDiagram-XKGWAZYB-BfyKzGY0.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-Qa86cFZc.js → pieDiagram-E7YTZNPT-vfeVyHgh.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-CkjUzR0e.js → quadrantDiagram-AXDQQJYC-DGAZmngq.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-mN7KpgJG.js → railroadDiagram-O6MQD6OU-Dgxiy8W5.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-Bmn2z6x2.js → requirementDiagram-EFPCY7ZU-D7TFokdR.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-CYWnwpoW.js → sankeyDiagram-P5KCCOFB-BZU_UYd-.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-BFyWlR1P.js → sequenceDiagram-WJ2MYXX4-Bz94qtvq.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-BwCPrn2w.js → sizeCapture-X5ZJPWSS-DVlzIShY.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-oqL3E0Ws.js → stateDiagram-HBIQ2CUA-CE9Il33j.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-BVL1rIGD.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-C3FAVL8g.js → swimlanes-XN3QIQJK-Cr2CyF9L.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-BeWJAUmf.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-BdwxFsPJ.js → timeline-definition-24CTP7MA-DWbRlUDe.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-j_G2AbSj.js → vennDiagram-4TSXK5OY-Bp5BiaRL.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-Dy_fHHBq.js → wardleyDiagram-VM6X3IG4-DoQIUrT8.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-CnLgG50x.js → xychartDiagram-S5SC5T6Z-BTO308Vv.js} +1 -1
- package/web-shell/index.html +1 -1
- package/web-shell/sw.js +1 -1
- package/web-shell/assets/channel-CHCXOu89.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-DXIqcod_.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-DXIqcod_.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-Cmho6gw2.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-D9Sfkn7b.js +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{buildTrustPrecedenceRules,resolveTrustDecision,resolveTrustRule}from"./chunk-EIPLDYEY.js";import{arePathsEquivalent,getPathComparisonVariants}from"./chunk-IDXJIDME.js";import{ideContextStore}from"./chunk-GG7RNHZW.js";import{require_proper_lockfile}from"./chunk-YIW3H46P.js";import{atomicWriteFileSync}from"./chunk-BMHYEQTI.js";import{writeStderrLine}from"./chunk-SLPJ4OII.js";import{createDebugLogger}from"./chunk-JAUJI56S.js";import{Storage}from"./chunk-EPODBRBP.js";import{FatalConfigError,getErrorMessage}from"./chunk-XYB7GC5U.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name,__toESM}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var import_proper_lockfile=__toESM(require_proper_lockfile(),1);import*as fs3 from"node:fs";import*as path2 from"node:path";init_esbuild_shims();import*as fs2 from"node:fs";import{isDeepStrictEqual}from"node:util";init_esbuild_shims();init_esbuild_shims();init_esbuild_shims();function createScanner(text,ignoreTrivia=false){const len=text.length;let pos=0,value="",tokenOffset=0,token=16,lineNumber=0,lineStartOffset=0,tokenLineStartOffset=0,prevTokenLineStartOffset=0,scanError=0;function scanHexDigits(count,exact){let digits=0;let value2=0;while(digits<count||!exact){let ch=text.charCodeAt(pos);if(ch>=48&&ch<=57){value2=value2*16+ch-48}else if(ch>=65&&ch<=70){value2=value2*16+ch-65+10}else if(ch>=97&&ch<=102){value2=value2*16+ch-97+10}else{break}pos++;digits++}if(digits<count){value2=-1}return value2}__name(scanHexDigits,"scanHexDigits");function setPosition(newPosition){pos=newPosition;value="";tokenOffset=0;token=16;scanError=0}__name(setPosition,"setPosition");function scanNumber(){let start=pos;if(text.charCodeAt(pos)===48){pos++}else{pos++;while(pos<text.length&&isDigit(text.charCodeAt(pos))){pos++}}if(pos<text.length&&text.charCodeAt(pos)===46){pos++;if(pos<text.length&&isDigit(text.charCodeAt(pos))){pos++;while(pos<text.length&&isDigit(text.charCodeAt(pos))){pos++}}else{scanError=3;return text.substring(start,pos)}}let end=pos;if(pos<text.length&&(text.charCodeAt(pos)===69||text.charCodeAt(pos)===101)){pos++;if(pos<text.length&&text.charCodeAt(pos)===43||text.charCodeAt(pos)===45){pos++}if(pos<text.length&&isDigit(text.charCodeAt(pos))){pos++;while(pos<text.length&&isDigit(text.charCodeAt(pos))){pos++}end=pos}else{scanError=3}}return text.substring(start,end)}__name(scanNumber,"scanNumber");function scanString(){let result="",start=pos;while(true){if(pos>=len){result+=text.substring(start,pos);scanError=2;break}const ch=text.charCodeAt(pos);if(ch===34){result+=text.substring(start,pos);pos++;break}if(ch===92){result+=text.substring(start,pos);pos++;if(pos>=len){scanError=2;break}const ch2=text.charCodeAt(pos++);switch(ch2){case 34:result+='"';break;case 92:result+="\\";break;case 47:result+="/";break;case 98:result+="\b";break;case 102:result+="\f";break;case 110:result+="\n";break;case 114:result+="\r";break;case 116:result+=" ";break;case 117:const ch3=scanHexDigits(4,true);if(ch3>=0){result+=String.fromCharCode(ch3)}else{scanError=4}break;default:scanError=5}start=pos;continue}if(ch>=0&&ch<=31){if(isLineBreak(ch)){result+=text.substring(start,pos);scanError=2;break}else{scanError=6}}pos++}return result}__name(scanString,"scanString");function scanNext(){value="";scanError=0;tokenOffset=pos;lineStartOffset=lineNumber;prevTokenLineStartOffset=tokenLineStartOffset;if(pos>=len){tokenOffset=len;return token=17}let code=text.charCodeAt(pos);if(isWhiteSpace(code)){do{pos++;value+=String.fromCharCode(code);code=text.charCodeAt(pos)}while(isWhiteSpace(code));return token=15}if(isLineBreak(code)){pos++;value+=String.fromCharCode(code);if(code===13&&text.charCodeAt(pos)===10){pos++;value+="\n"}lineNumber++;tokenLineStartOffset=pos;return token=14}switch(code){case 123:pos++;return token=1;case 125:pos++;return token=2;case 91:pos++;return token=3;case 93:pos++;return token=4;case 58:pos++;return token=6;case 44:pos++;return token=5;case 34:pos++;value=scanString();return token=10;case 47:const start=pos-1;if(text.charCodeAt(pos+1)===47){pos+=2;while(pos<len){if(isLineBreak(text.charCodeAt(pos))){break}pos++}value=text.substring(start,pos);return token=12}if(text.charCodeAt(pos+1)===42){pos+=2;const safeLength=len-1;let commentClosed=false;while(pos<safeLength){const ch=text.charCodeAt(pos);if(ch===42&&text.charCodeAt(pos+1)===47){pos+=2;commentClosed=true;break}pos++;if(isLineBreak(ch)){if(ch===13&&text.charCodeAt(pos)===10){pos++}lineNumber++;tokenLineStartOffset=pos}}if(!commentClosed){pos++;scanError=1}value=text.substring(start,pos);return token=13}value+=String.fromCharCode(code);pos++;return token=16;case 45:value+=String.fromCharCode(code);pos++;if(pos===len||!isDigit(text.charCodeAt(pos))){return token=16}case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:value+=scanNumber();return token=11;default:while(pos<len&&isUnknownContentCharacter(code)){pos++;code=text.charCodeAt(pos)}if(tokenOffset!==pos){value=text.substring(tokenOffset,pos);switch(value){case"true":return token=8;case"false":return token=9;case"null":return token=7}return token=16}value+=String.fromCharCode(code);pos++;return token=16}}__name(scanNext,"scanNext");function isUnknownContentCharacter(code){if(isWhiteSpace(code)||isLineBreak(code)){return false}switch(code){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return false}return true}__name(isUnknownContentCharacter,"isUnknownContentCharacter");function scanNextNonTrivia(){let result;do{result=scanNext()}while(result>=12&&result<=15);return result}__name(scanNextNonTrivia,"scanNextNonTrivia");return{setPosition,getPosition:__name(()=>pos,"getPosition"),scan:ignoreTrivia?scanNextNonTrivia:scanNext,getToken:__name(()=>token,"getToken"),getTokenValue:__name(()=>value,"getTokenValue"),getTokenOffset:__name(()=>tokenOffset,"getTokenOffset"),getTokenLength:__name(()=>pos-tokenOffset,"getTokenLength"),getTokenStartLine:__name(()=>lineStartOffset,"getTokenStartLine"),getTokenStartCharacter:__name(()=>tokenOffset-prevTokenLineStartOffset,"getTokenStartCharacter"),getTokenError:__name(()=>scanError,"getTokenError")}}__name(createScanner,"createScanner");function isWhiteSpace(ch){return ch===32||ch===9}__name(isWhiteSpace,"isWhiteSpace");function isLineBreak(ch){return ch===10||ch===13}__name(isLineBreak,"isLineBreak");function isDigit(ch){return ch>=48&&ch<=57}__name(isDigit,"isDigit");var CharacterCodes;(function(CharacterCodes2){CharacterCodes2[CharacterCodes2["lineFeed"]=10]="lineFeed";CharacterCodes2[CharacterCodes2["carriageReturn"]=13]="carriageReturn";CharacterCodes2[CharacterCodes2["space"]=32]="space";CharacterCodes2[CharacterCodes2["_0"]=48]="_0";CharacterCodes2[CharacterCodes2["_1"]=49]="_1";CharacterCodes2[CharacterCodes2["_2"]=50]="_2";CharacterCodes2[CharacterCodes2["_3"]=51]="_3";CharacterCodes2[CharacterCodes2["_4"]=52]="_4";CharacterCodes2[CharacterCodes2["_5"]=53]="_5";CharacterCodes2[CharacterCodes2["_6"]=54]="_6";CharacterCodes2[CharacterCodes2["_7"]=55]="_7";CharacterCodes2[CharacterCodes2["_8"]=56]="_8";CharacterCodes2[CharacterCodes2["_9"]=57]="_9";CharacterCodes2[CharacterCodes2["a"]=97]="a";CharacterCodes2[CharacterCodes2["b"]=98]="b";CharacterCodes2[CharacterCodes2["c"]=99]="c";CharacterCodes2[CharacterCodes2["d"]=100]="d";CharacterCodes2[CharacterCodes2["e"]=101]="e";CharacterCodes2[CharacterCodes2["f"]=102]="f";CharacterCodes2[CharacterCodes2["g"]=103]="g";CharacterCodes2[CharacterCodes2["h"]=104]="h";CharacterCodes2[CharacterCodes2["i"]=105]="i";CharacterCodes2[CharacterCodes2["j"]=106]="j";CharacterCodes2[CharacterCodes2["k"]=107]="k";CharacterCodes2[CharacterCodes2["l"]=108]="l";CharacterCodes2[CharacterCodes2["m"]=109]="m";CharacterCodes2[CharacterCodes2["n"]=110]="n";CharacterCodes2[CharacterCodes2["o"]=111]="o";CharacterCodes2[CharacterCodes2["p"]=112]="p";CharacterCodes2[CharacterCodes2["q"]=113]="q";CharacterCodes2[CharacterCodes2["r"]=114]="r";CharacterCodes2[CharacterCodes2["s"]=115]="s";CharacterCodes2[CharacterCodes2["t"]=116]="t";CharacterCodes2[CharacterCodes2["u"]=117]="u";CharacterCodes2[CharacterCodes2["v"]=118]="v";CharacterCodes2[CharacterCodes2["w"]=119]="w";CharacterCodes2[CharacterCodes2["x"]=120]="x";CharacterCodes2[CharacterCodes2["y"]=121]="y";CharacterCodes2[CharacterCodes2["z"]=122]="z";CharacterCodes2[CharacterCodes2["A"]=65]="A";CharacterCodes2[CharacterCodes2["B"]=66]="B";CharacterCodes2[CharacterCodes2["C"]=67]="C";CharacterCodes2[CharacterCodes2["D"]=68]="D";CharacterCodes2[CharacterCodes2["E"]=69]="E";CharacterCodes2[CharacterCodes2["F"]=70]="F";CharacterCodes2[CharacterCodes2["G"]=71]="G";CharacterCodes2[CharacterCodes2["H"]=72]="H";CharacterCodes2[CharacterCodes2["I"]=73]="I";CharacterCodes2[CharacterCodes2["J"]=74]="J";CharacterCodes2[CharacterCodes2["K"]=75]="K";CharacterCodes2[CharacterCodes2["L"]=76]="L";CharacterCodes2[CharacterCodes2["M"]=77]="M";CharacterCodes2[CharacterCodes2["N"]=78]="N";CharacterCodes2[CharacterCodes2["O"]=79]="O";CharacterCodes2[CharacterCodes2["P"]=80]="P";CharacterCodes2[CharacterCodes2["Q"]=81]="Q";CharacterCodes2[CharacterCodes2["R"]=82]="R";CharacterCodes2[CharacterCodes2["S"]=83]="S";CharacterCodes2[CharacterCodes2["T"]=84]="T";CharacterCodes2[CharacterCodes2["U"]=85]="U";CharacterCodes2[CharacterCodes2["V"]=86]="V";CharacterCodes2[CharacterCodes2["W"]=87]="W";CharacterCodes2[CharacterCodes2["X"]=88]="X";CharacterCodes2[CharacterCodes2["Y"]=89]="Y";CharacterCodes2[CharacterCodes2["Z"]=90]="Z";CharacterCodes2[CharacterCodes2["asterisk"]=42]="asterisk";CharacterCodes2[CharacterCodes2["backslash"]=92]="backslash";CharacterCodes2[CharacterCodes2["closeBrace"]=125]="closeBrace";CharacterCodes2[CharacterCodes2["closeBracket"]=93]="closeBracket";CharacterCodes2[CharacterCodes2["colon"]=58]="colon";CharacterCodes2[CharacterCodes2["comma"]=44]="comma";CharacterCodes2[CharacterCodes2["dot"]=46]="dot";CharacterCodes2[CharacterCodes2["doubleQuote"]=34]="doubleQuote";CharacterCodes2[CharacterCodes2["minus"]=45]="minus";CharacterCodes2[CharacterCodes2["openBrace"]=123]="openBrace";CharacterCodes2[CharacterCodes2["openBracket"]=91]="openBracket";CharacterCodes2[CharacterCodes2["plus"]=43]="plus";CharacterCodes2[CharacterCodes2["slash"]=47]="slash";CharacterCodes2[CharacterCodes2["formFeed"]=12]="formFeed";CharacterCodes2[CharacterCodes2["tab"]=9]="tab"})(CharacterCodes||(CharacterCodes={}));init_esbuild_shims();var cachedSpaces=new Array(20).fill(0).map((_,index)=>{return" ".repeat(index)});var maxCachedValues=200;var cachedBreakLinesWithSpaces={" ":{"\n":new Array(maxCachedValues).fill(0).map((_,index)=>{return"\n"+" ".repeat(index)}),"\r":new Array(maxCachedValues).fill(0).map((_,index)=>{return"\r"+" ".repeat(index)}),"\r\n":new Array(maxCachedValues).fill(0).map((_,index)=>{return"\r\n"+" ".repeat(index)})}," ":{"\n":new Array(maxCachedValues).fill(0).map((_,index)=>{return"\n"+" ".repeat(index)}),"\r":new Array(maxCachedValues).fill(0).map((_,index)=>{return"\r"+" ".repeat(index)}),"\r\n":new Array(maxCachedValues).fill(0).map((_,index)=>{return"\r\n"+" ".repeat(index)})}};var supportedEols=["\n","\r","\r\n"];function format(documentText,range,options){let initialIndentLevel;let formatText;let formatTextStart;let rangeStart;let rangeEnd;if(range){rangeStart=range.offset;rangeEnd=rangeStart+range.length;formatTextStart=rangeStart;while(formatTextStart>0&&!isEOL(documentText,formatTextStart-1)){formatTextStart--}let endOffset=rangeEnd;while(endOffset<documentText.length&&!isEOL(documentText,endOffset)){endOffset++}formatText=documentText.substring(formatTextStart,endOffset);initialIndentLevel=computeIndentLevel(formatText,options)}else{formatText=documentText;initialIndentLevel=0;formatTextStart=0;rangeStart=0;rangeEnd=documentText.length}const eol=getEOL(options,documentText);const eolFastPathSupported=supportedEols.includes(eol);let numberLineBreaks=0;let indentLevel=0;let indentValue;if(options.insertSpaces){indentValue=cachedSpaces[options.tabSize||4]??repeat(cachedSpaces[1],options.tabSize||4)}else{indentValue=" "}const indentType=indentValue===" "?" ":" ";let scanner=createScanner(formatText,false);let hasError=false;function newLinesAndIndent(){if(numberLineBreaks>1){return repeat(eol,numberLineBreaks)+repeat(indentValue,initialIndentLevel+indentLevel)}const amountOfSpaces=indentValue.length*(initialIndentLevel+indentLevel);if(!eolFastPathSupported||amountOfSpaces>cachedBreakLinesWithSpaces[indentType][eol].length){return eol+repeat(indentValue,initialIndentLevel+indentLevel)}if(amountOfSpaces<=0){return eol}return cachedBreakLinesWithSpaces[indentType][eol][amountOfSpaces]}__name(newLinesAndIndent,"newLinesAndIndent");function scanNext(){let token=scanner.scan();numberLineBreaks=0;while(token===15||token===14){if(token===14&&options.keepLines){numberLineBreaks+=1}else if(token===14){numberLineBreaks=1}token=scanner.scan()}hasError=token===16||scanner.getTokenError()!==0;return token}__name(scanNext,"scanNext");const editOperations=[];function addEdit(text,startOffset,endOffset){if(!hasError&&(!range||startOffset<rangeEnd&&endOffset>rangeStart)&&documentText.substring(startOffset,endOffset)!==text){editOperations.push({offset:startOffset,length:endOffset-startOffset,content:text})}}__name(addEdit,"addEdit");let firstToken=scanNext();if(options.keepLines&&numberLineBreaks>0){addEdit(repeat(eol,numberLineBreaks),0,0)}if(firstToken!==17){let firstTokenStart=scanner.getTokenOffset()+formatTextStart;let initialIndent=indentValue.length*initialIndentLevel<20&&options.insertSpaces?cachedSpaces[indentValue.length*initialIndentLevel]:repeat(indentValue,initialIndentLevel);addEdit(initialIndent,formatTextStart,firstTokenStart)}while(firstToken!==17){let firstTokenEnd=scanner.getTokenOffset()+scanner.getTokenLength()+formatTextStart;let secondToken=scanNext();let replaceContent="";let needsLineBreak=false;while(numberLineBreaks===0&&(secondToken===12||secondToken===13)){let commentTokenStart=scanner.getTokenOffset()+formatTextStart;addEdit(cachedSpaces[1],firstTokenEnd,commentTokenStart);firstTokenEnd=scanner.getTokenOffset()+scanner.getTokenLength()+formatTextStart;needsLineBreak=secondToken===12;replaceContent=needsLineBreak?newLinesAndIndent():"";secondToken=scanNext()}if(secondToken===2){if(firstToken!==1){indentLevel--};if(options.keepLines&&numberLineBreaks>0||!options.keepLines&&firstToken!==1){replaceContent=newLinesAndIndent()}else if(options.keepLines){replaceContent=cachedSpaces[1]}}else if(secondToken===4){if(firstToken!==3){indentLevel--};if(options.keepLines&&numberLineBreaks>0||!options.keepLines&&firstToken!==3){replaceContent=newLinesAndIndent()}else if(options.keepLines){replaceContent=cachedSpaces[1]}}else{switch(firstToken){case 3:case 1:indentLevel++;if(options.keepLines&&numberLineBreaks>0||!options.keepLines){replaceContent=newLinesAndIndent()}else{replaceContent=cachedSpaces[1]}break;case 5:if(options.keepLines&&numberLineBreaks>0||!options.keepLines){replaceContent=newLinesAndIndent()}else{replaceContent=cachedSpaces[1]}break;case 12:replaceContent=newLinesAndIndent();break;case 13:if(numberLineBreaks>0){replaceContent=newLinesAndIndent()}else if(!needsLineBreak){replaceContent=cachedSpaces[1]}break;case 6:if(options.keepLines&&numberLineBreaks>0){replaceContent=newLinesAndIndent()}else if(!needsLineBreak){replaceContent=cachedSpaces[1]}break;case 10:if(options.keepLines&&numberLineBreaks>0){replaceContent=newLinesAndIndent()}else if(secondToken===6&&!needsLineBreak){replaceContent=""}break;case 7:case 8:case 9:case 11:case 2:case 4:if(options.keepLines&&numberLineBreaks>0){replaceContent=newLinesAndIndent()}else{if((secondToken===12||secondToken===13)&&!needsLineBreak){replaceContent=cachedSpaces[1]}else if(secondToken!==5&&secondToken!==17){hasError=true}}break;case 16:hasError=true;break}if(numberLineBreaks>0&&(secondToken===12||secondToken===13)){replaceContent=newLinesAndIndent()}}if(secondToken===17){if(options.keepLines&&numberLineBreaks>0){replaceContent=newLinesAndIndent()}else{replaceContent=options.insertFinalNewline?eol:""}}const secondTokenStart=scanner.getTokenOffset()+formatTextStart;addEdit(replaceContent,firstTokenEnd,secondTokenStart);firstToken=secondToken}return editOperations}__name(format,"format");function repeat(s,count){let result="";for(let i=0;i<count;i++){result+=s}return result}__name(repeat,"repeat");function computeIndentLevel(content,options){let i=0;let nChars=0;const tabSize=options.tabSize||4;while(i<content.length){let ch=content.charAt(i);if(ch===cachedSpaces[1]){nChars++}else if(ch===" "){nChars+=tabSize}else{break}i++}return Math.floor(nChars/tabSize)}__name(computeIndentLevel,"computeIndentLevel");function getEOL(options,text){for(let i=0;i<text.length;i++){const ch=text.charAt(i);if(ch==="\r"){if(i+1<text.length&&text.charAt(i+1)==="\n"){return"\r\n"}return"\r"}else if(ch==="\n"){return"\n"}}return options&&options.eol||"\n"}__name(getEOL,"getEOL");function isEOL(text,offset){return"\r\n".indexOf(text.charAt(offset))!==-1}__name(isEOL,"isEOL");init_esbuild_shims();init_esbuild_shims();var ParseOptions;(function(ParseOptions2){ParseOptions2.DEFAULT={allowTrailingComma:false}})(ParseOptions||(ParseOptions={}));function parseTree(text,errors=[],options=ParseOptions.DEFAULT){let currentParent={type:"array",offset:-1,length:-1,children:[],parent:void 0};function ensurePropertyComplete(endOffset){if(currentParent.type==="property"){currentParent.length=endOffset-currentParent.offset;currentParent=currentParent.parent}}__name(ensurePropertyComplete,"ensurePropertyComplete");function onValue(valueNode){currentParent.children.push(valueNode);return valueNode}__name(onValue,"onValue");const visitor={onObjectBegin:__name(offset=>{currentParent=onValue({type:"object",offset,length:-1,parent:currentParent,children:[]})},"onObjectBegin"),onObjectProperty:__name((name,offset,length)=>{currentParent=onValue({type:"property",offset,length:-1,parent:currentParent,children:[]});currentParent.children.push({type:"string",value:name,offset,length,parent:currentParent})},"onObjectProperty"),onObjectEnd:__name((offset,length)=>{ensurePropertyComplete(offset+length);currentParent.length=offset+length-currentParent.offset;currentParent=currentParent.parent;ensurePropertyComplete(offset+length)},"onObjectEnd"),onArrayBegin:__name((offset,length)=>{currentParent=onValue({type:"array",offset,length:-1,parent:currentParent,children:[]})},"onArrayBegin"),onArrayEnd:__name((offset,length)=>{currentParent.length=offset+length-currentParent.offset;currentParent=currentParent.parent;ensurePropertyComplete(offset+length)},"onArrayEnd"),onLiteralValue:__name((value,offset,length)=>{onValue({type:getNodeType(value),offset,length,parent:currentParent,value});ensurePropertyComplete(offset+length)},"onLiteralValue"),onSeparator:__name((sep,offset,length)=>{if(currentParent.type==="property"){if(sep===":"){currentParent.colonOffset=offset}else if(sep===","){ensurePropertyComplete(offset)}}},"onSeparator"),onError:__name((error,offset,length)=>{errors.push({error,offset,length})},"onError")};visit(text,visitor,options);const result=currentParent.children[0];if(result){delete result.parent}return result}__name(parseTree,"parseTree");function findNodeAtLocation(root,path3){if(!root){return void 0}let node=root;for(let segment of path3){if(typeof segment==="string"){if(node.type!=="object"||!Array.isArray(node.children)){return void 0}let found=false;for(const propertyNode of node.children){if(Array.isArray(propertyNode.children)&&propertyNode.children[0].value===segment&&propertyNode.children.length===2){node=propertyNode.children[1];found=true;break}}if(!found){return void 0}}else{const index=segment;if(node.type!=="array"||index<0||!Array.isArray(node.children)||index>=node.children.length){return void 0}node=node.children[index]}}return node}__name(findNodeAtLocation,"findNodeAtLocation");function getNodeValue(node){switch(node.type){case"array":return node.children.map(getNodeValue);case"object":const obj=Object.create(null);for(let prop of node.children){const valueNode=prop.children[1];if(valueNode){obj[prop.children[0].value]=getNodeValue(valueNode)}}return obj;case"null":case"string":case"number":case"boolean":return node.value;default:return void 0}}__name(getNodeValue,"getNodeValue");function visit(text,visitor,options=ParseOptions.DEFAULT){const _scanner=createScanner(text,false);const _jsonPath=[];let suppressedCallbacks=0;function toNoArgVisit(visitFunction){return visitFunction?()=>suppressedCallbacks===0&&visitFunction(_scanner.getTokenOffset(),_scanner.getTokenLength(),_scanner.getTokenStartLine(),_scanner.getTokenStartCharacter()):()=>true}__name(toNoArgVisit,"toNoArgVisit");function toOneArgVisit(visitFunction){return visitFunction?arg=>suppressedCallbacks===0&&visitFunction(arg,_scanner.getTokenOffset(),_scanner.getTokenLength(),_scanner.getTokenStartLine(),_scanner.getTokenStartCharacter()):()=>true}__name(toOneArgVisit,"toOneArgVisit");function toOneArgVisitWithPath(visitFunction){return visitFunction?arg=>suppressedCallbacks===0&&visitFunction(arg,_scanner.getTokenOffset(),_scanner.getTokenLength(),_scanner.getTokenStartLine(),_scanner.getTokenStartCharacter(),()=>_jsonPath.slice()):()=>true}__name(toOneArgVisitWithPath,"toOneArgVisitWithPath");function toBeginVisit(visitFunction){return visitFunction?()=>{if(suppressedCallbacks>0){suppressedCallbacks++}else{let cbReturn=visitFunction(_scanner.getTokenOffset(),_scanner.getTokenLength(),_scanner.getTokenStartLine(),_scanner.getTokenStartCharacter(),()=>_jsonPath.slice());if(cbReturn===false){suppressedCallbacks=1}}}:()=>true}__name(toBeginVisit,"toBeginVisit");function toEndVisit(visitFunction){return visitFunction?()=>{if(suppressedCallbacks>0){suppressedCallbacks--}if(suppressedCallbacks===0){visitFunction(_scanner.getTokenOffset(),_scanner.getTokenLength(),_scanner.getTokenStartLine(),_scanner.getTokenStartCharacter())}}:()=>true}__name(toEndVisit,"toEndVisit");const onObjectBegin=toBeginVisit(visitor.onObjectBegin),onObjectProperty=toOneArgVisitWithPath(visitor.onObjectProperty),onObjectEnd=toEndVisit(visitor.onObjectEnd),onArrayBegin=toBeginVisit(visitor.onArrayBegin),onArrayEnd=toEndVisit(visitor.onArrayEnd),onLiteralValue=toOneArgVisitWithPath(visitor.onLiteralValue),onSeparator=toOneArgVisit(visitor.onSeparator),onComment=toNoArgVisit(visitor.onComment),onError=toOneArgVisit(visitor.onError);const disallowComments=options&&options.disallowComments;const allowTrailingComma=options&&options.allowTrailingComma;function scanNext(){while(true){const token=_scanner.scan();switch(_scanner.getTokenError()){case 4:handleError(14);break;case 5:handleError(15);break;case 3:handleError(13);break;case 1:if(!disallowComments){handleError(11)}break;case 2:handleError(12);break;case 6:handleError(16);break}switch(token){case 12:case 13:if(disallowComments){handleError(10)}else{onComment()}break;case 16:handleError(1);break;case 15:case 14:break;default:return token}}}__name(scanNext,"scanNext");function handleError(error,skipUntilAfter=[],skipUntil=[]){onError(error);if(skipUntilAfter.length+skipUntil.length>0){let token=_scanner.getToken();while(token!==17){if(skipUntilAfter.indexOf(token)!==-1){scanNext();break}else if(skipUntil.indexOf(token)!==-1){break}token=scanNext()}}}__name(handleError,"handleError");function parseString(isValue){const value=_scanner.getTokenValue();if(isValue){onLiteralValue(value)}else{onObjectProperty(value);_jsonPath.push(value)}scanNext();return true}__name(parseString,"parseString");function parseLiteral(){switch(_scanner.getToken()){case 11:const tokenValue=_scanner.getTokenValue();let value=Number(tokenValue);if(isNaN(value)){handleError(2);value=0}onLiteralValue(value);break;case 7:onLiteralValue(null);break;case 8:onLiteralValue(true);break;case 9:onLiteralValue(false);break;default:return false}scanNext();return true}__name(parseLiteral,"parseLiteral");function parseProperty(){if(_scanner.getToken()!==10){handleError(3,[],[2,5]);return false}parseString(false);if(_scanner.getToken()===6){onSeparator(":");scanNext();if(!parseValue()){handleError(4,[],[2,5])}}else{handleError(5,[],[2,5])}_jsonPath.pop();return true}__name(parseProperty,"parseProperty");function parseObject(){onObjectBegin();scanNext();let needsComma=false;while(_scanner.getToken()!==2&&_scanner.getToken()!==17){if(_scanner.getToken()===5){if(!needsComma){handleError(4,[],[])}onSeparator(",");scanNext();if(_scanner.getToken()===2&&allowTrailingComma){break}}else if(needsComma){handleError(6,[],[])}if(!parseProperty()){handleError(4,[],[2,5])}needsComma=true}onObjectEnd();if(_scanner.getToken()!==2){handleError(7,[2],[])}else{scanNext()}return true}__name(parseObject,"parseObject");function parseArray(){onArrayBegin();scanNext();let isFirstElement=true;let needsComma=false;while(_scanner.getToken()!==4&&_scanner.getToken()!==17){if(_scanner.getToken()===5){if(!needsComma){handleError(4,[],[])}onSeparator(",");scanNext();if(_scanner.getToken()===4&&allowTrailingComma){break}}else if(needsComma){handleError(6,[],[])}if(isFirstElement){_jsonPath.push(0);isFirstElement=false}else{_jsonPath[_jsonPath.length-1]++}if(!parseValue()){handleError(4,[],[4,5])}needsComma=true}onArrayEnd();if(!isFirstElement){_jsonPath.pop()}if(_scanner.getToken()!==4){handleError(8,[4],[])}else{scanNext()}return true}__name(parseArray,"parseArray");function parseValue(){switch(_scanner.getToken()){case 3:return parseArray();case 1:return parseObject();case 10:return parseString(true);default:return parseLiteral()}}__name(parseValue,"parseValue");scanNext();if(_scanner.getToken()===17){if(options.allowEmptyContent){return true}handleError(4,[],[]);return false}if(!parseValue()){handleError(4,[],[]);return false}if(_scanner.getToken()!==17){handleError(9,[],[])}return true}__name(visit,"visit");function getNodeType(value){switch(typeof value){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(!value){return"null"}else if(Array.isArray(value)){return"array"}return"object"}default:return"null"}}__name(getNodeType,"getNodeType");function setProperty(text,originalPath,value,options){const path3=originalPath.slice();const errors=[];const root=parseTree(text,errors);let parent=void 0;let lastSegment=void 0;while(path3.length>0){lastSegment=path3.pop();parent=findNodeAtLocation(root,path3);if(parent===void 0&&value!==void 0){if(typeof lastSegment==="string"){value={[lastSegment]:value}}else{value=[value]}}else{break}}if(!parent){if(value===void 0){throw new Error("Can not delete in empty document")}return withFormatting(text,{offset:root?root.offset:0,length:root?root.length:0,content:JSON.stringify(value)},options)}else if(parent.type==="object"&&typeof lastSegment==="string"&&Array.isArray(parent.children)){const existing=findNodeAtLocation(parent,[lastSegment]);if(existing!==void 0){if(value===void 0){if(!existing.parent){throw new Error("Malformed AST")}const propertyIndex=parent.children.indexOf(existing.parent);let removeBegin;let removeEnd=existing.parent.offset+existing.parent.length;if(propertyIndex>0){let previous=parent.children[propertyIndex-1];removeBegin=previous.offset+previous.length}else{removeBegin=parent.offset+1;if(parent.children.length>1){let next=parent.children[1];removeEnd=next.offset}}return withFormatting(text,{offset:removeBegin,length:removeEnd-removeBegin,content:""},options)}else{return withFormatting(text,{offset:existing.offset,length:existing.length,content:JSON.stringify(value)},options)}}else{if(value===void 0){return[]}const newProperty=`${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`;const index=options.getInsertionIndex?options.getInsertionIndex(parent.children.map(p=>p.children[0].value)):parent.children.length;let edit;if(index>0){let previous=parent.children[index-1];edit={offset:previous.offset+previous.length,length:0,content:","+newProperty}}else if(parent.children.length===0){edit={offset:parent.offset+1,length:0,content:newProperty}}else{edit={offset:parent.offset+1,length:0,content:newProperty+","}}return withFormatting(text,edit,options)}}else if(parent.type==="array"&&typeof lastSegment==="number"&&Array.isArray(parent.children)){const insertIndex=lastSegment;if(insertIndex===-1){const newProperty=`${JSON.stringify(value)}`;let edit;if(parent.children.length===0){edit={offset:parent.offset+1,length:0,content:newProperty}}else{const previous=parent.children[parent.children.length-1];edit={offset:previous.offset+previous.length,length:0,content:","+newProperty}}return withFormatting(text,edit,options)}else if(value===void 0&&parent.children.length>=0){const removalIndex=lastSegment;const toRemove=parent.children[removalIndex];let edit;if(parent.children.length===1){edit={offset:parent.offset+1,length:parent.length-2,content:""}}else if(parent.children.length-1===removalIndex){let previous=parent.children[removalIndex-1];let offset=previous.offset+previous.length;let parentEndOffset=parent.offset+parent.length;edit={offset,length:parentEndOffset-2-offset,content:""}}else{edit={offset:toRemove.offset,length:parent.children[removalIndex+1].offset-toRemove.offset,content:""}}return withFormatting(text,edit,options)}else if(value!==void 0){let edit;const newProperty=`${JSON.stringify(value)}`;if(!options.isArrayInsertion&&parent.children.length>lastSegment){const toModify=parent.children[lastSegment];edit={offset:toModify.offset,length:toModify.length,content:newProperty}}else if(parent.children.length===0||lastSegment===0){edit={offset:parent.offset+1,length:0,content:parent.children.length===0?newProperty:newProperty+","}}else{const index=lastSegment>parent.children.length?parent.children.length:lastSegment;const previous=parent.children[index-1];edit={offset:previous.offset+previous.length,length:0,content:","+newProperty}}return withFormatting(text,edit,options)}else{throw new Error(`Can not ${value===void 0?"remove":options.isArrayInsertion?"insert":"modify"} Array index ${insertIndex} as length is not sufficient`)}}else{throw new Error(`Can not add ${typeof lastSegment!=="number"?"index":"property"} to parent of type ${parent.type}`)}}__name(setProperty,"setProperty");function withFormatting(text,edit,options){if(!options.formattingOptions){return[edit]}let newText=applyEdit(text,edit);let begin=edit.offset;let end=edit.offset+edit.content.length;if(edit.length===0||edit.content.length===0){while(begin>0&&!isEOL(newText,begin-1)){begin--}while(end<newText.length&&!isEOL(newText,end)){end++}}const edits=format(newText,{offset:begin,length:end-begin},{...options.formattingOptions,keepLines:false});for(let i=edits.length-1;i>=0;i--){const edit2=edits[i];newText=applyEdit(newText,edit2);begin=Math.min(begin,edit2.offset);end=Math.max(end,edit2.offset+edit2.length);end+=edit2.content.length-edit2.length}const editLength=text.length-(newText.length-end)-begin;return[{offset:begin,length:editLength,content:newText.substring(begin,end)}]}__name(withFormatting,"withFormatting");function applyEdit(text,edit){return text.substring(0,edit.offset)+edit.content+text.substring(edit.offset+edit.length)}__name(applyEdit,"applyEdit");var ScanError;(function(ScanError2){ScanError2[ScanError2["None"]=0]="None";ScanError2[ScanError2["UnexpectedEndOfComment"]=1]="UnexpectedEndOfComment";ScanError2[ScanError2["UnexpectedEndOfString"]=2]="UnexpectedEndOfString";ScanError2[ScanError2["UnexpectedEndOfNumber"]=3]="UnexpectedEndOfNumber";ScanError2[ScanError2["InvalidUnicode"]=4]="InvalidUnicode";ScanError2[ScanError2["InvalidEscapeCharacter"]=5]="InvalidEscapeCharacter";ScanError2[ScanError2["InvalidCharacter"]=6]="InvalidCharacter"})(ScanError||(ScanError={}));var SyntaxKind;(function(SyntaxKind2){SyntaxKind2[SyntaxKind2["OpenBraceToken"]=1]="OpenBraceToken";SyntaxKind2[SyntaxKind2["CloseBraceToken"]=2]="CloseBraceToken";SyntaxKind2[SyntaxKind2["OpenBracketToken"]=3]="OpenBracketToken";SyntaxKind2[SyntaxKind2["CloseBracketToken"]=4]="CloseBracketToken";SyntaxKind2[SyntaxKind2["CommaToken"]=5]="CommaToken";SyntaxKind2[SyntaxKind2["ColonToken"]=6]="ColonToken";SyntaxKind2[SyntaxKind2["NullKeyword"]=7]="NullKeyword";SyntaxKind2[SyntaxKind2["TrueKeyword"]=8]="TrueKeyword";SyntaxKind2[SyntaxKind2["FalseKeyword"]=9]="FalseKeyword";SyntaxKind2[SyntaxKind2["StringLiteral"]=10]="StringLiteral";SyntaxKind2[SyntaxKind2["NumericLiteral"]=11]="NumericLiteral";SyntaxKind2[SyntaxKind2["LineCommentTrivia"]=12]="LineCommentTrivia";SyntaxKind2[SyntaxKind2["BlockCommentTrivia"]=13]="BlockCommentTrivia";SyntaxKind2[SyntaxKind2["LineBreakTrivia"]=14]="LineBreakTrivia";SyntaxKind2[SyntaxKind2["Trivia"]=15]="Trivia";SyntaxKind2[SyntaxKind2["Unknown"]=16]="Unknown";SyntaxKind2[SyntaxKind2["EOF"]=17]="EOF"})(SyntaxKind||(SyntaxKind={}));var parseTree2=parseTree;var findNodeAtLocation2=findNodeAtLocation;var getNodeValue2=getNodeValue;var ParseErrorCode;(function(ParseErrorCode2){ParseErrorCode2[ParseErrorCode2["InvalidSymbol"]=1]="InvalidSymbol";ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"]=2]="InvalidNumberFormat";ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"]=3]="PropertyNameExpected";ParseErrorCode2[ParseErrorCode2["ValueExpected"]=4]="ValueExpected";ParseErrorCode2[ParseErrorCode2["ColonExpected"]=5]="ColonExpected";ParseErrorCode2[ParseErrorCode2["CommaExpected"]=6]="CommaExpected";ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"]=7]="CloseBraceExpected";ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"]=8]="CloseBracketExpected";ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"]=9]="EndOfFileExpected";ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"]=10]="InvalidCommentToken";ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"]=11]="UnexpectedEndOfComment";ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"]=12]="UnexpectedEndOfString";ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"]=13]="UnexpectedEndOfNumber";ParseErrorCode2[ParseErrorCode2["InvalidUnicode"]=14]="InvalidUnicode";ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"]=15]="InvalidEscapeCharacter";ParseErrorCode2[ParseErrorCode2["InvalidCharacter"]=16]="InvalidCharacter"})(ParseErrorCode||(ParseErrorCode={}));function printParseErrorCode(code){switch(code){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}__name(printParseErrorCode,"printParseErrorCode");function modify(text,path3,value,options){return setProperty(text,path3,value,options)}__name(modify,"modify");function applyEdits(text,edits){let sortedEdits=edits.slice(0).sort((a,b)=>{const diff=a.offset-b.offset;if(diff===0){return a.length-b.length}return diff});let lastModifiedOffset=text.length;for(let i=sortedEdits.length-1;i>=0;i--){let e=sortedEdits[i];if(e.offset+e.length<=lastModifiedOffset){text=applyEdit(text,e)}else{throw new Error("Overlapping edit")}lastModifiedOffset=e.offset}return text}__name(applyEdits,"applyEdits");init_esbuild_shims();import*as fs from"node:fs";import path from"node:path";function writeWithBackupSync(targetPath,content,options={}){const{backupSuffix=".orig",encoding="utf-8"}=options;const existing=fs.existsSync(targetPath)?fs.statSync(targetPath):void 0;if(existing?.isDirectory()){throw new Error(`Cannot write to '${targetPath}' because it is a directory`)}const workingDirectory=fs.mkdtempSync(`${targetPath}.write-`);const basename=path.basename(targetPath);const tempPath=path.join(workingDirectory,`${basename}.tmp`);const backupPath=path.join(workingDirectory,`${basename}${backupSuffix}`);let backupCreated=false;try{const mode=existing&&fs.lstatSync(targetPath,{throwIfNoEntry:false})?.isFile()?existing.mode&511:void 0;fs.writeFileSync(tempPath,content,{encoding,flag:"wx",flush:true,mode});if(mode!==void 0){try{fs.chmodSync(tempPath,mode)}catch(error){const code=error instanceof Error&&"code"in error?error.code:void 0;if(code!=="ENOSYS"&&code!=="ENOTSUP"&&code!=="EPERM"||(fs.statSync(tempPath).mode&511&~mode)!==0){throw error}}}if(fs.existsSync(targetPath)){try{fs.copyFileSync(targetPath,backupPath,fs.constants.COPYFILE_EXCL);backupCreated=true}catch(backupError){throw new Error(`Failed to backup existing file: ${backupError instanceof Error?backupError.message:String(backupError)}`)}}fs.renameSync(tempPath,targetPath)}catch(error){const recoveryRetained=backupCreated&&!sameContents(backupPath,targetPath);try{if(recoveryRetained){fs.unlinkSync(tempPath)}else{fs.rmSync(workingDirectory,{recursive:true,force:true})}}catch{}if(recoveryRetained){throw new Error(`Failed to write file: ${error instanceof Error?error.message:String(error)}. Recovery copy retained at '${backupPath}'; inspect the current target before restoring it.`)}throw error}try{fs.rmSync(workingDirectory,{recursive:true,force:true})}catch{}}__name(writeWithBackupSync,"writeWithBackupSync");function sameContents(first,second){try{return fs.readFileSync(first).equals(fs.readFileSync(second))}catch{return false}}__name(sameContents,"sameContents");var PARSE_OPTIONS={allowTrailingComma:true};function updateSettingsFilePreservingFormat(filePath,updates,sync=false,replacePath=[]){if(!fs2.existsSync(filePath)){const content=JSON.stringify(updates,null,2);writeWithBackupSync(filePath,content);return true}const originalContent=fs2.readFileSync(filePath,"utf-8");try{parseJsoncObject(originalContent)}catch(_error){writeStderrLine("Error parsing settings file.");writeStderrLine(`Settings file may be corrupted: ${_error instanceof Error?_error.message:String(_error)}`);return false}let updatedContent;try{updatedContent=updateJsoncContent(originalContent,updates,sync,replacePath)}catch(validationError){writeStderrLine("Error: Refusing to write settings file \u2014 the result would not be valid JSON.");writeStderrLine(validationError instanceof Error?validationError.message:String(validationError));return false}writeWithBackupSync(filePath,updatedContent);return true}__name(updateSettingsFilePreservingFormat,"updateSettingsFilePreservingFormat");function parseJsoncObject(content){const errors=[];const root=parseTree2(stripBom(content),errors,PARSE_OPTIONS);if(errors.length>0){const error=errors[0];throw new Error(`${printParseErrorCode(error.error)} at offset ${error.offset}`)}if(root?.type!=="object"){throw new Error("JSONC document root is not a JSON object.")}return JSON.parse(JSON.stringify(getNodeValue2(root)))}__name(parseJsoncObject,"parseJsoncObject");function updateJsoncContent(content,updates,sync=false,replacePath=[]){const bom=content.startsWith("\uFEFF")?"\uFEFF":"";const editableContent=stripBom(content);const parsed=parseJsoncObject(editableContent);const targetWithUndefined=applyUpdates(structuredClone(parsed),updates,sync,replacePath);const target=JSON.parse(JSON.stringify(targetWithUndefined));const options={formattingOptions:detectFormattingOptions(editableContent)};let updated=normalizeDuplicateProperties(editableContent,options);const current=parseJsoncObject(updated);for(const operation of collectOperations(current,target)){if(operation.value===void 0){updated=removeTrailingInlineComment(updated,operation.path)}updated=applyEdits(updated,modify(updated,operation.path,operation.value,options))}const reparsed=parseJsoncObject(updated);if(!isDeepStrictEqual(reparsed,target)){throw new Error("Edited JSONC does not match the intended settings.")}return bom+updated}__name(updateJsoncContent,"updateJsoncContent");function applyUpdates(current,updates,sync=false,replacePath=[],currentPath=[]){const result=current;if(sync){const keysToRemove=Object.keys(result).filter(key=>!Object.hasOwn(updates,key));for(const key of keysToRemove){delete result[key]}}for(const key of Object.getOwnPropertyNames(updates)){if(key==="__proto__"||key==="constructor"||key==="prototype"){continue}const value=updates[key];const nextPath=[...currentPath,key];const valueIsObject=typeof value==="object"&&value!==null&&!Array.isArray(value)&&Object.keys(value).length>0;if(pathsEqual(nextPath,replacePath)){result[key]=valueIsObject?applyUpdates({},value):value;continue}if(valueIsObject&&(typeof result[key]!=="object"||result[key]===null||Array.isArray(result[key]))){result[key]=applyUpdates({},value,sync,replacePath,nextPath)}else if(valueIsObject&&typeof result[key]==="object"&&result[key]!==null&&!Array.isArray(result[key])){result[key]=applyUpdates(result[key],value,sync,replacePath,nextPath)}else{result[key]=value}}return result}__name(applyUpdates,"applyUpdates");function stripBom(content){return content.startsWith("\uFEFF")?content.slice(1):content}__name(stripBom,"stripBom");function isRecord(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}__name(isRecord,"isRecord");function detectFormattingOptions(content){const root=parseTree2(content,[],PARSE_OPTIONS);const firstKey=root?.children?.[0]?.children?.[0];const lineStart=firstKey===void 0?-1:content.lastIndexOf("\n",firstKey.offset-1);const candidate=firstKey===void 0?void 0:content.slice(lineStart+1,firstKey.offset);const indentation=candidate!==void 0&&/^[ \t]*$/.test(candidate)?candidate:" ";return{eol:content.includes("\r\n")?"\r\n":"\n",insertSpaces:!indentation.startsWith(" "),tabSize:indentation.startsWith(" ")?1:indentation.length,insertFinalNewline:content.endsWith("\n")}}__name(detectFormattingOptions,"detectFormattingOptions");function collectOperations(current,target,path3=[],operations=[]){for(const key of Object.keys(current)){if(!Object.hasOwn(target,key)){operations.push({path:[...path3,key],value:void 0})}}for(const key of Object.keys(target)){const nextPath=[...path3,key];if(!Object.hasOwn(current,key)){operations.push({path:nextPath,value:target[key]})}else if(isRecord(current[key])&&isRecord(target[key])){collectOperations(current[key],target[key],nextPath,operations)}else if(!isDeepStrictEqual(current[key],target[key])){operations.push({path:nextPath,value:target[key]})}}return operations}__name(collectOperations,"collectOperations");function findDuplicateProperty(node,path3=[]){if(node.type!=="object"||node.children===void 0){return void 0}const properties=new Map;for(const property of node.children){const keyNode=property.children?.[0];const key=keyNode?.value;if(typeof key!=="string"||keyNode===void 0){continue}const previous=properties.get(key);if(previous!==void 0){return{objectPath:[...path3],keyNode:previous,propertyNames:new Set(properties.keys())}}properties.set(key,keyNode)}for(const property of node.children){const key=property.children?.[0]?.value;const valueNode=property.children?.[1];if(typeof key!=="string"||valueNode===void 0){continue}const duplicate=findDuplicateProperty(valueNode,[...path3,key]);if(duplicate!==void 0){return duplicate}}return void 0}__name(findDuplicateProperty,"findDuplicateProperty");function normalizeDuplicateProperties(content,options){let normalized=content;let duplicateIndex=0;while(true){const root=parseTree2(normalized,[],PARSE_OPTIONS);if(root===void 0){return normalized}const duplicate=findDuplicateProperty(root);if(duplicate===void 0){return normalized}let temporaryKey;do{temporaryKey=`__qwen_duplicate_${duplicateIndex}`;duplicateIndex+=1}while(duplicate.propertyNames.has(temporaryKey));let renamed=normalized.slice(0,duplicate.keyNode.offset)+JSON.stringify(temporaryKey)+normalized.slice(duplicate.keyNode.offset+duplicate.keyNode.length);renamed=removeTrailingInlineComment(renamed,[...duplicate.objectPath,temporaryKey]);normalized=applyEdits(renamed,modify(renamed,[...duplicate.objectPath,temporaryKey],void 0,options))}}__name(normalizeDuplicateProperties,"normalizeDuplicateProperties");function removeTrailingInlineComment(content,path3){const root=parseTree2(content,[],PARSE_OPTIONS);if(root===void 0){return content}const node=findNodeAtLocation2(root,[...path3]);if(node===void 0){return content}const tail=content.slice(node.offset+node.length);const match=tail.match(/^[ \t]*(?:,[ \t]*)?(\/\/[^\r\n]*|\/\*[\s\S]*?\*\/)/);const comment=match?.[1];if(comment===void 0||match===null){return content}const commentOffset=node.offset+node.length+match[0].indexOf(comment);return content.slice(0,commentOffset)+content.slice(commentOffset+comment.length)}__name(removeTrailingInlineComment,"removeTrailingInlineComment");function pathsEqual(left,right){return left.length===right.length&&left.every((segment,index)=>segment===right[index])}__name(pathsEqual,"pathsEqual");var debugLogger=createDebugLogger("TRUSTED_FOLDERS");var TRUSTED_FOLDERS_FILENAME="trustedFolders.json";function getTrustedFoldersPath(){if(process.env["QWEN_CODE_TRUSTED_FOLDERS_PATH"]){return process.env["QWEN_CODE_TRUSTED_FOLDERS_PATH"]}return path2.join(Storage.getGlobalQwenDir(),TRUSTED_FOLDERS_FILENAME)}__name(getTrustedFoldersPath,"getTrustedFoldersPath");var TrustLevel=(TrustLevel2=>{TrustLevel2["TRUST_FOLDER"]="TRUST_FOLDER";TrustLevel2["TRUST_PARENT"]="TRUST_PARENT";TrustLevel2["DO_NOT_TRUST"]="DO_NOT_TRUST";return TrustLevel2})(TrustLevel||{});var trustedFoldersChangeListeners=new Set;function onTrustedFoldersChanged(listener){trustedFoldersChangeListeners.add(listener);return()=>trustedFoldersChangeListeners.delete(listener)}__name(onTrustedFoldersChanged,"onTrustedFoldersChanged");function notifyTrustedFoldersChanged(){for(const listener of trustedFoldersChangeListeners)listener()}__name(notifyTrustedFoldersChanged,"notifyTrustedFoldersChanged");var LoadedTrustedFolders=class{constructor(user,errors){this.user=user;this.errors=errors}static{__name(this,"LoadedTrustedFolders")}get rules(){return Object.entries(this.user.config).map(([path3,trustLevel])=>({path:path3,trustLevel}))}isPathTrusted(location){return resolveTrustDecision(buildTrustPrecedenceRules(this.rules),getPathComparisonVariants(location))}setValue(path3,trustLevel,preserveExistingTrust=false){const committedConfig=writeTrustedFolders(this.user.path,diskConfig=>{const existing=diskConfig[path3];if(preserveExistingTrust&&(existing==="TRUST_FOLDER"||existing==="TRUST_PARENT")){return diskConfig}return{...diskConfig,[path3]:trustLevel}});this.user.config=committedConfig;notifyTrustedFoldersChanged()}};var loadedTrustedFolders;function resetTrustedFoldersForTesting(){loadedTrustedFolders=void 0}__name(resetTrustedFoldersForTesting,"resetTrustedFoldersForTesting");function loadTrustedFolders(){if(loadedTrustedFolders){return loadedTrustedFolders}const errors=[];let userConfig={};const userPath=getTrustedFoldersPath();try{if(fs3.existsSync(userPath)){const content=fs3.readFileSync(userPath,"utf-8");userConfig=parseJsoncObject(content)}}catch(error){errors.push({message:error instanceof Error&&error.message==="JSONC document root is not a JSON object."?"Trusted folders file is not a valid JSON object.":getErrorMessage(error),path:userPath})}loadedTrustedFolders=new LoadedTrustedFolders({path:userPath,config:userConfig},errors);return loadedTrustedFolders}__name(loadTrustedFolders,"loadTrustedFolders");function saveTrustedFolders(trustedFoldersFile){writeTrustedFolders(trustedFoldersFile.path,()=>({...trustedFoldersFile.config}))}__name(saveTrustedFolders,"saveTrustedFolders");function assertTrustedFoldersConfig(config){for(const[rulePath,trustLevel]of Object.entries(config)){if(!Object.values(TrustLevel).includes(trustLevel)){throw new FatalConfigError(`Invalid trusted folder rule for ${JSON.stringify(rulePath)}.`)}}}__name(assertTrustedFoldersConfig,"assertTrustedFoldersConfig");function writeTrustedFolders(filePath,update){const dirPath=path2.dirname(filePath);if(!fs3.existsSync(dirPath)){fs3.mkdirSync(dirPath,{recursive:true})}const release=import_proper_lockfile.default.lockSync(filePath,{realpath:false,stale:1e4,onCompromised:__name(err=>{debugLogger.warn("trusted folders lock compromised:",err)},"onCompromised")});try{let originalContent="{}";if(fs3.existsSync(filePath)){const stat=fs3.lstatSync(filePath);if(stat.isSymbolicLink()||!stat.isFile()){throw new FatalConfigError("Trusted folders path must be a regular file.")}originalContent=fs3.readFileSync(filePath,"utf-8")}let parsed;try{parsed=parseJsoncObject(originalContent)}catch(error){if(error instanceof Error&&error.message==="JSONC document root is not a JSON object."){throw new FatalConfigError("Trusted folders file is not a valid JSON object.")}throw error}const diskConfig=Object.fromEntries(Object.entries(parsed));assertTrustedFoldersConfig(diskConfig);const nextConfig=update({...diskConfig});assertTrustedFoldersConfig(nextConfig);const content=updateJsoncContent(originalContent,nextConfig,true);atomicWriteFileSync(filePath,content,{encoding:"utf-8",mode:384,forceMode:true,noFollow:true});return nextConfig}finally{try{release()}catch{}}}__name(writeTrustedFolders,"writeTrustedFolders");function isFolderTrustEnabled(settings){const folderTrustSetting=settings.security?.folderTrust?.enabled??false;return folderTrustSetting}__name(isFolderTrustEnabled,"isFolderTrustEnabled");function getExplicitTrustLevel(trustConfig,workspaceCwd){const winner=resolveTrustRule(buildTrustPrecedenceRules(Object.entries(trustConfig).map(([rulePath,trustLevel])=>({path:rulePath,trustLevel}))),getPathComparisonVariants(workspaceCwd));return winner?.payload??null}__name(getExplicitTrustLevel,"getExplicitTrustLevel");function loadTrustedFoldersWithOverrides(trustConfig){const folders=loadTrustedFolders();if(folders.errors.length>0){const errorMessages=folders.errors.map(error=>`Error in ${error.path}: ${error.message}`);throw new FatalConfigError(`${errorMessages.join("\n")}
|
|
3
|
+
import{buildTrustPrecedenceRules,resolveTrustDecision,resolveTrustRule}from"./chunk-EIPLDYEY.js";import{arePathsEquivalent,getPathComparisonVariants}from"./chunk-IDXJIDME.js";import{ideContextStore}from"./chunk-IFAUFERF.js";import{require_proper_lockfile}from"./chunk-YIW3H46P.js";import{atomicWriteFileSync}from"./chunk-BMHYEQTI.js";import{writeStderrLine}from"./chunk-SLPJ4OII.js";import{createDebugLogger}from"./chunk-JAUJI56S.js";import{Storage}from"./chunk-EPODBRBP.js";import{FatalConfigError,getErrorMessage}from"./chunk-XYB7GC5U.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name,__toESM}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var import_proper_lockfile=__toESM(require_proper_lockfile(),1);import*as fs3 from"node:fs";import*as path2 from"node:path";init_esbuild_shims();import*as fs2 from"node:fs";import{isDeepStrictEqual}from"node:util";init_esbuild_shims();init_esbuild_shims();init_esbuild_shims();function createScanner(text,ignoreTrivia=false){const len=text.length;let pos=0,value="",tokenOffset=0,token=16,lineNumber=0,lineStartOffset=0,tokenLineStartOffset=0,prevTokenLineStartOffset=0,scanError=0;function scanHexDigits(count,exact){let digits=0;let value2=0;while(digits<count||!exact){let ch=text.charCodeAt(pos);if(ch>=48&&ch<=57){value2=value2*16+ch-48}else if(ch>=65&&ch<=70){value2=value2*16+ch-65+10}else if(ch>=97&&ch<=102){value2=value2*16+ch-97+10}else{break}pos++;digits++}if(digits<count){value2=-1}return value2}__name(scanHexDigits,"scanHexDigits");function setPosition(newPosition){pos=newPosition;value="";tokenOffset=0;token=16;scanError=0}__name(setPosition,"setPosition");function scanNumber(){let start=pos;if(text.charCodeAt(pos)===48){pos++}else{pos++;while(pos<text.length&&isDigit(text.charCodeAt(pos))){pos++}}if(pos<text.length&&text.charCodeAt(pos)===46){pos++;if(pos<text.length&&isDigit(text.charCodeAt(pos))){pos++;while(pos<text.length&&isDigit(text.charCodeAt(pos))){pos++}}else{scanError=3;return text.substring(start,pos)}}let end=pos;if(pos<text.length&&(text.charCodeAt(pos)===69||text.charCodeAt(pos)===101)){pos++;if(pos<text.length&&text.charCodeAt(pos)===43||text.charCodeAt(pos)===45){pos++}if(pos<text.length&&isDigit(text.charCodeAt(pos))){pos++;while(pos<text.length&&isDigit(text.charCodeAt(pos))){pos++}end=pos}else{scanError=3}}return text.substring(start,end)}__name(scanNumber,"scanNumber");function scanString(){let result="",start=pos;while(true){if(pos>=len){result+=text.substring(start,pos);scanError=2;break}const ch=text.charCodeAt(pos);if(ch===34){result+=text.substring(start,pos);pos++;break}if(ch===92){result+=text.substring(start,pos);pos++;if(pos>=len){scanError=2;break}const ch2=text.charCodeAt(pos++);switch(ch2){case 34:result+='"';break;case 92:result+="\\";break;case 47:result+="/";break;case 98:result+="\b";break;case 102:result+="\f";break;case 110:result+="\n";break;case 114:result+="\r";break;case 116:result+=" ";break;case 117:const ch3=scanHexDigits(4,true);if(ch3>=0){result+=String.fromCharCode(ch3)}else{scanError=4}break;default:scanError=5}start=pos;continue}if(ch>=0&&ch<=31){if(isLineBreak(ch)){result+=text.substring(start,pos);scanError=2;break}else{scanError=6}}pos++}return result}__name(scanString,"scanString");function scanNext(){value="";scanError=0;tokenOffset=pos;lineStartOffset=lineNumber;prevTokenLineStartOffset=tokenLineStartOffset;if(pos>=len){tokenOffset=len;return token=17}let code=text.charCodeAt(pos);if(isWhiteSpace(code)){do{pos++;value+=String.fromCharCode(code);code=text.charCodeAt(pos)}while(isWhiteSpace(code));return token=15}if(isLineBreak(code)){pos++;value+=String.fromCharCode(code);if(code===13&&text.charCodeAt(pos)===10){pos++;value+="\n"}lineNumber++;tokenLineStartOffset=pos;return token=14}switch(code){case 123:pos++;return token=1;case 125:pos++;return token=2;case 91:pos++;return token=3;case 93:pos++;return token=4;case 58:pos++;return token=6;case 44:pos++;return token=5;case 34:pos++;value=scanString();return token=10;case 47:const start=pos-1;if(text.charCodeAt(pos+1)===47){pos+=2;while(pos<len){if(isLineBreak(text.charCodeAt(pos))){break}pos++}value=text.substring(start,pos);return token=12}if(text.charCodeAt(pos+1)===42){pos+=2;const safeLength=len-1;let commentClosed=false;while(pos<safeLength){const ch=text.charCodeAt(pos);if(ch===42&&text.charCodeAt(pos+1)===47){pos+=2;commentClosed=true;break}pos++;if(isLineBreak(ch)){if(ch===13&&text.charCodeAt(pos)===10){pos++}lineNumber++;tokenLineStartOffset=pos}}if(!commentClosed){pos++;scanError=1}value=text.substring(start,pos);return token=13}value+=String.fromCharCode(code);pos++;return token=16;case 45:value+=String.fromCharCode(code);pos++;if(pos===len||!isDigit(text.charCodeAt(pos))){return token=16}case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:value+=scanNumber();return token=11;default:while(pos<len&&isUnknownContentCharacter(code)){pos++;code=text.charCodeAt(pos)}if(tokenOffset!==pos){value=text.substring(tokenOffset,pos);switch(value){case"true":return token=8;case"false":return token=9;case"null":return token=7}return token=16}value+=String.fromCharCode(code);pos++;return token=16}}__name(scanNext,"scanNext");function isUnknownContentCharacter(code){if(isWhiteSpace(code)||isLineBreak(code)){return false}switch(code){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return false}return true}__name(isUnknownContentCharacter,"isUnknownContentCharacter");function scanNextNonTrivia(){let result;do{result=scanNext()}while(result>=12&&result<=15);return result}__name(scanNextNonTrivia,"scanNextNonTrivia");return{setPosition,getPosition:__name(()=>pos,"getPosition"),scan:ignoreTrivia?scanNextNonTrivia:scanNext,getToken:__name(()=>token,"getToken"),getTokenValue:__name(()=>value,"getTokenValue"),getTokenOffset:__name(()=>tokenOffset,"getTokenOffset"),getTokenLength:__name(()=>pos-tokenOffset,"getTokenLength"),getTokenStartLine:__name(()=>lineStartOffset,"getTokenStartLine"),getTokenStartCharacter:__name(()=>tokenOffset-prevTokenLineStartOffset,"getTokenStartCharacter"),getTokenError:__name(()=>scanError,"getTokenError")}}__name(createScanner,"createScanner");function isWhiteSpace(ch){return ch===32||ch===9}__name(isWhiteSpace,"isWhiteSpace");function isLineBreak(ch){return ch===10||ch===13}__name(isLineBreak,"isLineBreak");function isDigit(ch){return ch>=48&&ch<=57}__name(isDigit,"isDigit");var CharacterCodes;(function(CharacterCodes2){CharacterCodes2[CharacterCodes2["lineFeed"]=10]="lineFeed";CharacterCodes2[CharacterCodes2["carriageReturn"]=13]="carriageReturn";CharacterCodes2[CharacterCodes2["space"]=32]="space";CharacterCodes2[CharacterCodes2["_0"]=48]="_0";CharacterCodes2[CharacterCodes2["_1"]=49]="_1";CharacterCodes2[CharacterCodes2["_2"]=50]="_2";CharacterCodes2[CharacterCodes2["_3"]=51]="_3";CharacterCodes2[CharacterCodes2["_4"]=52]="_4";CharacterCodes2[CharacterCodes2["_5"]=53]="_5";CharacterCodes2[CharacterCodes2["_6"]=54]="_6";CharacterCodes2[CharacterCodes2["_7"]=55]="_7";CharacterCodes2[CharacterCodes2["_8"]=56]="_8";CharacterCodes2[CharacterCodes2["_9"]=57]="_9";CharacterCodes2[CharacterCodes2["a"]=97]="a";CharacterCodes2[CharacterCodes2["b"]=98]="b";CharacterCodes2[CharacterCodes2["c"]=99]="c";CharacterCodes2[CharacterCodes2["d"]=100]="d";CharacterCodes2[CharacterCodes2["e"]=101]="e";CharacterCodes2[CharacterCodes2["f"]=102]="f";CharacterCodes2[CharacterCodes2["g"]=103]="g";CharacterCodes2[CharacterCodes2["h"]=104]="h";CharacterCodes2[CharacterCodes2["i"]=105]="i";CharacterCodes2[CharacterCodes2["j"]=106]="j";CharacterCodes2[CharacterCodes2["k"]=107]="k";CharacterCodes2[CharacterCodes2["l"]=108]="l";CharacterCodes2[CharacterCodes2["m"]=109]="m";CharacterCodes2[CharacterCodes2["n"]=110]="n";CharacterCodes2[CharacterCodes2["o"]=111]="o";CharacterCodes2[CharacterCodes2["p"]=112]="p";CharacterCodes2[CharacterCodes2["q"]=113]="q";CharacterCodes2[CharacterCodes2["r"]=114]="r";CharacterCodes2[CharacterCodes2["s"]=115]="s";CharacterCodes2[CharacterCodes2["t"]=116]="t";CharacterCodes2[CharacterCodes2["u"]=117]="u";CharacterCodes2[CharacterCodes2["v"]=118]="v";CharacterCodes2[CharacterCodes2["w"]=119]="w";CharacterCodes2[CharacterCodes2["x"]=120]="x";CharacterCodes2[CharacterCodes2["y"]=121]="y";CharacterCodes2[CharacterCodes2["z"]=122]="z";CharacterCodes2[CharacterCodes2["A"]=65]="A";CharacterCodes2[CharacterCodes2["B"]=66]="B";CharacterCodes2[CharacterCodes2["C"]=67]="C";CharacterCodes2[CharacterCodes2["D"]=68]="D";CharacterCodes2[CharacterCodes2["E"]=69]="E";CharacterCodes2[CharacterCodes2["F"]=70]="F";CharacterCodes2[CharacterCodes2["G"]=71]="G";CharacterCodes2[CharacterCodes2["H"]=72]="H";CharacterCodes2[CharacterCodes2["I"]=73]="I";CharacterCodes2[CharacterCodes2["J"]=74]="J";CharacterCodes2[CharacterCodes2["K"]=75]="K";CharacterCodes2[CharacterCodes2["L"]=76]="L";CharacterCodes2[CharacterCodes2["M"]=77]="M";CharacterCodes2[CharacterCodes2["N"]=78]="N";CharacterCodes2[CharacterCodes2["O"]=79]="O";CharacterCodes2[CharacterCodes2["P"]=80]="P";CharacterCodes2[CharacterCodes2["Q"]=81]="Q";CharacterCodes2[CharacterCodes2["R"]=82]="R";CharacterCodes2[CharacterCodes2["S"]=83]="S";CharacterCodes2[CharacterCodes2["T"]=84]="T";CharacterCodes2[CharacterCodes2["U"]=85]="U";CharacterCodes2[CharacterCodes2["V"]=86]="V";CharacterCodes2[CharacterCodes2["W"]=87]="W";CharacterCodes2[CharacterCodes2["X"]=88]="X";CharacterCodes2[CharacterCodes2["Y"]=89]="Y";CharacterCodes2[CharacterCodes2["Z"]=90]="Z";CharacterCodes2[CharacterCodes2["asterisk"]=42]="asterisk";CharacterCodes2[CharacterCodes2["backslash"]=92]="backslash";CharacterCodes2[CharacterCodes2["closeBrace"]=125]="closeBrace";CharacterCodes2[CharacterCodes2["closeBracket"]=93]="closeBracket";CharacterCodes2[CharacterCodes2["colon"]=58]="colon";CharacterCodes2[CharacterCodes2["comma"]=44]="comma";CharacterCodes2[CharacterCodes2["dot"]=46]="dot";CharacterCodes2[CharacterCodes2["doubleQuote"]=34]="doubleQuote";CharacterCodes2[CharacterCodes2["minus"]=45]="minus";CharacterCodes2[CharacterCodes2["openBrace"]=123]="openBrace";CharacterCodes2[CharacterCodes2["openBracket"]=91]="openBracket";CharacterCodes2[CharacterCodes2["plus"]=43]="plus";CharacterCodes2[CharacterCodes2["slash"]=47]="slash";CharacterCodes2[CharacterCodes2["formFeed"]=12]="formFeed";CharacterCodes2[CharacterCodes2["tab"]=9]="tab"})(CharacterCodes||(CharacterCodes={}));init_esbuild_shims();var cachedSpaces=new Array(20).fill(0).map((_,index)=>{return" ".repeat(index)});var maxCachedValues=200;var cachedBreakLinesWithSpaces={" ":{"\n":new Array(maxCachedValues).fill(0).map((_,index)=>{return"\n"+" ".repeat(index)}),"\r":new Array(maxCachedValues).fill(0).map((_,index)=>{return"\r"+" ".repeat(index)}),"\r\n":new Array(maxCachedValues).fill(0).map((_,index)=>{return"\r\n"+" ".repeat(index)})}," ":{"\n":new Array(maxCachedValues).fill(0).map((_,index)=>{return"\n"+" ".repeat(index)}),"\r":new Array(maxCachedValues).fill(0).map((_,index)=>{return"\r"+" ".repeat(index)}),"\r\n":new Array(maxCachedValues).fill(0).map((_,index)=>{return"\r\n"+" ".repeat(index)})}};var supportedEols=["\n","\r","\r\n"];function format(documentText,range,options){let initialIndentLevel;let formatText;let formatTextStart;let rangeStart;let rangeEnd;if(range){rangeStart=range.offset;rangeEnd=rangeStart+range.length;formatTextStart=rangeStart;while(formatTextStart>0&&!isEOL(documentText,formatTextStart-1)){formatTextStart--}let endOffset=rangeEnd;while(endOffset<documentText.length&&!isEOL(documentText,endOffset)){endOffset++}formatText=documentText.substring(formatTextStart,endOffset);initialIndentLevel=computeIndentLevel(formatText,options)}else{formatText=documentText;initialIndentLevel=0;formatTextStart=0;rangeStart=0;rangeEnd=documentText.length}const eol=getEOL(options,documentText);const eolFastPathSupported=supportedEols.includes(eol);let numberLineBreaks=0;let indentLevel=0;let indentValue;if(options.insertSpaces){indentValue=cachedSpaces[options.tabSize||4]??repeat(cachedSpaces[1],options.tabSize||4)}else{indentValue=" "}const indentType=indentValue===" "?" ":" ";let scanner=createScanner(formatText,false);let hasError=false;function newLinesAndIndent(){if(numberLineBreaks>1){return repeat(eol,numberLineBreaks)+repeat(indentValue,initialIndentLevel+indentLevel)}const amountOfSpaces=indentValue.length*(initialIndentLevel+indentLevel);if(!eolFastPathSupported||amountOfSpaces>cachedBreakLinesWithSpaces[indentType][eol].length){return eol+repeat(indentValue,initialIndentLevel+indentLevel)}if(amountOfSpaces<=0){return eol}return cachedBreakLinesWithSpaces[indentType][eol][amountOfSpaces]}__name(newLinesAndIndent,"newLinesAndIndent");function scanNext(){let token=scanner.scan();numberLineBreaks=0;while(token===15||token===14){if(token===14&&options.keepLines){numberLineBreaks+=1}else if(token===14){numberLineBreaks=1}token=scanner.scan()}hasError=token===16||scanner.getTokenError()!==0;return token}__name(scanNext,"scanNext");const editOperations=[];function addEdit(text,startOffset,endOffset){if(!hasError&&(!range||startOffset<rangeEnd&&endOffset>rangeStart)&&documentText.substring(startOffset,endOffset)!==text){editOperations.push({offset:startOffset,length:endOffset-startOffset,content:text})}}__name(addEdit,"addEdit");let firstToken=scanNext();if(options.keepLines&&numberLineBreaks>0){addEdit(repeat(eol,numberLineBreaks),0,0)}if(firstToken!==17){let firstTokenStart=scanner.getTokenOffset()+formatTextStart;let initialIndent=indentValue.length*initialIndentLevel<20&&options.insertSpaces?cachedSpaces[indentValue.length*initialIndentLevel]:repeat(indentValue,initialIndentLevel);addEdit(initialIndent,formatTextStart,firstTokenStart)}while(firstToken!==17){let firstTokenEnd=scanner.getTokenOffset()+scanner.getTokenLength()+formatTextStart;let secondToken=scanNext();let replaceContent="";let needsLineBreak=false;while(numberLineBreaks===0&&(secondToken===12||secondToken===13)){let commentTokenStart=scanner.getTokenOffset()+formatTextStart;addEdit(cachedSpaces[1],firstTokenEnd,commentTokenStart);firstTokenEnd=scanner.getTokenOffset()+scanner.getTokenLength()+formatTextStart;needsLineBreak=secondToken===12;replaceContent=needsLineBreak?newLinesAndIndent():"";secondToken=scanNext()}if(secondToken===2){if(firstToken!==1){indentLevel--};if(options.keepLines&&numberLineBreaks>0||!options.keepLines&&firstToken!==1){replaceContent=newLinesAndIndent()}else if(options.keepLines){replaceContent=cachedSpaces[1]}}else if(secondToken===4){if(firstToken!==3){indentLevel--};if(options.keepLines&&numberLineBreaks>0||!options.keepLines&&firstToken!==3){replaceContent=newLinesAndIndent()}else if(options.keepLines){replaceContent=cachedSpaces[1]}}else{switch(firstToken){case 3:case 1:indentLevel++;if(options.keepLines&&numberLineBreaks>0||!options.keepLines){replaceContent=newLinesAndIndent()}else{replaceContent=cachedSpaces[1]}break;case 5:if(options.keepLines&&numberLineBreaks>0||!options.keepLines){replaceContent=newLinesAndIndent()}else{replaceContent=cachedSpaces[1]}break;case 12:replaceContent=newLinesAndIndent();break;case 13:if(numberLineBreaks>0){replaceContent=newLinesAndIndent()}else if(!needsLineBreak){replaceContent=cachedSpaces[1]}break;case 6:if(options.keepLines&&numberLineBreaks>0){replaceContent=newLinesAndIndent()}else if(!needsLineBreak){replaceContent=cachedSpaces[1]}break;case 10:if(options.keepLines&&numberLineBreaks>0){replaceContent=newLinesAndIndent()}else if(secondToken===6&&!needsLineBreak){replaceContent=""}break;case 7:case 8:case 9:case 11:case 2:case 4:if(options.keepLines&&numberLineBreaks>0){replaceContent=newLinesAndIndent()}else{if((secondToken===12||secondToken===13)&&!needsLineBreak){replaceContent=cachedSpaces[1]}else if(secondToken!==5&&secondToken!==17){hasError=true}}break;case 16:hasError=true;break}if(numberLineBreaks>0&&(secondToken===12||secondToken===13)){replaceContent=newLinesAndIndent()}}if(secondToken===17){if(options.keepLines&&numberLineBreaks>0){replaceContent=newLinesAndIndent()}else{replaceContent=options.insertFinalNewline?eol:""}}const secondTokenStart=scanner.getTokenOffset()+formatTextStart;addEdit(replaceContent,firstTokenEnd,secondTokenStart);firstToken=secondToken}return editOperations}__name(format,"format");function repeat(s,count){let result="";for(let i=0;i<count;i++){result+=s}return result}__name(repeat,"repeat");function computeIndentLevel(content,options){let i=0;let nChars=0;const tabSize=options.tabSize||4;while(i<content.length){let ch=content.charAt(i);if(ch===cachedSpaces[1]){nChars++}else if(ch===" "){nChars+=tabSize}else{break}i++}return Math.floor(nChars/tabSize)}__name(computeIndentLevel,"computeIndentLevel");function getEOL(options,text){for(let i=0;i<text.length;i++){const ch=text.charAt(i);if(ch==="\r"){if(i+1<text.length&&text.charAt(i+1)==="\n"){return"\r\n"}return"\r"}else if(ch==="\n"){return"\n"}}return options&&options.eol||"\n"}__name(getEOL,"getEOL");function isEOL(text,offset){return"\r\n".indexOf(text.charAt(offset))!==-1}__name(isEOL,"isEOL");init_esbuild_shims();init_esbuild_shims();var ParseOptions;(function(ParseOptions2){ParseOptions2.DEFAULT={allowTrailingComma:false}})(ParseOptions||(ParseOptions={}));function parseTree(text,errors=[],options=ParseOptions.DEFAULT){let currentParent={type:"array",offset:-1,length:-1,children:[],parent:void 0};function ensurePropertyComplete(endOffset){if(currentParent.type==="property"){currentParent.length=endOffset-currentParent.offset;currentParent=currentParent.parent}}__name(ensurePropertyComplete,"ensurePropertyComplete");function onValue(valueNode){currentParent.children.push(valueNode);return valueNode}__name(onValue,"onValue");const visitor={onObjectBegin:__name(offset=>{currentParent=onValue({type:"object",offset,length:-1,parent:currentParent,children:[]})},"onObjectBegin"),onObjectProperty:__name((name,offset,length)=>{currentParent=onValue({type:"property",offset,length:-1,parent:currentParent,children:[]});currentParent.children.push({type:"string",value:name,offset,length,parent:currentParent})},"onObjectProperty"),onObjectEnd:__name((offset,length)=>{ensurePropertyComplete(offset+length);currentParent.length=offset+length-currentParent.offset;currentParent=currentParent.parent;ensurePropertyComplete(offset+length)},"onObjectEnd"),onArrayBegin:__name((offset,length)=>{currentParent=onValue({type:"array",offset,length:-1,parent:currentParent,children:[]})},"onArrayBegin"),onArrayEnd:__name((offset,length)=>{currentParent.length=offset+length-currentParent.offset;currentParent=currentParent.parent;ensurePropertyComplete(offset+length)},"onArrayEnd"),onLiteralValue:__name((value,offset,length)=>{onValue({type:getNodeType(value),offset,length,parent:currentParent,value});ensurePropertyComplete(offset+length)},"onLiteralValue"),onSeparator:__name((sep,offset,length)=>{if(currentParent.type==="property"){if(sep===":"){currentParent.colonOffset=offset}else if(sep===","){ensurePropertyComplete(offset)}}},"onSeparator"),onError:__name((error,offset,length)=>{errors.push({error,offset,length})},"onError")};visit(text,visitor,options);const result=currentParent.children[0];if(result){delete result.parent}return result}__name(parseTree,"parseTree");function findNodeAtLocation(root,path3){if(!root){return void 0}let node=root;for(let segment of path3){if(typeof segment==="string"){if(node.type!=="object"||!Array.isArray(node.children)){return void 0}let found=false;for(const propertyNode of node.children){if(Array.isArray(propertyNode.children)&&propertyNode.children[0].value===segment&&propertyNode.children.length===2){node=propertyNode.children[1];found=true;break}}if(!found){return void 0}}else{const index=segment;if(node.type!=="array"||index<0||!Array.isArray(node.children)||index>=node.children.length){return void 0}node=node.children[index]}}return node}__name(findNodeAtLocation,"findNodeAtLocation");function getNodeValue(node){switch(node.type){case"array":return node.children.map(getNodeValue);case"object":const obj=Object.create(null);for(let prop of node.children){const valueNode=prop.children[1];if(valueNode){obj[prop.children[0].value]=getNodeValue(valueNode)}}return obj;case"null":case"string":case"number":case"boolean":return node.value;default:return void 0}}__name(getNodeValue,"getNodeValue");function visit(text,visitor,options=ParseOptions.DEFAULT){const _scanner=createScanner(text,false);const _jsonPath=[];let suppressedCallbacks=0;function toNoArgVisit(visitFunction){return visitFunction?()=>suppressedCallbacks===0&&visitFunction(_scanner.getTokenOffset(),_scanner.getTokenLength(),_scanner.getTokenStartLine(),_scanner.getTokenStartCharacter()):()=>true}__name(toNoArgVisit,"toNoArgVisit");function toOneArgVisit(visitFunction){return visitFunction?arg=>suppressedCallbacks===0&&visitFunction(arg,_scanner.getTokenOffset(),_scanner.getTokenLength(),_scanner.getTokenStartLine(),_scanner.getTokenStartCharacter()):()=>true}__name(toOneArgVisit,"toOneArgVisit");function toOneArgVisitWithPath(visitFunction){return visitFunction?arg=>suppressedCallbacks===0&&visitFunction(arg,_scanner.getTokenOffset(),_scanner.getTokenLength(),_scanner.getTokenStartLine(),_scanner.getTokenStartCharacter(),()=>_jsonPath.slice()):()=>true}__name(toOneArgVisitWithPath,"toOneArgVisitWithPath");function toBeginVisit(visitFunction){return visitFunction?()=>{if(suppressedCallbacks>0){suppressedCallbacks++}else{let cbReturn=visitFunction(_scanner.getTokenOffset(),_scanner.getTokenLength(),_scanner.getTokenStartLine(),_scanner.getTokenStartCharacter(),()=>_jsonPath.slice());if(cbReturn===false){suppressedCallbacks=1}}}:()=>true}__name(toBeginVisit,"toBeginVisit");function toEndVisit(visitFunction){return visitFunction?()=>{if(suppressedCallbacks>0){suppressedCallbacks--}if(suppressedCallbacks===0){visitFunction(_scanner.getTokenOffset(),_scanner.getTokenLength(),_scanner.getTokenStartLine(),_scanner.getTokenStartCharacter())}}:()=>true}__name(toEndVisit,"toEndVisit");const onObjectBegin=toBeginVisit(visitor.onObjectBegin),onObjectProperty=toOneArgVisitWithPath(visitor.onObjectProperty),onObjectEnd=toEndVisit(visitor.onObjectEnd),onArrayBegin=toBeginVisit(visitor.onArrayBegin),onArrayEnd=toEndVisit(visitor.onArrayEnd),onLiteralValue=toOneArgVisitWithPath(visitor.onLiteralValue),onSeparator=toOneArgVisit(visitor.onSeparator),onComment=toNoArgVisit(visitor.onComment),onError=toOneArgVisit(visitor.onError);const disallowComments=options&&options.disallowComments;const allowTrailingComma=options&&options.allowTrailingComma;function scanNext(){while(true){const token=_scanner.scan();switch(_scanner.getTokenError()){case 4:handleError(14);break;case 5:handleError(15);break;case 3:handleError(13);break;case 1:if(!disallowComments){handleError(11)}break;case 2:handleError(12);break;case 6:handleError(16);break}switch(token){case 12:case 13:if(disallowComments){handleError(10)}else{onComment()}break;case 16:handleError(1);break;case 15:case 14:break;default:return token}}}__name(scanNext,"scanNext");function handleError(error,skipUntilAfter=[],skipUntil=[]){onError(error);if(skipUntilAfter.length+skipUntil.length>0){let token=_scanner.getToken();while(token!==17){if(skipUntilAfter.indexOf(token)!==-1){scanNext();break}else if(skipUntil.indexOf(token)!==-1){break}token=scanNext()}}}__name(handleError,"handleError");function parseString(isValue){const value=_scanner.getTokenValue();if(isValue){onLiteralValue(value)}else{onObjectProperty(value);_jsonPath.push(value)}scanNext();return true}__name(parseString,"parseString");function parseLiteral(){switch(_scanner.getToken()){case 11:const tokenValue=_scanner.getTokenValue();let value=Number(tokenValue);if(isNaN(value)){handleError(2);value=0}onLiteralValue(value);break;case 7:onLiteralValue(null);break;case 8:onLiteralValue(true);break;case 9:onLiteralValue(false);break;default:return false}scanNext();return true}__name(parseLiteral,"parseLiteral");function parseProperty(){if(_scanner.getToken()!==10){handleError(3,[],[2,5]);return false}parseString(false);if(_scanner.getToken()===6){onSeparator(":");scanNext();if(!parseValue()){handleError(4,[],[2,5])}}else{handleError(5,[],[2,5])}_jsonPath.pop();return true}__name(parseProperty,"parseProperty");function parseObject(){onObjectBegin();scanNext();let needsComma=false;while(_scanner.getToken()!==2&&_scanner.getToken()!==17){if(_scanner.getToken()===5){if(!needsComma){handleError(4,[],[])}onSeparator(",");scanNext();if(_scanner.getToken()===2&&allowTrailingComma){break}}else if(needsComma){handleError(6,[],[])}if(!parseProperty()){handleError(4,[],[2,5])}needsComma=true}onObjectEnd();if(_scanner.getToken()!==2){handleError(7,[2],[])}else{scanNext()}return true}__name(parseObject,"parseObject");function parseArray(){onArrayBegin();scanNext();let isFirstElement=true;let needsComma=false;while(_scanner.getToken()!==4&&_scanner.getToken()!==17){if(_scanner.getToken()===5){if(!needsComma){handleError(4,[],[])}onSeparator(",");scanNext();if(_scanner.getToken()===4&&allowTrailingComma){break}}else if(needsComma){handleError(6,[],[])}if(isFirstElement){_jsonPath.push(0);isFirstElement=false}else{_jsonPath[_jsonPath.length-1]++}if(!parseValue()){handleError(4,[],[4,5])}needsComma=true}onArrayEnd();if(!isFirstElement){_jsonPath.pop()}if(_scanner.getToken()!==4){handleError(8,[4],[])}else{scanNext()}return true}__name(parseArray,"parseArray");function parseValue(){switch(_scanner.getToken()){case 3:return parseArray();case 1:return parseObject();case 10:return parseString(true);default:return parseLiteral()}}__name(parseValue,"parseValue");scanNext();if(_scanner.getToken()===17){if(options.allowEmptyContent){return true}handleError(4,[],[]);return false}if(!parseValue()){handleError(4,[],[]);return false}if(_scanner.getToken()!==17){handleError(9,[],[])}return true}__name(visit,"visit");function getNodeType(value){switch(typeof value){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(!value){return"null"}else if(Array.isArray(value)){return"array"}return"object"}default:return"null"}}__name(getNodeType,"getNodeType");function setProperty(text,originalPath,value,options){const path3=originalPath.slice();const errors=[];const root=parseTree(text,errors);let parent=void 0;let lastSegment=void 0;while(path3.length>0){lastSegment=path3.pop();parent=findNodeAtLocation(root,path3);if(parent===void 0&&value!==void 0){if(typeof lastSegment==="string"){value={[lastSegment]:value}}else{value=[value]}}else{break}}if(!parent){if(value===void 0){throw new Error("Can not delete in empty document")}return withFormatting(text,{offset:root?root.offset:0,length:root?root.length:0,content:JSON.stringify(value)},options)}else if(parent.type==="object"&&typeof lastSegment==="string"&&Array.isArray(parent.children)){const existing=findNodeAtLocation(parent,[lastSegment]);if(existing!==void 0){if(value===void 0){if(!existing.parent){throw new Error("Malformed AST")}const propertyIndex=parent.children.indexOf(existing.parent);let removeBegin;let removeEnd=existing.parent.offset+existing.parent.length;if(propertyIndex>0){let previous=parent.children[propertyIndex-1];removeBegin=previous.offset+previous.length}else{removeBegin=parent.offset+1;if(parent.children.length>1){let next=parent.children[1];removeEnd=next.offset}}return withFormatting(text,{offset:removeBegin,length:removeEnd-removeBegin,content:""},options)}else{return withFormatting(text,{offset:existing.offset,length:existing.length,content:JSON.stringify(value)},options)}}else{if(value===void 0){return[]}const newProperty=`${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`;const index=options.getInsertionIndex?options.getInsertionIndex(parent.children.map(p=>p.children[0].value)):parent.children.length;let edit;if(index>0){let previous=parent.children[index-1];edit={offset:previous.offset+previous.length,length:0,content:","+newProperty}}else if(parent.children.length===0){edit={offset:parent.offset+1,length:0,content:newProperty}}else{edit={offset:parent.offset+1,length:0,content:newProperty+","}}return withFormatting(text,edit,options)}}else if(parent.type==="array"&&typeof lastSegment==="number"&&Array.isArray(parent.children)){const insertIndex=lastSegment;if(insertIndex===-1){const newProperty=`${JSON.stringify(value)}`;let edit;if(parent.children.length===0){edit={offset:parent.offset+1,length:0,content:newProperty}}else{const previous=parent.children[parent.children.length-1];edit={offset:previous.offset+previous.length,length:0,content:","+newProperty}}return withFormatting(text,edit,options)}else if(value===void 0&&parent.children.length>=0){const removalIndex=lastSegment;const toRemove=parent.children[removalIndex];let edit;if(parent.children.length===1){edit={offset:parent.offset+1,length:parent.length-2,content:""}}else if(parent.children.length-1===removalIndex){let previous=parent.children[removalIndex-1];let offset=previous.offset+previous.length;let parentEndOffset=parent.offset+parent.length;edit={offset,length:parentEndOffset-2-offset,content:""}}else{edit={offset:toRemove.offset,length:parent.children[removalIndex+1].offset-toRemove.offset,content:""}}return withFormatting(text,edit,options)}else if(value!==void 0){let edit;const newProperty=`${JSON.stringify(value)}`;if(!options.isArrayInsertion&&parent.children.length>lastSegment){const toModify=parent.children[lastSegment];edit={offset:toModify.offset,length:toModify.length,content:newProperty}}else if(parent.children.length===0||lastSegment===0){edit={offset:parent.offset+1,length:0,content:parent.children.length===0?newProperty:newProperty+","}}else{const index=lastSegment>parent.children.length?parent.children.length:lastSegment;const previous=parent.children[index-1];edit={offset:previous.offset+previous.length,length:0,content:","+newProperty}}return withFormatting(text,edit,options)}else{throw new Error(`Can not ${value===void 0?"remove":options.isArrayInsertion?"insert":"modify"} Array index ${insertIndex} as length is not sufficient`)}}else{throw new Error(`Can not add ${typeof lastSegment!=="number"?"index":"property"} to parent of type ${parent.type}`)}}__name(setProperty,"setProperty");function withFormatting(text,edit,options){if(!options.formattingOptions){return[edit]}let newText=applyEdit(text,edit);let begin=edit.offset;let end=edit.offset+edit.content.length;if(edit.length===0||edit.content.length===0){while(begin>0&&!isEOL(newText,begin-1)){begin--}while(end<newText.length&&!isEOL(newText,end)){end++}}const edits=format(newText,{offset:begin,length:end-begin},{...options.formattingOptions,keepLines:false});for(let i=edits.length-1;i>=0;i--){const edit2=edits[i];newText=applyEdit(newText,edit2);begin=Math.min(begin,edit2.offset);end=Math.max(end,edit2.offset+edit2.length);end+=edit2.content.length-edit2.length}const editLength=text.length-(newText.length-end)-begin;return[{offset:begin,length:editLength,content:newText.substring(begin,end)}]}__name(withFormatting,"withFormatting");function applyEdit(text,edit){return text.substring(0,edit.offset)+edit.content+text.substring(edit.offset+edit.length)}__name(applyEdit,"applyEdit");var ScanError;(function(ScanError2){ScanError2[ScanError2["None"]=0]="None";ScanError2[ScanError2["UnexpectedEndOfComment"]=1]="UnexpectedEndOfComment";ScanError2[ScanError2["UnexpectedEndOfString"]=2]="UnexpectedEndOfString";ScanError2[ScanError2["UnexpectedEndOfNumber"]=3]="UnexpectedEndOfNumber";ScanError2[ScanError2["InvalidUnicode"]=4]="InvalidUnicode";ScanError2[ScanError2["InvalidEscapeCharacter"]=5]="InvalidEscapeCharacter";ScanError2[ScanError2["InvalidCharacter"]=6]="InvalidCharacter"})(ScanError||(ScanError={}));var SyntaxKind;(function(SyntaxKind2){SyntaxKind2[SyntaxKind2["OpenBraceToken"]=1]="OpenBraceToken";SyntaxKind2[SyntaxKind2["CloseBraceToken"]=2]="CloseBraceToken";SyntaxKind2[SyntaxKind2["OpenBracketToken"]=3]="OpenBracketToken";SyntaxKind2[SyntaxKind2["CloseBracketToken"]=4]="CloseBracketToken";SyntaxKind2[SyntaxKind2["CommaToken"]=5]="CommaToken";SyntaxKind2[SyntaxKind2["ColonToken"]=6]="ColonToken";SyntaxKind2[SyntaxKind2["NullKeyword"]=7]="NullKeyword";SyntaxKind2[SyntaxKind2["TrueKeyword"]=8]="TrueKeyword";SyntaxKind2[SyntaxKind2["FalseKeyword"]=9]="FalseKeyword";SyntaxKind2[SyntaxKind2["StringLiteral"]=10]="StringLiteral";SyntaxKind2[SyntaxKind2["NumericLiteral"]=11]="NumericLiteral";SyntaxKind2[SyntaxKind2["LineCommentTrivia"]=12]="LineCommentTrivia";SyntaxKind2[SyntaxKind2["BlockCommentTrivia"]=13]="BlockCommentTrivia";SyntaxKind2[SyntaxKind2["LineBreakTrivia"]=14]="LineBreakTrivia";SyntaxKind2[SyntaxKind2["Trivia"]=15]="Trivia";SyntaxKind2[SyntaxKind2["Unknown"]=16]="Unknown";SyntaxKind2[SyntaxKind2["EOF"]=17]="EOF"})(SyntaxKind||(SyntaxKind={}));var parseTree2=parseTree;var findNodeAtLocation2=findNodeAtLocation;var getNodeValue2=getNodeValue;var ParseErrorCode;(function(ParseErrorCode2){ParseErrorCode2[ParseErrorCode2["InvalidSymbol"]=1]="InvalidSymbol";ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"]=2]="InvalidNumberFormat";ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"]=3]="PropertyNameExpected";ParseErrorCode2[ParseErrorCode2["ValueExpected"]=4]="ValueExpected";ParseErrorCode2[ParseErrorCode2["ColonExpected"]=5]="ColonExpected";ParseErrorCode2[ParseErrorCode2["CommaExpected"]=6]="CommaExpected";ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"]=7]="CloseBraceExpected";ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"]=8]="CloseBracketExpected";ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"]=9]="EndOfFileExpected";ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"]=10]="InvalidCommentToken";ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"]=11]="UnexpectedEndOfComment";ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"]=12]="UnexpectedEndOfString";ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"]=13]="UnexpectedEndOfNumber";ParseErrorCode2[ParseErrorCode2["InvalidUnicode"]=14]="InvalidUnicode";ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"]=15]="InvalidEscapeCharacter";ParseErrorCode2[ParseErrorCode2["InvalidCharacter"]=16]="InvalidCharacter"})(ParseErrorCode||(ParseErrorCode={}));function printParseErrorCode(code){switch(code){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}__name(printParseErrorCode,"printParseErrorCode");function modify(text,path3,value,options){return setProperty(text,path3,value,options)}__name(modify,"modify");function applyEdits(text,edits){let sortedEdits=edits.slice(0).sort((a,b)=>{const diff=a.offset-b.offset;if(diff===0){return a.length-b.length}return diff});let lastModifiedOffset=text.length;for(let i=sortedEdits.length-1;i>=0;i--){let e=sortedEdits[i];if(e.offset+e.length<=lastModifiedOffset){text=applyEdit(text,e)}else{throw new Error("Overlapping edit")}lastModifiedOffset=e.offset}return text}__name(applyEdits,"applyEdits");init_esbuild_shims();import*as fs from"node:fs";import path from"node:path";function writeWithBackupSync(targetPath,content,options={}){const{backupSuffix=".orig",encoding="utf-8"}=options;const existing=fs.existsSync(targetPath)?fs.statSync(targetPath):void 0;if(existing?.isDirectory()){throw new Error(`Cannot write to '${targetPath}' because it is a directory`)}const workingDirectory=fs.mkdtempSync(`${targetPath}.write-`);const basename=path.basename(targetPath);const tempPath=path.join(workingDirectory,`${basename}.tmp`);const backupPath=path.join(workingDirectory,`${basename}${backupSuffix}`);let backupCreated=false;try{const mode=existing&&fs.lstatSync(targetPath,{throwIfNoEntry:false})?.isFile()?existing.mode&511:void 0;fs.writeFileSync(tempPath,content,{encoding,flag:"wx",flush:true,mode});if(mode!==void 0){try{fs.chmodSync(tempPath,mode)}catch(error){const code=error instanceof Error&&"code"in error?error.code:void 0;if(code!=="ENOSYS"&&code!=="ENOTSUP"&&code!=="EPERM"||(fs.statSync(tempPath).mode&511&~mode)!==0){throw error}}}if(fs.existsSync(targetPath)){try{fs.copyFileSync(targetPath,backupPath,fs.constants.COPYFILE_EXCL);backupCreated=true}catch(backupError){throw new Error(`Failed to backup existing file: ${backupError instanceof Error?backupError.message:String(backupError)}`)}}fs.renameSync(tempPath,targetPath)}catch(error){const recoveryRetained=backupCreated&&!sameContents(backupPath,targetPath);try{if(recoveryRetained){fs.unlinkSync(tempPath)}else{fs.rmSync(workingDirectory,{recursive:true,force:true})}}catch{}if(recoveryRetained){throw new Error(`Failed to write file: ${error instanceof Error?error.message:String(error)}. Recovery copy retained at '${backupPath}'; inspect the current target before restoring it.`)}throw error}try{fs.rmSync(workingDirectory,{recursive:true,force:true})}catch{}}__name(writeWithBackupSync,"writeWithBackupSync");function sameContents(first,second){try{return fs.readFileSync(first).equals(fs.readFileSync(second))}catch{return false}}__name(sameContents,"sameContents");var PARSE_OPTIONS={allowTrailingComma:true};function updateSettingsFilePreservingFormat(filePath,updates,sync=false,replacePath=[]){if(!fs2.existsSync(filePath)){const content=JSON.stringify(updates,null,2);writeWithBackupSync(filePath,content);return true}const originalContent=fs2.readFileSync(filePath,"utf-8");try{parseJsoncObject(originalContent)}catch(_error){writeStderrLine("Error parsing settings file.");writeStderrLine(`Settings file may be corrupted: ${_error instanceof Error?_error.message:String(_error)}`);return false}let updatedContent;try{updatedContent=updateJsoncContent(originalContent,updates,sync,replacePath)}catch(validationError){writeStderrLine("Error: Refusing to write settings file \u2014 the result would not be valid JSON.");writeStderrLine(validationError instanceof Error?validationError.message:String(validationError));return false}writeWithBackupSync(filePath,updatedContent);return true}__name(updateSettingsFilePreservingFormat,"updateSettingsFilePreservingFormat");function parseJsoncObject(content){const errors=[];const root=parseTree2(stripBom(content),errors,PARSE_OPTIONS);if(errors.length>0){const error=errors[0];throw new Error(`${printParseErrorCode(error.error)} at offset ${error.offset}`)}if(root?.type!=="object"){throw new Error("JSONC document root is not a JSON object.")}return JSON.parse(JSON.stringify(getNodeValue2(root)))}__name(parseJsoncObject,"parseJsoncObject");function updateJsoncContent(content,updates,sync=false,replacePath=[]){const bom=content.startsWith("\uFEFF")?"\uFEFF":"";const editableContent=stripBom(content);const parsed=parseJsoncObject(editableContent);const targetWithUndefined=applyUpdates(structuredClone(parsed),updates,sync,replacePath);const target=JSON.parse(JSON.stringify(targetWithUndefined));const options={formattingOptions:detectFormattingOptions(editableContent)};let updated=normalizeDuplicateProperties(editableContent,options);const current=parseJsoncObject(updated);for(const operation of collectOperations(current,target)){if(operation.value===void 0){updated=removeTrailingInlineComment(updated,operation.path)}updated=applyEdits(updated,modify(updated,operation.path,operation.value,options))}const reparsed=parseJsoncObject(updated);if(!isDeepStrictEqual(reparsed,target)){throw new Error("Edited JSONC does not match the intended settings.")}return bom+updated}__name(updateJsoncContent,"updateJsoncContent");function applyUpdates(current,updates,sync=false,replacePath=[],currentPath=[]){const result=current;if(sync){const keysToRemove=Object.keys(result).filter(key=>!Object.hasOwn(updates,key));for(const key of keysToRemove){delete result[key]}}for(const key of Object.getOwnPropertyNames(updates)){if(key==="__proto__"||key==="constructor"||key==="prototype"){continue}const value=updates[key];const nextPath=[...currentPath,key];const valueIsObject=typeof value==="object"&&value!==null&&!Array.isArray(value)&&Object.keys(value).length>0;if(pathsEqual(nextPath,replacePath)){result[key]=valueIsObject?applyUpdates({},value):value;continue}if(valueIsObject&&(typeof result[key]!=="object"||result[key]===null||Array.isArray(result[key]))){result[key]=applyUpdates({},value,sync,replacePath,nextPath)}else if(valueIsObject&&typeof result[key]==="object"&&result[key]!==null&&!Array.isArray(result[key])){result[key]=applyUpdates(result[key],value,sync,replacePath,nextPath)}else{result[key]=value}}return result}__name(applyUpdates,"applyUpdates");function stripBom(content){return content.startsWith("\uFEFF")?content.slice(1):content}__name(stripBom,"stripBom");function isRecord(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}__name(isRecord,"isRecord");function detectFormattingOptions(content){const root=parseTree2(content,[],PARSE_OPTIONS);const firstKey=root?.children?.[0]?.children?.[0];const lineStart=firstKey===void 0?-1:content.lastIndexOf("\n",firstKey.offset-1);const candidate=firstKey===void 0?void 0:content.slice(lineStart+1,firstKey.offset);const indentation=candidate!==void 0&&/^[ \t]*$/.test(candidate)?candidate:" ";return{eol:content.includes("\r\n")?"\r\n":"\n",insertSpaces:!indentation.startsWith(" "),tabSize:indentation.startsWith(" ")?1:indentation.length,insertFinalNewline:content.endsWith("\n")}}__name(detectFormattingOptions,"detectFormattingOptions");function collectOperations(current,target,path3=[],operations=[]){for(const key of Object.keys(current)){if(!Object.hasOwn(target,key)){operations.push({path:[...path3,key],value:void 0})}}for(const key of Object.keys(target)){const nextPath=[...path3,key];if(!Object.hasOwn(current,key)){operations.push({path:nextPath,value:target[key]})}else if(isRecord(current[key])&&isRecord(target[key])){collectOperations(current[key],target[key],nextPath,operations)}else if(!isDeepStrictEqual(current[key],target[key])){operations.push({path:nextPath,value:target[key]})}}return operations}__name(collectOperations,"collectOperations");function findDuplicateProperty(node,path3=[]){if(node.type!=="object"||node.children===void 0){return void 0}const properties=new Map;for(const property of node.children){const keyNode=property.children?.[0];const key=keyNode?.value;if(typeof key!=="string"||keyNode===void 0){continue}const previous=properties.get(key);if(previous!==void 0){return{objectPath:[...path3],keyNode:previous,propertyNames:new Set(properties.keys())}}properties.set(key,keyNode)}for(const property of node.children){const key=property.children?.[0]?.value;const valueNode=property.children?.[1];if(typeof key!=="string"||valueNode===void 0){continue}const duplicate=findDuplicateProperty(valueNode,[...path3,key]);if(duplicate!==void 0){return duplicate}}return void 0}__name(findDuplicateProperty,"findDuplicateProperty");function normalizeDuplicateProperties(content,options){let normalized=content;let duplicateIndex=0;while(true){const root=parseTree2(normalized,[],PARSE_OPTIONS);if(root===void 0){return normalized}const duplicate=findDuplicateProperty(root);if(duplicate===void 0){return normalized}let temporaryKey;do{temporaryKey=`__qwen_duplicate_${duplicateIndex}`;duplicateIndex+=1}while(duplicate.propertyNames.has(temporaryKey));let renamed=normalized.slice(0,duplicate.keyNode.offset)+JSON.stringify(temporaryKey)+normalized.slice(duplicate.keyNode.offset+duplicate.keyNode.length);renamed=removeTrailingInlineComment(renamed,[...duplicate.objectPath,temporaryKey]);normalized=applyEdits(renamed,modify(renamed,[...duplicate.objectPath,temporaryKey],void 0,options))}}__name(normalizeDuplicateProperties,"normalizeDuplicateProperties");function removeTrailingInlineComment(content,path3){const root=parseTree2(content,[],PARSE_OPTIONS);if(root===void 0){return content}const node=findNodeAtLocation2(root,[...path3]);if(node===void 0){return content}const tail=content.slice(node.offset+node.length);const match=tail.match(/^[ \t]*(?:,[ \t]*)?(\/\/[^\r\n]*|\/\*[\s\S]*?\*\/)/);const comment=match?.[1];if(comment===void 0||match===null){return content}const commentOffset=node.offset+node.length+match[0].indexOf(comment);return content.slice(0,commentOffset)+content.slice(commentOffset+comment.length)}__name(removeTrailingInlineComment,"removeTrailingInlineComment");function pathsEqual(left,right){return left.length===right.length&&left.every((segment,index)=>segment===right[index])}__name(pathsEqual,"pathsEqual");var debugLogger=createDebugLogger("TRUSTED_FOLDERS");var TRUSTED_FOLDERS_FILENAME="trustedFolders.json";function getTrustedFoldersPath(){if(process.env["QWEN_CODE_TRUSTED_FOLDERS_PATH"]){return process.env["QWEN_CODE_TRUSTED_FOLDERS_PATH"]}return path2.join(Storage.getGlobalQwenDir(),TRUSTED_FOLDERS_FILENAME)}__name(getTrustedFoldersPath,"getTrustedFoldersPath");var TrustLevel=(TrustLevel2=>{TrustLevel2["TRUST_FOLDER"]="TRUST_FOLDER";TrustLevel2["TRUST_PARENT"]="TRUST_PARENT";TrustLevel2["DO_NOT_TRUST"]="DO_NOT_TRUST";return TrustLevel2})(TrustLevel||{});var trustedFoldersChangeListeners=new Set;function onTrustedFoldersChanged(listener){trustedFoldersChangeListeners.add(listener);return()=>trustedFoldersChangeListeners.delete(listener)}__name(onTrustedFoldersChanged,"onTrustedFoldersChanged");function notifyTrustedFoldersChanged(){for(const listener of trustedFoldersChangeListeners)listener()}__name(notifyTrustedFoldersChanged,"notifyTrustedFoldersChanged");var LoadedTrustedFolders=class{constructor(user,errors){this.user=user;this.errors=errors}static{__name(this,"LoadedTrustedFolders")}get rules(){return Object.entries(this.user.config).map(([path3,trustLevel])=>({path:path3,trustLevel}))}isPathTrusted(location){return resolveTrustDecision(buildTrustPrecedenceRules(this.rules),getPathComparisonVariants(location))}setValue(path3,trustLevel,preserveExistingTrust=false){const committedConfig=writeTrustedFolders(this.user.path,diskConfig=>{const existing=diskConfig[path3];if(preserveExistingTrust&&(existing==="TRUST_FOLDER"||existing==="TRUST_PARENT")){return diskConfig}return{...diskConfig,[path3]:trustLevel}});this.user.config=committedConfig;notifyTrustedFoldersChanged()}};var loadedTrustedFolders;function resetTrustedFoldersForTesting(){loadedTrustedFolders=void 0}__name(resetTrustedFoldersForTesting,"resetTrustedFoldersForTesting");function loadTrustedFolders(){if(loadedTrustedFolders){return loadedTrustedFolders}const errors=[];let userConfig={};const userPath=getTrustedFoldersPath();try{if(fs3.existsSync(userPath)){const content=fs3.readFileSync(userPath,"utf-8");userConfig=parseJsoncObject(content)}}catch(error){errors.push({message:error instanceof Error&&error.message==="JSONC document root is not a JSON object."?"Trusted folders file is not a valid JSON object.":getErrorMessage(error),path:userPath})}loadedTrustedFolders=new LoadedTrustedFolders({path:userPath,config:userConfig},errors);return loadedTrustedFolders}__name(loadTrustedFolders,"loadTrustedFolders");function saveTrustedFolders(trustedFoldersFile){writeTrustedFolders(trustedFoldersFile.path,()=>({...trustedFoldersFile.config}))}__name(saveTrustedFolders,"saveTrustedFolders");function assertTrustedFoldersConfig(config){for(const[rulePath,trustLevel]of Object.entries(config)){if(!Object.values(TrustLevel).includes(trustLevel)){throw new FatalConfigError(`Invalid trusted folder rule for ${JSON.stringify(rulePath)}.`)}}}__name(assertTrustedFoldersConfig,"assertTrustedFoldersConfig");function writeTrustedFolders(filePath,update){const dirPath=path2.dirname(filePath);if(!fs3.existsSync(dirPath)){fs3.mkdirSync(dirPath,{recursive:true})}const release=import_proper_lockfile.default.lockSync(filePath,{realpath:false,stale:1e4,onCompromised:__name(err=>{debugLogger.warn("trusted folders lock compromised:",err)},"onCompromised")});try{let originalContent="{}";if(fs3.existsSync(filePath)){const stat=fs3.lstatSync(filePath);if(stat.isSymbolicLink()||!stat.isFile()){throw new FatalConfigError("Trusted folders path must be a regular file.")}originalContent=fs3.readFileSync(filePath,"utf-8")}let parsed;try{parsed=parseJsoncObject(originalContent)}catch(error){if(error instanceof Error&&error.message==="JSONC document root is not a JSON object."){throw new FatalConfigError("Trusted folders file is not a valid JSON object.")}throw error}const diskConfig=Object.fromEntries(Object.entries(parsed));assertTrustedFoldersConfig(diskConfig);const nextConfig=update({...diskConfig});assertTrustedFoldersConfig(nextConfig);const content=updateJsoncContent(originalContent,nextConfig,true);atomicWriteFileSync(filePath,content,{encoding:"utf-8",mode:384,forceMode:true,noFollow:true});return nextConfig}finally{try{release()}catch{}}}__name(writeTrustedFolders,"writeTrustedFolders");function isFolderTrustEnabled(settings){const folderTrustSetting=settings.security?.folderTrust?.enabled??false;return folderTrustSetting}__name(isFolderTrustEnabled,"isFolderTrustEnabled");function getExplicitTrustLevel(trustConfig,workspaceCwd){const winner=resolveTrustRule(buildTrustPrecedenceRules(Object.entries(trustConfig).map(([rulePath,trustLevel])=>({path:rulePath,trustLevel}))),getPathComparisonVariants(workspaceCwd));return winner?.payload??null}__name(getExplicitTrustLevel,"getExplicitTrustLevel");function loadTrustedFoldersWithOverrides(trustConfig){const folders=loadTrustedFolders();if(folders.errors.length>0){const errorMessages=folders.errors.map(error=>`Error in ${error.path}: ${error.message}`);throw new FatalConfigError(`${errorMessages.join("\n")}
|
|
4
4
|
Please fix the configuration file and try again.`)}if(trustConfig){return new LoadedTrustedFolders({...folders.user,config:trustConfig},folders.errors)}return folders}__name(loadTrustedFoldersWithOverrides,"loadTrustedFoldersWithOverrides");function trustStatusToResult(status){if(status.effective.source==="disabled"){return{isTrusted:true,source:void 0}}return{isTrusted:status.effective.state==="trusted"?true:status.effective.state==="untrusted"?false:void 0,source:status.effective.source==="file"||status.effective.source==="ide"?status.effective.source:void 0}}__name(trustStatusToResult,"trustStatusToResult");function getWorkspaceTrustStatus(settings,workspaceCwd,trustConfig){if(!isFolderTrustEnabled(settings)){return{v:1,workspaceCwd,folderTrustEnabled:false,effective:{state:"trusted",source:"disabled"},explicitTrustLevel:null,requiresDaemonRestartForChanges:true}}const ideTrust=ideContextStore.get()?.workspaceState?.isTrusted;if(ideTrust!==void 0&&arePathsEquivalent(workspaceCwd,process.cwd())){return{v:1,workspaceCwd,folderTrustEnabled:true,effective:{state:ideTrust?"trusted":"untrusted",source:"ide"},explicitTrustLevel:null,requiresDaemonRestartForChanges:true}}const folders=loadTrustedFoldersWithOverrides(trustConfig);const isTrusted=folders.isPathTrusted(workspaceCwd);const state=isTrusted===true?"trusted":isTrusted===false?"untrusted":"unknown";return{v:1,workspaceCwd,folderTrustEnabled:true,effective:{state,source:isTrusted===void 0?"none":"file"},explicitTrustLevel:getExplicitTrustLevel(folders.user.config,workspaceCwd),requiresDaemonRestartForChanges:true}}__name(getWorkspaceTrustStatus,"getWorkspaceTrustStatus");function isWorkspaceTrusted(settings,trustConfig,workspacePath){if(!isFolderTrustEnabled(settings)){return{isTrusted:true,source:void 0}}const ideTrust=ideContextStore.get()?.workspaceState?.isTrusted;if(ideTrust!==void 0&&(workspacePath===void 0||arePathsEquivalent(workspacePath,process.cwd()))){return{isTrusted:ideTrust,source:"ide"}}return trustStatusToResult(getWorkspaceTrustStatus(settings,workspacePath??process.cwd(),trustConfig))}__name(isWorkspaceTrusted,"isWorkspaceTrusted");export{writeWithBackupSync,updateSettingsFilePreservingFormat,parseJsoncObject,TRUSTED_FOLDERS_FILENAME,getTrustedFoldersPath,TrustLevel,onTrustedFoldersChanged,LoadedTrustedFolders,resetTrustedFoldersForTesting,loadTrustedFolders,saveTrustedFolders,isFolderTrustEnabled,getExplicitTrustLevel,getWorkspaceTrustStatus,isWorkspaceTrusted};
|
|
5
5
|
/**
|
|
6
6
|
* @license
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{BaseJsonOutputAdapter}from"./chunk-
|
|
3
|
+
import{BaseJsonOutputAdapter}from"./chunk-IYFUH3JB.js";import{observeHeadlessJsonToolResultWire}from"./chunk-5XAVUYY6.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var JsonOutputAdapter=class extends BaseJsonOutputAdapter{static{__name(this,"JsonOutputAdapter")}messages=[];attemptMessageCheckpoint=0;lastAssistantMessageAtAttemptStart=null;constructor(config){super(config)}emitMessageImpl(message){this.messages.push(message);if(typeof message==="object"&&message!==null&&"type"in message&&message.type==="assistant"){this.updateLastAssistantMessage(message)}}shouldEmitStreamEvents(){return false}startAssistantMessage(){this.attemptMessageCheckpoint=this.messages.length;this.lastAssistantMessageAtAttemptStart=this.lastAssistantMessage;super.startAssistantMessage()}restartAttempt(preserveText,discardedToolCalls){if(preserveText){const discardedIds=new Set(discardedToolCalls.map(request=>request.callId));if(discardedIds.size>0){const retained=this.messages.slice(this.attemptMessageCheckpoint).filter(message=>message.type!=="assistant"||!message.message.content.some(block=>block.type==="tool_use"&&discardedIds.has(block.id)));this.messages.splice(this.attemptMessageCheckpoint,this.messages.length-this.attemptMessageCheckpoint,...retained);this.lastAssistantMessage=this.messages.findLast(message=>message.type==="assistant")??this.lastAssistantMessageAtAttemptStart}}else{const retained=this.messages.slice(this.attemptMessageCheckpoint).filter(message=>message.type!=="assistant");this.messages.splice(this.attemptMessageCheckpoint,this.messages.length-this.attemptMessageCheckpoint,...retained);this.lastAssistantMessage=this.lastAssistantMessageAtAttemptStart}super.restartAttempt(preserveText,discardedToolCalls)}finalizeAssistantMessage(){return this.finalizeAssistantMessageInternal(this.mainAgentMessageState,null)}emitResult(options){const resultMessage=this.buildResultMessage(options,this.lastAssistantMessage);this.messages.push(resultMessage);if(this.config.getOutputFormat()==="text"){if(resultMessage.is_error){process.stderr.write(`${resultMessage.error?.message||""}
|
|
4
4
|
`)}else{process.stdout.write(`${resultMessage.result}
|
|
5
5
|
`)}}else{const json=JSON.stringify(this.messages);const frame=`${json}
|
|
6
6
|
`;observeHeadlessJsonToolResultWire(this.messages,frame);process.stdout.write(frame)}}emitMessage(message){this.messages.push(message)}};export{JsonOutputAdapter};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{createWorkspaceRuntimeSessionService}from"./chunk-CD6C4OHZ.js";import{parseCallerSuppliedSessionId}from"./chunk-LGFF5PJA.js";import{isInternalWorkspaceRuntime}from"./chunk-M5KJJE2X.js";import{canonicalizeWorkspace}from"./chunk-L5UULTGF.js";import{isWithinRoot}from"./chunk-IDXJIDME.js";import{WORKTREE_SESSION_FILE,gitEnv}from"./chunk-LLX4BCWK.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import*as fs from"node:fs";import*as fsPromises from"node:fs/promises";import path from"node:path";import{execFile}from"node:child_process";import{promisify}from"node:util";var execFileAsync=promisify(execFile);function isGitProbeInfrastructureError(error){const failure=error;return failure.killed===true||typeof failure.code==="string"&&["ENOENT","EACCES","EAGAIN","ENOMEM","ETIMEDOUT"].includes(failure.code)}__name(isGitProbeInfrastructureError,"isGitProbeInfrastructureError");async function isGitInfrastructureFault(error,cwd){if(!isGitProbeInfrastructureError(error))return false;const code=error.code;if(code!=="ENOENT"&&code!=="EACCES")return true;try{await fsPromises.access(cwd,fs.constants.X_OK);return true}catch{return false}}__name(isGitInfrastructureFault,"isGitInfrastructureFault");function resolveWorkspaceEntryFromParam(registry,req,res,paramName="workspace"){const selector=req.params[paramName]??"";const entry=resolveWorkspaceEntryBySelector(registry,selector);if(entry)return entry;if(!isPortableAbsolutePath(selector)){res.status(400).json({error:`\`:${paramName}\` must decode to a workspace id or absolute path`,code:"workspace_mismatch"});return null}sendWorkspaceMismatch(res,registry);return null}__name(resolveWorkspaceEntryFromParam,"resolveWorkspaceEntryFromParam");function resolveWorkspaceEntryBySelector(registry,selector){const byId=registry.getEntryByWorkspaceId(selector);if(byId)return byId;if(!isPortableAbsolutePath(selector))return void 0;const exact=registry.getEntryByWorkspaceCwd(selector);if(exact)return exact;if(path.isAbsolute(selector)&&!isUncPath(selector)){try{const canonicalSelector=canonicalizeWorkspace(selector);const canonicalMatch=registry.getEntryByWorkspaceCwd(canonicalSelector);if(canonicalMatch)return canonicalMatch;for(const candidate of registry.listEntries()){if(canonicalizeWorkspace(candidate.workspaceCwd)===canonicalSelector){return candidate}}}catch{}}const normalizedSelector=normalizePortableAbsolutePath(selector);return registry.listEntries().find(candidate=>normalizePortableAbsolutePath(candidate.workspaceCwd)===normalizedSelector)}__name(resolveWorkspaceEntryBySelector,"resolveWorkspaceEntryBySelector");function isPortableAbsolutePath(value){return path.isAbsolute(value)||/^[A-Za-z]:[\\/]/.test(value)||/^\\\\[^\\]+\\[^\\]+/.test(value)}__name(isPortableAbsolutePath,"isPortableAbsolutePath");function isUncPath(value){return/^\\\\[^\\]+\\[^\\]+/.test(value)}__name(isUncPath,"isUncPath");function normalizePortableAbsolutePath(value){if(/^[A-Za-z]:[\\/]/.test(value)||/^\\\\[^\\]+\\[^\\]+/.test(value)){return path.win32.normalize(value).toLowerCase()}return path.resolve(value)}__name(normalizePortableAbsolutePath,"normalizePortableAbsolutePath");function resolveRegisteredWorkspaceRuntimeByPathSelector(registry,selector){const exact=registry.getByWorkspaceCwd(selector);if(exact)return exact;if(path.isAbsolute(selector)&&!isUncPath(selector)){try{const canonicalSelector=canonicalizeWorkspace(selector);const canonicalMatch=registry.getByWorkspaceCwd(canonicalSelector);if(canonicalMatch)return canonicalMatch;for(const runtime of registry.list()){if(canonicalizeWorkspace(runtime.workspaceCwd)===canonicalSelector){return runtime}}}catch{}}const normalizedSelector=normalizePortableAbsolutePath(selector);return registry.list().find(runtime=>normalizePortableAbsolutePath(runtime.workspaceCwd)===normalizedSelector)}__name(resolveRegisteredWorkspaceRuntimeByPathSelector,"resolveRegisteredWorkspaceRuntimeByPathSelector");function resolveManagedWorkspaceRuntimeByPathSelector(registry,selector){const exact=registry.getManagedByWorkspaceCwd(selector);if(exact&&!isInternalWorkspaceRuntime(exact))return exact;if(path.isAbsolute(selector)&&!isUncPath(selector)){try{const canonicalSelector=canonicalizeWorkspace(selector);const canonicalMatch=registry.getManagedByWorkspaceCwd(canonicalSelector);if(canonicalMatch&&!isInternalWorkspaceRuntime(canonicalMatch)){return canonicalMatch}for(const runtime of registry.listManaged()){if(isInternalWorkspaceRuntime(runtime))continue;if(canonicalizeWorkspace(runtime.workspaceCwd)===canonicalSelector){return runtime}}}catch{}}const normalizedSelector=normalizePortableAbsolutePath(selector);return registry.listManaged().find(runtime=>!isInternalWorkspaceRuntime(runtime)&&normalizePortableAbsolutePath(runtime.workspaceCwd)===normalizedSelector)}__name(resolveManagedWorkspaceRuntimeByPathSelector,"resolveManagedWorkspaceRuntimeByPathSelector");function resolveWorkspaceRuntimeFromParam(registry,req,res,paramName="workspace"){const entry=resolveWorkspaceEntryFromParam(registry,req,res,paramName);if(!entry)return null;const runtime=entry.state==="active"?entry.current?.runtime:void 0;if(!runtime){sendWorkspaceRuntimeUnavailable(res,entry);return null}return runtime}__name(resolveWorkspaceRuntimeFromParam,"resolveWorkspaceRuntimeFromParam");function resolveTrustedRuntime(registry,req,res,paramName="workspace"){const runtime=resolveWorkspaceRuntimeFromParam(registry,req,res,paramName);if(!runtime)return null;return requireTrustedWorkspaceRuntime(runtime,res)?runtime:null}__name(resolveTrustedRuntime,"resolveTrustedRuntime");function resolveWorkspaceRuntimeWithLiveCompatibilityFromParam(registry,req,res,paramName="workspace"){if(typeof registry.getManagedEntryByWorkspaceId!=="function"||typeof registry.getManagedEntryByWorkspaceCwd!=="function"){return resolveWorkspaceRuntimeFromParam(registry,req,res,paramName)}const selector=req.params[paramName]??"";let entry=registry.getManagedEntryByWorkspaceId(selector);if(!entry&&isPortableAbsolutePath(selector)){entry=registry.getManagedEntryByWorkspaceCwd(selector)}if(!entry?.internal){return resolveWorkspaceRuntimeFromParam(registry,req,res,paramName)}const runtime=entry.state==="active"?entry.current?.runtime:void 0;if(!runtime){sendConversationRuntimeUnavailable(res);return null}return runtime}__name(resolveWorkspaceRuntimeWithLiveCompatibilityFromParam,"resolveWorkspaceRuntimeWithLiveCompatibilityFromParam");function sendConversationRuntimeUnavailable(res){res.set("Retry-After","1");res.status(503).json({error:"The Conversations runtime is temporarily unavailable.",code:"conversation_runtime_unavailable",retryable:true})}__name(sendConversationRuntimeUnavailable,"sendConversationRuntimeUnavailable");function sendWorkspaceRuntimeUnavailable(res,entry){res.set("Retry-After","1");res.status(503).json({error:"Workspace runtime is not active.",code:"workspace_runtime_unavailable",...entry?{workspaceCwd:entry.workspaceCwd,workspaceId:entry.workspaceId}:{}})}__name(sendWorkspaceRuntimeUnavailable,"sendWorkspaceRuntimeUnavailable");function isGenerationClosedError(error){return Boolean(error&&typeof error==="object"&&"code"in error&&error.code==="workspace_generation_closed")}__name(isGenerationClosedError,"isGenerationClosedError");function sendGenerationClosedError(res,error){if(!isGenerationClosedError(error))return false;sendWorkspaceRuntimeUnavailable(res);return true}__name(sendGenerationClosedError,"sendGenerationClosedError");function resolveManagedWorkspaceRuntimeFromParam(registry,req,res,paramName="workspace"){const selector=req.params[paramName]??"";const byId=registry.getManagedByWorkspaceId(selector);if(byId&&!isInternalWorkspaceRuntime(byId))return byId;if(!isPortableAbsolutePath(selector)){res.status(400).json({error:`\`:${paramName}\` must decode to a workspace id or absolute path`,code:"workspace_mismatch"});return null}const runtime=resolveManagedWorkspaceRuntimeByPathSelector(registry,selector);if(!runtime){res.status(400).json({error:"Workspace mismatch: the requested workspace is not registered with this daemon.",code:"workspace_mismatch"});return null}return runtime}__name(resolveManagedWorkspaceRuntimeFromParam,"resolveManagedWorkspaceRuntimeFromParam");function requireTrustedWorkspaceRuntime(runtime,res){if(runtime.trusted)return true;sendUntrustedWorkspaceResponse(res);return false}__name(requireTrustedWorkspaceRuntime,"requireTrustedWorkspaceRuntime");function sendUntrustedWorkspaceResponse(res,extra){res.status(403).json({error:"Workspace is not trusted.",code:"untrusted_workspace",...extra})}__name(sendUntrustedWorkspaceResponse,"sendUntrustedWorkspaceResponse");function getWorkspaceRouteContext(req){return req.workspaceRouteContext}__name(getWorkspaceRouteContext,"getWorkspaceRouteContext");function setWorkspaceRouteContext(req,context){req.workspaceRouteContext=context}__name(setWorkspaceRouteContext,"setWorkspaceRouteContext");function sendWorkspaceMismatch(res,registry){res.status(400).json({error:"Workspace mismatch: the requested workspace is not registered with this daemon.",code:"workspace_mismatch",workspaceCount:registry.listEntries().length})}__name(sendWorkspaceMismatch,"sendWorkspaceMismatch");function resolveContainedCwd(req,workspaceCwd){const rawCwd=req.query["cwd"];if(typeof rawCwd!=="string"||rawCwd.length===0){return workspaceCwd}try{const resolved=fs.realpathSync(path.resolve(rawCwd));const root=fs.realpathSync(workspaceCwd);if(isWithinRoot(resolved,root)){return resolved}}catch{}return workspaceCwd}__name(resolveContainedCwd,"resolveContainedCwd");function resolveContainedCwdOrFail(req,workspaceCwd){const rawCwd=req.query["cwd"];if(rawCwd===void 0){return workspaceCwd}if(typeof rawCwd!=="string"||rawCwd.length===0){return null}try{const resolved=fs.realpathSync(path.resolve(rawCwd));const root=fs.realpathSync(workspaceCwd);if(isWithinRoot(resolved,root)){return resolved}}catch{}return null}__name(resolveContainedCwdOrFail,"resolveContainedCwdOrFail");async function resolveGitCommonDir(cwd){let stdout;try{({stdout}=await execFileAsync("git",["rev-parse","--git-common-dir"],{cwd,encoding:"utf8",timeout:3e4,env:gitEnv()}))}catch(error){if(await isGitInfrastructureFault(error,cwd))throw error;return null}return fsPromises.realpath(path.resolve(cwd,stdout.trim())).catch(()=>null)}__name(resolveGitCommonDir,"resolveGitCommonDir");async function resolveAbsoluteGitDir(cwd){let stdout;try{({stdout}=await execFileAsync("git",["rev-parse","--absolute-git-dir"],{cwd,encoding:"utf8",timeout:3e4,env:gitEnv()}))}catch(error){if(await isGitInfrastructureFault(error,cwd))throw error;return null}return fsPromises.realpath(stdout.trim()).catch(()=>null)}__name(resolveAbsoluteGitDir,"resolveAbsoluteGitDir");async function readBoundedRegularFile(filePath,maxBytes,options){const pathStat=await fsPromises.lstat(filePath);if(!pathStat.isFile()||!options?.allowHardLinks&&pathStat.nlink!==1||pathStat.size>maxBytes){return null}const handle=await fsPromises.open(filePath,fs.constants.O_RDONLY|(fs.constants.O_NOFOLLOW??0));try{const openedStat=await handle.stat();if(!openedStat.isFile()||!options?.allowHardLinks&&openedStat.nlink!==1||openedStat.dev!==pathStat.dev||openedStat.ino!==pathStat.ino||openedStat.size>maxBytes){return null}const buffer=Buffer.alloc(maxBytes+1);let bytesRead=0;while(bytesRead<buffer.length){const chunk=await handle.read(buffer,bytesRead,buffer.length-bytesRead,bytesRead);if(chunk.bytesRead===0)break;bytesRead+=chunk.bytesRead}if(bytesRead>maxBytes)return null;const finalStat=await fsPromises.lstat(filePath);if(!finalStat.isFile()||!options?.allowHardLinks&&finalStat.nlink!==1||finalStat.dev!==openedStat.dev||finalStat.ino!==openedStat.ino){return null}return buffer.subarray(0,bytesRead).toString("utf8")}finally{await handle.close()}}__name(readBoundedRegularFile,"readBoundedRegularFile");async function markerIsOwnedBy(markerPath,sessionId){try{return(await readBoundedRegularFile(markerPath,256))?.trim()===sessionId}catch{return false}}__name(markerIsOwnedBy,"markerIsOwnedBy");async function isLinkedWorktreeOrUnknown(cwd){let stdout;try{({stdout}=await execFileAsync("git",["rev-parse","--git-common-dir","--absolute-git-dir"],{cwd,encoding:"utf8",timeout:3e4,env:gitEnv()}))}catch(error){if(await isGitInfrastructureFault(error,cwd))throw error;const stderr=error.stderr;return!(typeof stderr==="string"&&/not a git repository/i.test(stderr))}const[common,absolute]=stdout.trim().split("\n");if(!common||!absolute)return true;try{const[commonDir,gitDir]=await Promise.all([fsPromises.realpath(path.resolve(cwd,common)),fsPromises.realpath(absolute)]);return commonDir!==gitDir}catch{return true}}__name(isLinkedWorktreeOrUnknown,"isLinkedWorktreeOrUnknown");async function resolveSessionManagedGitCwd(req,runtime){const rawCwd=req.query["cwd"];if(rawCwd===void 0)return runtime.workspaceCwd;if(typeof rawCwd!=="string"||rawCwd.length===0)return null;let requested;let workspace;try{requested=await fsPromises.realpath(path.resolve(rawCwd));workspace=await fsPromises.realpath(runtime.workspaceCwd)}catch{return null}let stdout;try{({stdout}=await execFileAsync("git",["rev-parse","--show-toplevel"],{cwd:workspace,encoding:"utf8",timeout:3e4,env:gitEnv()}))}catch(error){if(isGitProbeInfrastructureError(error))throw error;const stderr=error.stderr;if(typeof stderr==="string"&&/not a git repository/i.test(stderr)&&isWithinRoot(requested,workspace)&&!await isLinkedWorktreeOrUnknown(requested)){return requested}return null}const repoTop=await fsPromises.realpath(stdout.trim()).catch(()=>null);if(repoTop===null)return null;if(requested===workspace)return requested;const managedRoot=path.join(repoTop,".qwen","worktrees");if(isWithinRoot(requested,workspace)&&!isWithinRoot(requested,managedRoot)){if(!await isLinkedWorktreeOrUnknown(requested)){return requested}const[workspaceGitDir,requestedGitDir]=await Promise.all([resolveAbsoluteGitDir(workspace),resolveAbsoluteGitDir(requested)]);if(workspaceGitDir!==null&&requestedGitDir===workspaceGitDir){return requested}}if(!isWithinRoot(requested,managedRoot))return null;const[workspaceCommonDir,requestedCommonDir]=await Promise.all([resolveGitCommonDir(workspace),resolveGitCommonDir(requested)]);if(workspaceCommonDir===null||requestedCommonDir===null||requestedCommonDir!==workspaceCommonDir){return null}try{let rawSessionId=req.query["sessionId"];if(rawSessionId===void 0){const[slug]=path.relative(managedRoot,requested).split(path.sep);if(!slug)return null;rawSessionId=(await readBoundedRegularFile(path.join(managedRoot,slug,WORKTREE_SESSION_FILE),256))?.trim()}const parsedSessionId=parseCallerSuppliedSessionId(rawSessionId);if(parsedSessionId.kind!=="valid")return null;const sessionId=parsedSessionId.sessionId;let snapshot;try{snapshot=runtime.bridge.getSessionExecutionSnapshot(sessionId)}catch{return null}if(await fsPromises.realpath(snapshot.workspaceCwd)!==workspace||!snapshot.worktree){return null}const worktreeRoot=await fsPromises.realpath(snapshot.worktree.path);if(path.dirname(worktreeRoot)!==managedRoot||!isWithinRoot(requested,worktreeRoot)){return null}const sidecarPath=createWorkspaceRuntimeSessionService(runtime).getWorktreeSessionPath(sessionId);const sidecarRaw=await readBoundedRegularFile(sidecarPath,64*1024,{allowHardLinks:true});if(sidecarRaw===null)return null;let sidecar;try{sidecar=JSON.parse(sidecarRaw)}catch{return null}if(!sidecar||typeof sidecar!=="object"||Array.isArray(sidecar)||typeof sidecar["worktreePath"]!=="string"||await fsPromises.realpath(sidecar.worktreePath)!==worktreeRoot){return null}const markerPath=path.join(worktreeRoot,WORKTREE_SESSION_FILE);if(!await markerIsOwnedBy(markerPath,sessionId)){return null}const requestedGitDir=await resolveAbsoluteGitDir(requested);if(requestedGitDir===null)return null;const metadataRoot=await fsPromises.realpath(path.join(workspaceCommonDir,"worktrees"));if(path.dirname(requestedGitDir)!==metadataRoot)return null;const backpointer=await readBoundedRegularFile(path.join(requestedGitDir,"gitdir"),4096);if(backpointer===null)return null;const actualGitFile=await fsPromises.realpath(path.resolve(requestedGitDir,backpointer.trim()));const expectedGitFile=await fsPromises.realpath(path.join(worktreeRoot,".git"));if(actualGitFile!==expectedGitFile)return null;return requested}catch(error){const code=error.code;if(code==="ENOENT"||code==="EACCES"||code==="EPERM"||code==="ELOOP"||code==="ENOTDIR"){return null}throw error}}__name(resolveSessionManagedGitCwd,"resolveSessionManagedGitCwd");async function resolveSessionManagedGitCwdForRoute(req,res,runtime,route,sendBridgeError){let cwd;try{cwd=await resolveSessionManagedGitCwd(req,runtime);runtime.generationGuard?.assertOpen()}catch(error){sendBridgeError(res,error,{route});return void 0}if(cwd===null){res.status(400).json({error:"invalid_cwd",message:"The supplied cwd is invalid or outside the workspace"});return void 0}return cwd}__name(resolveSessionManagedGitCwdForRoute,"resolveSessionManagedGitCwdForRoute");export{resolveWorkspaceEntryFromParam,resolveWorkspaceEntryBySelector,isPortableAbsolutePath,resolveRegisteredWorkspaceRuntimeByPathSelector,resolveManagedWorkspaceRuntimeByPathSelector,resolveWorkspaceRuntimeFromParam,resolveTrustedRuntime,resolveWorkspaceRuntimeWithLiveCompatibilityFromParam,sendConversationRuntimeUnavailable,sendWorkspaceRuntimeUnavailable,isGenerationClosedError,sendGenerationClosedError,resolveManagedWorkspaceRuntimeFromParam,requireTrustedWorkspaceRuntime,sendUntrustedWorkspaceResponse,getWorkspaceRouteContext,setWorkspaceRouteContext,resolveContainedCwd,resolveContainedCwdOrFail,resolveSessionManagedGitCwdForRoute};
|
|
3
|
+
import{createWorkspaceRuntimeSessionService}from"./chunk-7YX6LW5H.js";import{parseCallerSuppliedSessionId}from"./chunk-LGFF5PJA.js";import{isInternalWorkspaceRuntime}from"./chunk-M5KJJE2X.js";import{canonicalizeWorkspace}from"./chunk-L5UULTGF.js";import{isWithinRoot}from"./chunk-IDXJIDME.js";import{WORKTREE_SESSION_FILE,gitEnv}from"./chunk-LLX4BCWK.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import*as fs from"node:fs";import*as fsPromises from"node:fs/promises";import path from"node:path";import{execFile}from"node:child_process";import{promisify}from"node:util";var execFileAsync=promisify(execFile);function isGitProbeInfrastructureError(error){const failure=error;return failure.killed===true||typeof failure.code==="string"&&["ENOENT","EACCES","EAGAIN","ENOMEM","ETIMEDOUT"].includes(failure.code)}__name(isGitProbeInfrastructureError,"isGitProbeInfrastructureError");async function isGitInfrastructureFault(error,cwd){if(!isGitProbeInfrastructureError(error))return false;const code=error.code;if(code!=="ENOENT"&&code!=="EACCES")return true;try{await fsPromises.access(cwd,fs.constants.X_OK);return true}catch{return false}}__name(isGitInfrastructureFault,"isGitInfrastructureFault");function resolveWorkspaceEntryFromParam(registry,req,res,paramName="workspace"){const selector=req.params[paramName]??"";const entry=resolveWorkspaceEntryBySelector(registry,selector);if(entry)return entry;if(!isPortableAbsolutePath(selector)){res.status(400).json({error:`\`:${paramName}\` must decode to a workspace id or absolute path`,code:"workspace_mismatch"});return null}sendWorkspaceMismatch(res,registry);return null}__name(resolveWorkspaceEntryFromParam,"resolveWorkspaceEntryFromParam");function resolveWorkspaceEntryBySelector(registry,selector){const byId=registry.getEntryByWorkspaceId(selector);if(byId)return byId;if(!isPortableAbsolutePath(selector))return void 0;const exact=registry.getEntryByWorkspaceCwd(selector);if(exact)return exact;if(path.isAbsolute(selector)&&!isUncPath(selector)){try{const canonicalSelector=canonicalizeWorkspace(selector);const canonicalMatch=registry.getEntryByWorkspaceCwd(canonicalSelector);if(canonicalMatch)return canonicalMatch;for(const candidate of registry.listEntries()){if(canonicalizeWorkspace(candidate.workspaceCwd)===canonicalSelector){return candidate}}}catch{}}const normalizedSelector=normalizePortableAbsolutePath(selector);return registry.listEntries().find(candidate=>normalizePortableAbsolutePath(candidate.workspaceCwd)===normalizedSelector)}__name(resolveWorkspaceEntryBySelector,"resolveWorkspaceEntryBySelector");function isPortableAbsolutePath(value){return path.isAbsolute(value)||/^[A-Za-z]:[\\/]/.test(value)||/^\\\\[^\\]+\\[^\\]+/.test(value)}__name(isPortableAbsolutePath,"isPortableAbsolutePath");function isUncPath(value){return/^\\\\[^\\]+\\[^\\]+/.test(value)}__name(isUncPath,"isUncPath");function normalizePortableAbsolutePath(value){if(/^[A-Za-z]:[\\/]/.test(value)||/^\\\\[^\\]+\\[^\\]+/.test(value)){return path.win32.normalize(value).toLowerCase()}return path.resolve(value)}__name(normalizePortableAbsolutePath,"normalizePortableAbsolutePath");function resolveRegisteredWorkspaceRuntimeByPathSelector(registry,selector){const exact=registry.getByWorkspaceCwd(selector);if(exact)return exact;if(path.isAbsolute(selector)&&!isUncPath(selector)){try{const canonicalSelector=canonicalizeWorkspace(selector);const canonicalMatch=registry.getByWorkspaceCwd(canonicalSelector);if(canonicalMatch)return canonicalMatch;for(const runtime of registry.list()){if(canonicalizeWorkspace(runtime.workspaceCwd)===canonicalSelector){return runtime}}}catch{}}const normalizedSelector=normalizePortableAbsolutePath(selector);return registry.list().find(runtime=>normalizePortableAbsolutePath(runtime.workspaceCwd)===normalizedSelector)}__name(resolveRegisteredWorkspaceRuntimeByPathSelector,"resolveRegisteredWorkspaceRuntimeByPathSelector");function resolveManagedWorkspaceRuntimeByPathSelector(registry,selector){const exact=registry.getManagedByWorkspaceCwd(selector);if(exact&&!isInternalWorkspaceRuntime(exact))return exact;if(path.isAbsolute(selector)&&!isUncPath(selector)){try{const canonicalSelector=canonicalizeWorkspace(selector);const canonicalMatch=registry.getManagedByWorkspaceCwd(canonicalSelector);if(canonicalMatch&&!isInternalWorkspaceRuntime(canonicalMatch)){return canonicalMatch}for(const runtime of registry.listManaged()){if(isInternalWorkspaceRuntime(runtime))continue;if(canonicalizeWorkspace(runtime.workspaceCwd)===canonicalSelector){return runtime}}}catch{}}const normalizedSelector=normalizePortableAbsolutePath(selector);return registry.listManaged().find(runtime=>!isInternalWorkspaceRuntime(runtime)&&normalizePortableAbsolutePath(runtime.workspaceCwd)===normalizedSelector)}__name(resolveManagedWorkspaceRuntimeByPathSelector,"resolveManagedWorkspaceRuntimeByPathSelector");function resolveWorkspaceRuntimeFromParam(registry,req,res,paramName="workspace"){const entry=resolveWorkspaceEntryFromParam(registry,req,res,paramName);if(!entry)return null;const runtime=entry.state==="active"?entry.current?.runtime:void 0;if(!runtime){sendWorkspaceRuntimeUnavailable(res,entry);return null}return runtime}__name(resolveWorkspaceRuntimeFromParam,"resolveWorkspaceRuntimeFromParam");function resolveTrustedRuntime(registry,req,res,paramName="workspace"){const runtime=resolveWorkspaceRuntimeFromParam(registry,req,res,paramName);if(!runtime)return null;return requireTrustedWorkspaceRuntime(runtime,res)?runtime:null}__name(resolveTrustedRuntime,"resolveTrustedRuntime");function resolveWorkspaceRuntimeWithLiveCompatibilityFromParam(registry,req,res,paramName="workspace"){if(typeof registry.getManagedEntryByWorkspaceId!=="function"||typeof registry.getManagedEntryByWorkspaceCwd!=="function"){return resolveWorkspaceRuntimeFromParam(registry,req,res,paramName)}const selector=req.params[paramName]??"";let entry=registry.getManagedEntryByWorkspaceId(selector);if(!entry&&isPortableAbsolutePath(selector)){entry=registry.getManagedEntryByWorkspaceCwd(selector)}if(!entry?.internal){return resolveWorkspaceRuntimeFromParam(registry,req,res,paramName)}const runtime=entry.state==="active"?entry.current?.runtime:void 0;if(!runtime){sendConversationRuntimeUnavailable(res);return null}return runtime}__name(resolveWorkspaceRuntimeWithLiveCompatibilityFromParam,"resolveWorkspaceRuntimeWithLiveCompatibilityFromParam");function sendConversationRuntimeUnavailable(res){res.set("Retry-After","1");res.status(503).json({error:"The Conversations runtime is temporarily unavailable.",code:"conversation_runtime_unavailable",retryable:true})}__name(sendConversationRuntimeUnavailable,"sendConversationRuntimeUnavailable");function sendWorkspaceRuntimeUnavailable(res,entry){res.set("Retry-After","1");res.status(503).json({error:"Workspace runtime is not active.",code:"workspace_runtime_unavailable",...entry?{workspaceCwd:entry.workspaceCwd,workspaceId:entry.workspaceId}:{}})}__name(sendWorkspaceRuntimeUnavailable,"sendWorkspaceRuntimeUnavailable");function isGenerationClosedError(error){return Boolean(error&&typeof error==="object"&&"code"in error&&error.code==="workspace_generation_closed")}__name(isGenerationClosedError,"isGenerationClosedError");function sendGenerationClosedError(res,error){if(!isGenerationClosedError(error))return false;sendWorkspaceRuntimeUnavailable(res);return true}__name(sendGenerationClosedError,"sendGenerationClosedError");function resolveManagedWorkspaceRuntimeFromParam(registry,req,res,paramName="workspace"){const selector=req.params[paramName]??"";const byId=registry.getManagedByWorkspaceId(selector);if(byId&&!isInternalWorkspaceRuntime(byId))return byId;if(!isPortableAbsolutePath(selector)){res.status(400).json({error:`\`:${paramName}\` must decode to a workspace id or absolute path`,code:"workspace_mismatch"});return null}const runtime=resolveManagedWorkspaceRuntimeByPathSelector(registry,selector);if(!runtime){res.status(400).json({error:"Workspace mismatch: the requested workspace is not registered with this daemon.",code:"workspace_mismatch"});return null}return runtime}__name(resolveManagedWorkspaceRuntimeFromParam,"resolveManagedWorkspaceRuntimeFromParam");function requireTrustedWorkspaceRuntime(runtime,res){if(runtime.trusted)return true;sendUntrustedWorkspaceResponse(res);return false}__name(requireTrustedWorkspaceRuntime,"requireTrustedWorkspaceRuntime");function sendUntrustedWorkspaceResponse(res,extra){res.status(403).json({error:"Workspace is not trusted.",code:"untrusted_workspace",...extra})}__name(sendUntrustedWorkspaceResponse,"sendUntrustedWorkspaceResponse");function getWorkspaceRouteContext(req){return req.workspaceRouteContext}__name(getWorkspaceRouteContext,"getWorkspaceRouteContext");function setWorkspaceRouteContext(req,context){req.workspaceRouteContext=context}__name(setWorkspaceRouteContext,"setWorkspaceRouteContext");function sendWorkspaceMismatch(res,registry){res.status(400).json({error:"Workspace mismatch: the requested workspace is not registered with this daemon.",code:"workspace_mismatch",workspaceCount:registry.listEntries().length})}__name(sendWorkspaceMismatch,"sendWorkspaceMismatch");function resolveContainedCwd(req,workspaceCwd){const rawCwd=req.query["cwd"];if(typeof rawCwd!=="string"||rawCwd.length===0){return workspaceCwd}try{const resolved=fs.realpathSync(path.resolve(rawCwd));const root=fs.realpathSync(workspaceCwd);if(isWithinRoot(resolved,root)){return resolved}}catch{}return workspaceCwd}__name(resolveContainedCwd,"resolveContainedCwd");function resolveContainedCwdOrFail(req,workspaceCwd){const rawCwd=req.query["cwd"];if(rawCwd===void 0){return workspaceCwd}if(typeof rawCwd!=="string"||rawCwd.length===0){return null}try{const resolved=fs.realpathSync(path.resolve(rawCwd));const root=fs.realpathSync(workspaceCwd);if(isWithinRoot(resolved,root)){return resolved}}catch{}return null}__name(resolveContainedCwdOrFail,"resolveContainedCwdOrFail");async function resolveGitCommonDir(cwd){let stdout;try{({stdout}=await execFileAsync("git",["rev-parse","--git-common-dir"],{cwd,encoding:"utf8",timeout:3e4,env:gitEnv()}))}catch(error){if(await isGitInfrastructureFault(error,cwd))throw error;return null}return fsPromises.realpath(path.resolve(cwd,stdout.trim())).catch(()=>null)}__name(resolveGitCommonDir,"resolveGitCommonDir");async function resolveAbsoluteGitDir(cwd){let stdout;try{({stdout}=await execFileAsync("git",["rev-parse","--absolute-git-dir"],{cwd,encoding:"utf8",timeout:3e4,env:gitEnv()}))}catch(error){if(await isGitInfrastructureFault(error,cwd))throw error;return null}return fsPromises.realpath(stdout.trim()).catch(()=>null)}__name(resolveAbsoluteGitDir,"resolveAbsoluteGitDir");async function readBoundedRegularFile(filePath,maxBytes,options){const pathStat=await fsPromises.lstat(filePath);if(!pathStat.isFile()||!options?.allowHardLinks&&pathStat.nlink!==1||pathStat.size>maxBytes){return null}const handle=await fsPromises.open(filePath,fs.constants.O_RDONLY|(fs.constants.O_NOFOLLOW??0));try{const openedStat=await handle.stat();if(!openedStat.isFile()||!options?.allowHardLinks&&openedStat.nlink!==1||openedStat.dev!==pathStat.dev||openedStat.ino!==pathStat.ino||openedStat.size>maxBytes){return null}const buffer=Buffer.alloc(maxBytes+1);let bytesRead=0;while(bytesRead<buffer.length){const chunk=await handle.read(buffer,bytesRead,buffer.length-bytesRead,bytesRead);if(chunk.bytesRead===0)break;bytesRead+=chunk.bytesRead}if(bytesRead>maxBytes)return null;const finalStat=await fsPromises.lstat(filePath);if(!finalStat.isFile()||!options?.allowHardLinks&&finalStat.nlink!==1||finalStat.dev!==openedStat.dev||finalStat.ino!==openedStat.ino){return null}return buffer.subarray(0,bytesRead).toString("utf8")}finally{await handle.close()}}__name(readBoundedRegularFile,"readBoundedRegularFile");async function markerIsOwnedBy(markerPath,sessionId){try{return(await readBoundedRegularFile(markerPath,256))?.trim()===sessionId}catch{return false}}__name(markerIsOwnedBy,"markerIsOwnedBy");async function isLinkedWorktreeOrUnknown(cwd){let stdout;try{({stdout}=await execFileAsync("git",["rev-parse","--git-common-dir","--absolute-git-dir"],{cwd,encoding:"utf8",timeout:3e4,env:gitEnv()}))}catch(error){if(await isGitInfrastructureFault(error,cwd))throw error;const stderr=error.stderr;return!(typeof stderr==="string"&&/not a git repository/i.test(stderr))}const[common,absolute]=stdout.trim().split("\n");if(!common||!absolute)return true;try{const[commonDir,gitDir]=await Promise.all([fsPromises.realpath(path.resolve(cwd,common)),fsPromises.realpath(absolute)]);return commonDir!==gitDir}catch{return true}}__name(isLinkedWorktreeOrUnknown,"isLinkedWorktreeOrUnknown");async function resolveSessionManagedGitCwd(req,runtime){const rawCwd=req.query["cwd"];if(rawCwd===void 0)return runtime.workspaceCwd;if(typeof rawCwd!=="string"||rawCwd.length===0)return null;let requested;let workspace;try{requested=await fsPromises.realpath(path.resolve(rawCwd));workspace=await fsPromises.realpath(runtime.workspaceCwd)}catch{return null}let stdout;try{({stdout}=await execFileAsync("git",["rev-parse","--show-toplevel"],{cwd:workspace,encoding:"utf8",timeout:3e4,env:gitEnv()}))}catch(error){if(isGitProbeInfrastructureError(error))throw error;const stderr=error.stderr;if(typeof stderr==="string"&&/not a git repository/i.test(stderr)&&isWithinRoot(requested,workspace)&&!await isLinkedWorktreeOrUnknown(requested)){return requested}return null}const repoTop=await fsPromises.realpath(stdout.trim()).catch(()=>null);if(repoTop===null)return null;if(requested===workspace)return requested;const managedRoot=path.join(repoTop,".qwen","worktrees");if(isWithinRoot(requested,workspace)&&!isWithinRoot(requested,managedRoot)){if(!await isLinkedWorktreeOrUnknown(requested)){return requested}const[workspaceGitDir,requestedGitDir]=await Promise.all([resolveAbsoluteGitDir(workspace),resolveAbsoluteGitDir(requested)]);if(workspaceGitDir!==null&&requestedGitDir===workspaceGitDir){return requested}}if(!isWithinRoot(requested,managedRoot))return null;const[workspaceCommonDir,requestedCommonDir]=await Promise.all([resolveGitCommonDir(workspace),resolveGitCommonDir(requested)]);if(workspaceCommonDir===null||requestedCommonDir===null||requestedCommonDir!==workspaceCommonDir){return null}try{let rawSessionId=req.query["sessionId"];if(rawSessionId===void 0){const[slug]=path.relative(managedRoot,requested).split(path.sep);if(!slug)return null;rawSessionId=(await readBoundedRegularFile(path.join(managedRoot,slug,WORKTREE_SESSION_FILE),256))?.trim()}const parsedSessionId=parseCallerSuppliedSessionId(rawSessionId);if(parsedSessionId.kind!=="valid")return null;const sessionId=parsedSessionId.sessionId;let snapshot;try{snapshot=runtime.bridge.getSessionExecutionSnapshot(sessionId)}catch{return null}if(await fsPromises.realpath(snapshot.workspaceCwd)!==workspace||!snapshot.worktree){return null}const worktreeRoot=await fsPromises.realpath(snapshot.worktree.path);if(path.dirname(worktreeRoot)!==managedRoot||!isWithinRoot(requested,worktreeRoot)){return null}const sidecarPath=createWorkspaceRuntimeSessionService(runtime).getWorktreeSessionPath(sessionId);const sidecarRaw=await readBoundedRegularFile(sidecarPath,64*1024,{allowHardLinks:true});if(sidecarRaw===null)return null;let sidecar;try{sidecar=JSON.parse(sidecarRaw)}catch{return null}if(!sidecar||typeof sidecar!=="object"||Array.isArray(sidecar)||typeof sidecar["worktreePath"]!=="string"||await fsPromises.realpath(sidecar.worktreePath)!==worktreeRoot){return null}const markerPath=path.join(worktreeRoot,WORKTREE_SESSION_FILE);if(!await markerIsOwnedBy(markerPath,sessionId)){return null}const requestedGitDir=await resolveAbsoluteGitDir(requested);if(requestedGitDir===null)return null;const metadataRoot=await fsPromises.realpath(path.join(workspaceCommonDir,"worktrees"));if(path.dirname(requestedGitDir)!==metadataRoot)return null;const backpointer=await readBoundedRegularFile(path.join(requestedGitDir,"gitdir"),4096);if(backpointer===null)return null;const actualGitFile=await fsPromises.realpath(path.resolve(requestedGitDir,backpointer.trim()));const expectedGitFile=await fsPromises.realpath(path.join(worktreeRoot,".git"));if(actualGitFile!==expectedGitFile)return null;return requested}catch(error){const code=error.code;if(code==="ENOENT"||code==="EACCES"||code==="EPERM"||code==="ELOOP"||code==="ENOTDIR"){return null}throw error}}__name(resolveSessionManagedGitCwd,"resolveSessionManagedGitCwd");async function resolveSessionManagedGitCwdForRoute(req,res,runtime,route,sendBridgeError){let cwd;try{cwd=await resolveSessionManagedGitCwd(req,runtime);runtime.generationGuard?.assertOpen()}catch(error){sendBridgeError(res,error,{route});return void 0}if(cwd===null){res.status(400).json({error:"invalid_cwd",message:"The supplied cwd is invalid or outside the workspace"});return void 0}return cwd}__name(resolveSessionManagedGitCwdForRoute,"resolveSessionManagedGitCwdForRoute");export{resolveWorkspaceEntryFromParam,resolveWorkspaceEntryBySelector,isPortableAbsolutePath,resolveRegisteredWorkspaceRuntimeByPathSelector,resolveManagedWorkspaceRuntimeByPathSelector,resolveWorkspaceRuntimeFromParam,resolveTrustedRuntime,resolveWorkspaceRuntimeWithLiveCompatibilityFromParam,sendConversationRuntimeUnavailable,sendWorkspaceRuntimeUnavailable,isGenerationClosedError,sendGenerationClosedError,resolveManagedWorkspaceRuntimeFromParam,requireTrustedWorkspaceRuntime,sendUntrustedWorkspaceResponse,getWorkspaceRouteContext,setWorkspaceRouteContext,resolveContainedCwd,resolveContainedCwdOrFail,resolveSessionManagedGitCwdForRoute};
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2026 Qwen Team
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{cancelTask,checkReadiness,cleanTask,collectTask,listTasks,retryTask,runPlan}from"./chunk-2HFU7OGG.js";import{loadUndici}from"./chunk-XKSB7VTV.js";import{collectProviderModelsForProtocol,getAuthTypeFromEnv,resolveCliGenerationConfig}from"./chunk-
|
|
3
|
+
import{cancelTask,checkReadiness,cleanTask,collectTask,listTasks,retryTask,runPlan}from"./chunk-2HFU7OGG.js";import{loadUndici}from"./chunk-XKSB7VTV.js";import{collectProviderModelsForProtocol,getAuthTypeFromEnv,resolveCliGenerationConfig}from"./chunk-FFLFTXO7.js";import{loadSettings}from"./chunk-4WFWZWR3.js";import{normalizeProxyUrl}from"./chunk-IFAUFERF.js";import{isTlsVerificationDisabled}from"./chunk-ZZZAYAJW.js";import{ignoreBrokenPipe,writeStderrLine,writeStdoutLine}from"./chunk-SLPJ4OII.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();init_esbuild_shims();async function resolveProxy(cliProxy,settingsProxy){const proxyUrl=resolveProxyUrl(cliProxy,settingsProxy);if(proxyUrl){const{EnvHttpProxyAgent,setGlobalDispatcher}=await loadUndici();setGlobalDispatcher(new EnvHttpProxyAgent({httpProxy:proxyUrl,httpsProxy:proxyUrl}))}return proxyUrl}__name(resolveProxy,"resolveProxy");function resolveProxyUrl(cliProxy,settingsProxy){return normalizeProxyUrl(cliProxy||settingsProxy||process.env["HTTPS_PROXY"]||process.env["https_proxy"]||process.env["HTTP_PROXY"]||process.env["http_proxy"])}__name(resolveProxyUrl,"resolveProxyUrl");var DEFAULT_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1";function resolveEndpoint(env=process.env,options={}){let settings=options.settings??loadSettings().merged;const batch=settings.batch;if(batch?.model||batch?.authType||batch?.baseUrl){if(!batch.model?.trim()){throw new Error("Set batch.model to a modelProviders model ID.")}if(batch.authType&&batch.authType!=="openai"){throw new Error('batch.authType must be "openai" for DashScope Batch.')}const matches=collectProviderModelsForProtocol(settings.modelProviders,settings.providerProtocol,"openai").filter(provider2=>provider2.id===batch.model&&(!batch.baseUrl||provider2.baseUrl===batch.baseUrl));if(matches.length!==1){throw new Error("batch.model must match exactly one chat-completions modelProviders entry; use batch.baseUrl to disambiguate duplicate IDs.")}const provider=matches[0];if(!provider.baseUrl||!provider.envKey||!env[provider.envKey]){throw new Error("The Batch provider needs baseUrl and an envKey with a non-empty value in settings.env or the environment.")}settings={...settings,model:{name:provider.id,baseUrl:provider.baseUrl},modelProviders:{openai:[provider]},security:{auth:{selectedType:"openai"}}};env={[provider.envKey]:env[provider.envKey]}}const selectedAuthType=settings.security?.auth?.selectedType??getAuthTypeFromEnv(env);if(selectedAuthType!=="openai"){throw new Error(`qwen batch needs an API key (auth type "openai") for a DashScope endpoint; current auth type is "${selectedAuthType??"none"}".`)}const{apiKey,baseUrl,model,warnings,authType,generationConfig}=resolveCliGenerationConfig({argv:{},settings,selectedAuthType,env});if(authType!=="openai"){throw new Error(`qwen batch needs a model on the OpenAI-compatible chat-completions wire; "${model||"the configured model"}" resolves to auth type "${authType??"none"}".`)}if(!apiKey){throw new Error("No API key found: set OPENAI_API_KEY or security.auth.apiKey.")}const warn=options.warn??(message=>writeStderrLine(`warning: ${message}`));for(const warning of warnings??[]){warn(warning)}return{apiKey,baseUrl:(baseUrl||DEFAULT_BASE_URL).replace(/\/+$/,""),model,generationConfig}}__name(resolveEndpoint,"resolveEndpoint");async function prepareEndpoint(env=process.env,cliOptions={}){if(cliOptions.insecure)process.env["QWEN_TLS_INSECURE"]="1";if(isTlsVerificationDisabled()&&process.env["NODE_TLS_REJECT_UNAUTHORIZED"]!=="0"){process.env["NODE_TLS_REJECT_UNAUTHORIZED"]="0";writeStderrLine("WARNING: TLS certificate verification is disabled (--insecure / QWEN_TLS_INSECURE); connections made by this command are vulnerable to man-in-the-middle attacks.")}await resolveProxy(cliOptions.proxy,loadSettings().merged.proxy);return resolveEndpoint(env)}__name(prepareEndpoint,"prepareEndpoint");var cliOptionsOf=__name(argv=>({proxy:argv["proxy"],insecure:argv["insecure"]}),"cliOptionsOf");async function run(fn){try{await fn()}catch(error){writeStderrLine(error instanceof Error?error.message:String(error));process.exitCode=1}await Promise.all([process.stdout,process.stderr].map(stream=>new Promise(resolve=>stream.write("",()=>resolve()))))}__name(run,"run");var LOCK_WAIT_MS=15e3;var workflowDeps=__name(ep=>({ep,cwd:process.cwd(),env:process.env,out:writeStdoutLine,err:writeStderrLine,lockWaitMs:LOCK_WAIT_MS}),"workflowDeps");var runWorkflowCommand={command:"run <plan>",describe:"Run an agent-prepared batch plan: assemble requests, submit, record the task",builder:__name(yargs=>yargs.positional("plan",{describe:"Plan JSON (usually written by the /batch-api skill): shared rules + source/target items",type:"string",demandOption:true}).option("dry-run",{describe:"Assemble and show items, frozen settings and the estimate without uploading; prints a snapshot digest",type:"boolean",default:false}).option("expect",{describe:"Submit only if the batch still matches this snapshot digest from --dry-run",type:"string"}).check(argv=>argv["dry-run"]&&argv["expect"]!==void 0?"--dry-run and --expect cannot be combined":true),"builder"),handler:__name(argv=>run(async()=>{await runPlan(workflowDeps(await prepareEndpoint(process.env,cliOptionsOf(argv))),argv["plan"],{dryRun:argv["dry-run"],expect:argv["expect"]})}),"handler")};var collectWorkflowCommand={command:"collect <task-id>",describe:"Collect a workflow task: reconcile, download, validate, and deliver results",builder:__name(yargs=>yargs.positional("task-id",{describe:"Task id printed by `qwen batch run`",type:"string",demandOption:true}).option("wait",{describe:"Poll (over HTTP, holding no lock) until the batch settles, then collect",type:"boolean",default:false}).option("timeout",{describe:"Seconds to wait with --wait before giving up (default: none)",type:"number"}).check(argv=>argv["timeout"]===void 0||Number.isFinite(argv["timeout"])&&argv["timeout"]>0?true:"--timeout must be a positive number of seconds"),"builder"),handler:__name(argv=>run(async()=>{await collectTask(workflowDeps(await prepareEndpoint(process.env,cliOptionsOf(argv))),argv["task-id"],{wait:argv["wait"],timeoutSeconds:argv["timeout"]})}),"handler")};var retryWorkflowCommand={command:"retry <task-id>",describe:"Resubmit only the failed items of a workflow task",builder:__name(yargs=>yargs.positional("task-id",{describe:"Task id",type:"string",demandOption:true}).option("max-output-tokens",{describe:"Output limit for the new attempt; required to resend items that were truncated",type:"number"}).check(argv=>argv["max-output-tokens"]===void 0||Number.isInteger(argv["max-output-tokens"])&&argv["max-output-tokens"]>0?true:"--max-output-tokens must be a positive integer"),"builder"),handler:__name(argv=>run(async()=>{await retryTask(workflowDeps(await prepareEndpoint(process.env,cliOptionsOf(argv))),argv["task-id"],{maxOutputTokens:argv["max-output-tokens"]})}),"handler")};var cleanWorkflowCommand={command:"clean <task-id>",describe:"Delete a workflow task's local record (cancels nothing; refuses while a batch may be running)",builder:__name(yargs=>yargs.positional("task-id",{describe:"Task id",type:"string",demandOption:true}).option("force",{describe:"Delete even if a batch may still be running or uncollected (it is not cancelled)",type:"boolean",default:false}),"builder"),handler:__name(argv=>run(async()=>{await cleanTask({env:process.env,out:writeStdoutLine,err:writeStderrLine,lockWaitMs:LOCK_WAIT_MS},argv["task-id"],{force:argv["force"]})}),"handler")};var checkWorkflowCommand={command:"check",describe:"Verify credentials and the Batch route, and show the settings a run would freeze (no billed request)",builder:__name(yargs=>yargs,"builder"),handler:__name(argv=>run(async()=>{await checkReadiness(workflowDeps(await prepareEndpoint(process.env,cliOptionsOf(argv))))}),"handler")};var cancelWorkflowCommand={command:"cancel <task-id>",describe:"Cancel a workflow task's active batch (already-completed requests are still billed)",builder:__name(yargs=>yargs.positional("task-id",{describe:"Task id",type:"string",demandOption:true}),"builder"),handler:__name(argv=>run(async()=>{await cancelTask(workflowDeps(await prepareEndpoint(process.env,cliOptionsOf(argv))),argv["task-id"])}),"handler")};var listWorkflowCommand={command:"list",describe:"List all recorded workflow tasks with their project",builder:__name(yargs=>yargs,"builder"),handler:__name(()=>run(async()=>{ignoreBrokenPipe();await listTasks({env:process.env,out:writeStdoutLine,err:writeStderrLine})}),"handler")};var batchCommand={command:"batch",describe:"Run many independent requests through the DashScope Batch API",builder:__name(yargs=>yargs.command(runWorkflowCommand).command(collectWorkflowCommand).command(retryWorkflowCommand).command(cancelWorkflowCommand).command(listWorkflowCommand).command(checkWorkflowCommand).command(cleanWorkflowCommand).demandCommand(1,"You need at least one command before continuing.").version(false),"builder"),handler:__name(()=>{},"handler")};export{resolveProxy,resolveProxyUrl,resolveEndpoint,prepareEndpoint,listWorkflowCommand,batchCommand};
|
|
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{SessionOrganizationService}from"./chunk-
|
|
3
|
+
import{SessionOrganizationService}from"./chunk-IFAUFERF.js";import{writeStderrLine}from"./chunk-SLPJ4OII.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();function createSessionOrganizationService(workspaceCwd){return new SessionOrganizationService(workspaceCwd,message=>{writeStderrLine(`qwen serve: session-org: ${message}`)})}__name(createSessionOrganizationService,"createSessionOrganizationService");export{createSessionOrganizationService};
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2025 Qwen Team
|