@qwen-code/qwen-code 0.20.2-headless-image-routing.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/qc-helper/docs/configuration/settings.md +5 -0
- package/bundled/qc-helper/docs/features/sub-agents.md +23 -5
- package/bundled/qc-helper/docs/integration-github-action.md +9 -9
- package/bundled/review/SKILL.md +7 -3
- package/chunks/MaxSizedBox-5DPPWPGT.js +85 -0
- package/chunks/{StandaloneSessionPicker-PLQQB22E.js → StandaloneSessionPicker-BIRMPLRD.js} +66 -59
- package/chunks/{acp-startup-profiler-N3RHHXJ3.js → acp-startup-profiler-RV3IV562.js} +2 -2
- package/chunks/{acpAgent-AIVK2EM5.js → acpAgent-6J2U72PQ.js} +705 -182
- package/chunks/agent-6ODUANDO.js +81 -0
- package/chunks/agent-headless-7BYQTMHW.js +75 -0
- package/chunks/{anthropicContentGenerator-HGWAHO24.js → anthropicContentGenerator-75BKLTSP.js} +117 -43
- package/chunks/{artifact-tool-56T5IMBP.js → artifact-tool-Y5T7GG7F.js} +3 -3
- package/chunks/{askUserQuestion-E25OBIC2.js → askUserQuestion-2H6747FR.js} +3 -3
- package/chunks/bridge-ZUB64FAE.js +90 -0
- package/chunks/{build-GHIZ4MSZ.js → build-RV63TIRH.js} +2 -3
- package/chunks/{ca-N6VVUFVB.js → ca-25EDXPFZ.js} +2 -0
- package/chunks/{channel-worker-group-QZV2SP5U.js → channel-worker-group-2ZD7TVAT.js} +8 -7
- package/chunks/{channel-worker-manager-3GMAU45H.js → channel-worker-manager-4OA4BCGB.js} +190 -30
- package/chunks/{channel-worker-supervisor-QCXSXCRY.js → channel-worker-supervisor-V7KCFJTS.js} +7 -6
- package/chunks/{chunk-TYQMGACW.js → chunk-22C7BQ6D.js} +508 -10967
- package/chunks/chunk-2JZBVYTU.js +452 -0
- package/chunks/{chunk-H2XVO6NE.js → chunk-2MIN6GRR.js} +1 -1
- package/chunks/{chunk-4DWTDZGS.js → chunk-2NH6DYI4.js} +12 -12
- package/chunks/chunk-2SCDWPXI.js +246 -0
- package/chunks/{chunk-QE4KFTBS.js → chunk-2X55UKQE.js} +3 -3
- package/chunks/{chunk-QBUDF33N.js → chunk-3QMGYBFN.js} +1 -1
- package/chunks/{chunk-3OAKYHRG.js → chunk-3RN6GBKS.js} +1 -1
- package/chunks/{chunk-QR6U5QPP.js → chunk-3SJ43L4W.js} +4 -0
- package/chunks/chunk-46UV252V.js +128 -0
- package/chunks/{chunk-GHRSKGHF.js → chunk-4WIZGAH3.js} +7 -7
- package/chunks/{chunk-CAS7CB3T.js → chunk-55DJUCI2.js} +87 -29
- package/chunks/{chunk-QNLNLENL.js → chunk-5I2IWRSH.js} +2 -2
- package/chunks/{chunk-H24SOJIQ.js → chunk-5NBDS5S6.js} +147 -7
- package/chunks/{chunk-E4IMU4Y5.js → chunk-63P4EL5V.js} +1 -1
- package/chunks/chunk-6FGBXPWM.js +293 -0
- package/chunks/{chunk-FFFM6NJV.js → chunk-6GMVPFB2.js} +155 -73
- package/chunks/{chunk-KWK7UE6L.js → chunk-6OUGMXDC.js} +6 -6
- package/chunks/{chunk-QRUIS3DN.js → chunk-6PEXNQTX.js} +22 -1
- package/chunks/{chunk-FZPTCQY7.js → chunk-7JURR4JT.js} +1 -1
- package/chunks/{chunk-Q6NAKZTA.js → chunk-7MVVZO4N.js} +4 -4
- package/chunks/{chunk-6ZBPS62S.js → chunk-7ZCNENPP.js} +1 -1
- package/chunks/{chunk-6X4GWOPW.js → chunk-A5L3JMUA.js} +1 -1
- package/chunks/{chunk-YO2XRXY6.js → chunk-ACY3A37B.js} +3 -3
- package/chunks/chunk-AMDSOFFV.js +10860 -0
- package/chunks/{chunk-RV4C2ZFG.js → chunk-BIQWWWJN.js} +1 -1
- package/chunks/{chunk-ZHERRXZJ.js → chunk-BJX6ZSUK.js} +4 -4
- package/chunks/chunk-BK2UNYWD.js +29 -0
- package/chunks/{chunk-FRPDJNK3.js → chunk-BKHWX6I2.js} +3 -3
- package/chunks/chunk-BPJSQIJX.js +100 -0
- package/chunks/{chunk-M7WBGLYP.js → chunk-BULDBTYC.js} +2 -0
- package/chunks/{chunk-ZDP2Y2AL.js → chunk-CIKQ7KKO.js} +4625 -8645
- package/chunks/{chunk-PEJWA3QQ.js → chunk-D3UEZIQH.js} +4 -2
- package/chunks/chunk-DHHOYAPR.js +1462 -0
- package/chunks/{chunk-LESHKUWF.js → chunk-DLWL3Z7A.js} +5 -3
- package/chunks/{chunk-XHATNRQA.js → chunk-DP3IHZGG.js} +0 -2
- package/chunks/chunk-E5TUC6CA.js +479 -0
- package/chunks/{chunk-JC26SJ5Y.js → chunk-EBJQ6AXW.js} +13 -12
- package/chunks/{chunk-RCWKCN2Z.js → chunk-EPDRMGT4.js} +164 -17
- package/chunks/{chunk-FUFCALSJ.js → chunk-ETSW4KLJ.js} +2 -2
- package/chunks/{chunk-KHOVYUHX.js → chunk-FNQ6T3CV.js} +20 -3
- package/chunks/{chunk-SP5WRGVG.js → chunk-FQK6JAFG.js} +72 -23
- package/chunks/{chunk-NWZY2SPY.js → chunk-FSITMZJH.js} +8 -8
- package/chunks/{chunk-6RLROE6G.js → chunk-GLWP3FDB.js} +80 -15
- package/chunks/{chunk-KPBVP6SL.js → chunk-GSN55ZRI.js} +5 -5
- package/chunks/{chunk-MLYGPZGU.js → chunk-H4SBPHSA.js} +3 -3
- package/chunks/chunk-H5FFA6TH.js +902 -0
- package/chunks/{chunk-TDKQP3M6.js → chunk-HIJQF5B5.js} +1 -1
- package/chunks/{chunk-5G3ZVADU.js → chunk-IJTOWOD7.js} +17 -6
- package/chunks/chunk-IKCX4CCL.js +469 -0
- package/chunks/{chunk-LPEONXNV.js → chunk-IKYJHJNF.js} +3 -3
- package/chunks/{chunk-DTZY2SH2.js → chunk-IO3IX5Q4.js} +1 -1
- package/chunks/{chunk-RS7MT2QG.js → chunk-IPUUTYMV.js} +2 -4
- package/chunks/{chunk-XU457J4V.js → chunk-IRH27ZC2.js} +2 -2
- package/chunks/{chunk-46DK772E.js → chunk-J24WCGIN.js} +4 -4
- package/chunks/{chunk-4LVZNIDO.js → chunk-J56UI34H.js} +4 -13
- package/chunks/{chunk-TJTKSVIV.js → chunk-JLU636DO.js} +5 -1
- package/chunks/{chunk-RKWX4CMO.js → chunk-JVPM2ULZ.js} +6 -6
- package/chunks/{chunk-ENPCQK44.js → chunk-JXJFVC6E.js} +37 -18
- package/chunks/{chunk-NABLFI57.js → chunk-JZA3JUDJ.js} +1 -1
- package/chunks/{chunk-CGLQAVZE.js → chunk-K36B6G2O.js} +5 -5
- package/chunks/{chunk-GPSKDNEE.js → chunk-K4XWPEWB.js} +4 -4
- package/chunks/{chunk-QOZOIPSF.js → chunk-KIM5GUMA.js} +650 -113
- package/chunks/{chunk-JZSM2IZ3.js → chunk-KMQ33DO4.js} +7 -5
- package/chunks/{chunk-E2UVIFI2.js → chunk-KRXPRVGL.js} +0 -1
- package/chunks/{chunk-WHGVTP7Q.js → chunk-L26JL52R.js} +3 -3
- package/chunks/{chunk-7Z6JQEL6.js → chunk-L5UHQJTJ.js} +1 -1
- package/chunks/{chunk-O2XSCRCS.js → chunk-LB6DUZ26.js} +259 -67
- package/chunks/chunk-LEH5C7FV.js +232 -0
- package/chunks/{chunk-RWV32G2M.js → chunk-LH2BYDQ5.js} +6 -4
- package/chunks/{chunk-QKTHJXCS.js → chunk-LK7CHLVP.js} +79 -2
- package/chunks/{chunk-VRRF3GW5.js → chunk-LKEJ26GS.js} +11 -11
- package/chunks/{chunk-SQFXI7VK.js → chunk-LQIW3YFY.js} +227 -41
- package/chunks/chunk-LS77BEZP.js +405 -0
- package/chunks/{chunk-BSHD62QJ.js → chunk-M4FMGVY4.js} +3 -3
- package/chunks/{chunk-57FIIFJN.js → chunk-M5JM7OSF.js} +1 -1
- package/chunks/{chunk-7362QS5B.js → chunk-MB4MZHMJ.js} +80 -37
- package/chunks/{chunk-4K56OJFJ.js → chunk-MUP3T3AD.js} +1 -1
- package/chunks/{chunk-3HFNGB2O.js → chunk-MVSUYZDT.js} +4 -4
- package/chunks/{chunk-T5IO6FZ4.js → chunk-MZAXJAUM.js} +1 -1
- package/chunks/{chunk-QKNXKTZX.js → chunk-NH6KE4JX.js} +3 -3
- package/chunks/chunk-NIBLUX3Y.js +934 -0
- package/chunks/{chunk-OQB4EXO4.js → chunk-NL7LTRLR.js} +1 -1
- package/chunks/{chunk-CS2FSS7W.js → chunk-OFDOK3VM.js} +5 -5
- package/chunks/{chunk-LIZRAKPB.js → chunk-OHNBB4XR.js} +1 -1
- package/chunks/{chunk-MDZTPSXO.js → chunk-OKY7HXPG.js} +2 -2
- package/chunks/{chunk-NHDKSOEY.js → chunk-P3QQPMQA.js} +5 -5
- package/chunks/{chunk-7THPNISK.js → chunk-PC6JANNU.js} +5 -5
- package/chunks/{chunk-OTQ6PSZC.js → chunk-PHOF65IG.js} +3498 -1030
- package/chunks/{chunk-OQ5SYCPE.js → chunk-PJIZUQVC.js} +2 -2
- package/chunks/{chunk-5DTTYNB7.js → chunk-PQNHRFJC.js} +16 -3
- package/chunks/{chunk-YM3SZTH4.js → chunk-PR75REBZ.js} +18 -1
- package/chunks/{chunk-RECUEJ7B.js → chunk-PSOO6YXD.js} +18 -15
- package/chunks/{chunk-X6N25LXS.js → chunk-PWTZEM3C.js} +2 -2
- package/chunks/{chunk-5NJTNQUW.js → chunk-PWVFN2LF.js} +1 -1
- package/chunks/{chunk-7AUH6A4T.js → chunk-Q4M4MDQ4.js} +2 -2
- package/chunks/{chunk-EZPB6S2I.js → chunk-QAF7NMK7.js} +1 -1
- package/chunks/{chunk-5GI55PF5.js → chunk-R5AFZNQW.js} +5 -5
- package/chunks/{chunk-T5B5NQZX.js → chunk-RF3EXIHJ.js} +47 -60
- package/chunks/{chunk-4K7VDKAD.js → chunk-RHLZR4E5.js} +1 -1
- package/chunks/{chunk-TJDW42MV.js → chunk-RIBKPMRP.js} +220 -141
- package/chunks/{chunk-RVLZCXEE.js → chunk-RWTEFFPU.js} +82 -3
- package/chunks/{chunk-L5QZGCRH.js → chunk-RZIX2G32.js} +1 -1
- package/chunks/{chunk-LLKWRXSS.js → chunk-SQCQ4KO2.js} +350 -418
- package/chunks/{chunk-THJNPLI4.js → chunk-TARRHLLG.js} +1 -0
- package/chunks/{chunk-XCXYRDHB.js → chunk-TEHGS6UP.js} +47 -18
- package/chunks/{chunk-PQIVAWXN.js → chunk-TGILQ3YH.js} +8 -8
- package/chunks/{chunk-Q2YKNMLS.js → chunk-TOFQCPDC.js} +43 -10
- package/chunks/{chunk-L3KUB6XM.js → chunk-TPRQ7RZH.js} +586 -242
- package/chunks/{chunk-T4TZQJ7W.js → chunk-TWPJO254.js} +5 -16
- package/chunks/{chunk-HIP6TVWA.js → chunk-U7M2DMGW.js} +3 -3
- package/chunks/{chunk-ACW3VNUE.js → chunk-UDX5OBWR.js} +41 -9
- package/chunks/{chunk-LW2FUYBN.js → chunk-USTWD7QV.js} +6 -4
- package/chunks/{chunk-NPQDJGKU.js → chunk-UUUTRMI2.js} +1 -1
- package/chunks/chunk-UW5EOVUN.js +249 -0
- package/chunks/{chunk-6IL7KRLE.js → chunk-VAK25FTU.js} +1 -1
- package/chunks/{chunk-O4BHWVUD.js → chunk-VIA5XA4U.js} +5 -2
- package/chunks/{chunk-EBXZ2YGV.js → chunk-VRYUBFMC.js} +1 -1
- package/chunks/{chunk-TWVE5ZS5.js → chunk-VULLI6WQ.js} +172 -6
- package/chunks/{chunk-LNDD3IML.js → chunk-WCXCRJYB.js} +1 -1
- package/chunks/{chunk-2LI23QA6.js → chunk-X5XDDSSH.js} +1 -1
- package/chunks/{chunk-Q35QUZDQ.js → chunk-Y34KJKDC.js} +1 -1
- package/chunks/{chunk-7NR2AIK6.js → chunk-YBL3QUDD.js} +2 -2
- package/chunks/{chunk-H4AR2JQF.js → chunk-YH6G52F2.js} +3 -3
- package/chunks/{chunk-MBOJHHPI.js → chunk-YPE6A4GC.js} +2 -2
- package/chunks/{chunk-3EK5ZOUQ.js → chunk-YX324OPW.js} +1 -1
- package/chunks/{chunk-4PTLZ3NX.js → chunk-Z2BC6UJ5.js} +3 -3
- package/chunks/{chunk-QLJUC7TG.js → chunk-ZD6UTE4A.js} +1 -1
- package/chunks/{chunk-LX3COOXF.js → chunk-ZFDTEDCF.js} +6 -6
- package/chunks/chunk-ZJHVAS7M.js +289 -0
- package/chunks/{chunk-4OWXOUYF.js → chunk-ZNAUOR2I.js} +15 -12
- package/chunks/{chunk-T2L47JJK.js → chunk-ZOIFNCKL.js} +4 -4
- package/chunks/{computer-use-2VIV73WK.js → computer-use-SOQ4E3VX.js} +43 -35
- package/chunks/{config-utils-FYTBZLCJ.js → config-utils-7V7GGIW6.js} +3 -3
- package/chunks/contextCommand-JLHYA34Z.js +80 -0
- package/chunks/{create-sub-session-AZ77LBL3.js → create-sub-session-IWW2IZ2T.js} +3 -3
- package/chunks/{create-sub-session-XDHHC2P4.js → create-sub-session-QRJLW5BV.js} +43 -35
- package/chunks/{cron-create-KTWJM7QT.js → cron-create-YIID5XAW.js} +6 -6
- package/chunks/{cron-delete-2P3I5ULL.js → cron-delete-ZVHYCEP2.js} +5 -5
- package/chunks/{cron-list-PXDPGEDQ.js → cron-list-XEGS463Q.js} +5 -5
- package/chunks/{daemon-RAPSDJH7.js → daemon-YO6433NF.js} +350 -53
- package/chunks/daemon-status-provider-2233Q37D.js +89 -0
- package/chunks/{de-4IBXM7CN.js → de-HGRCYDEJ.js} +1 -0
- package/chunks/{dist-UIFWIFRO.js → dist-46NQKLTW.js} +2 -2
- package/chunks/{dist-XRYV6TJP.js → dist-AIKFMUKK.js} +50 -4
- package/chunks/{dist-XBJVSWS2.js → dist-BBLXMS3N.js} +14 -2
- package/chunks/{dist-OMW6WDEO.js → dist-F6IBUDR4.js} +40 -9
- package/chunks/{dist-PJLG2XYX.js → dist-WEAHOXDM.js} +1 -1
- package/chunks/{dist-OAV7LJGJ.js → dist-YFNEUWSE.js} +26 -2
- package/chunks/earlyInputCapture-A7NDU3PF.js +82 -0
- package/chunks/{edit-CS6SFEXC.js → edit-OBDSQURM.js} +43 -35
- package/chunks/{en-USMCCJAJ.js → en-MTWBNGDO.js} +15 -0
- package/chunks/{enter-worktree-LMAL75DY.js → enter-worktree-U6MRPQ2P.js} +43 -35
- package/chunks/{enterPlanMode-WVJB4DSS.js → enterPlanMode-BC5QUZZ2.js} +43 -35
- package/chunks/{environment-6YHC4JAJ.js → environment-W5UFC2CH.js} +46 -38
- package/chunks/errors-M7CLORXH.js +88 -0
- package/chunks/{exit-worktree-KPFD742L.js → exit-worktree-DGNYMECB.js} +43 -35
- package/chunks/{exitPlanMode-UEJS6CDY.js → exitPlanMode-GXTBWQAR.js} +43 -35
- package/chunks/{fast-path-G2N4NRCA.js → fast-path-JJZFJANL.js} +6 -6
- package/chunks/{fast-path-settings-DAOVFADC.js → fast-path-settings-WQJU2LAT.js} +2 -2
- package/chunks/{fr-WVHEBDDB.js → fr-45RLL55O.js} +1 -0
- package/chunks/{gemini-2MDVIOVT.js → gemini-QS36EBZV.js} +132 -102
- package/chunks/{geminiContentGenerator-ZXTDBMFR.js → geminiContentGenerator-AG4KB6CV.js} +14 -8
- package/chunks/{getMachineId-bsd-QFVLPUPT.js → getMachineId-bsd-V7W3GODC.js} +1 -1
- package/chunks/{getMachineId-darwin-DGMQQE2E.js → getMachineId-darwin-TDO75DQP.js} +1 -1
- package/chunks/{getMachineId-linux-R4Z6CSWC.js → getMachineId-linux-TF43WQT2.js} +1 -1
- package/chunks/{getMachineId-unsupported-Z3SBVBUV.js → getMachineId-unsupported-ZGUO3TXT.js} +1 -1
- package/chunks/{getMachineId-win-SCK5UFDT.js → getMachineId-win-ECFYZZFQ.js} +1 -1
- package/chunks/{glob-562XFLIZ.js → glob-V7R3PSK3.js} +43 -35
- package/chunks/{grep-MGEFBDQK.js → grep-QYPSK7OP.js} +43 -35
- package/chunks/handleAutoUpdate-6DBEZYPV.js +81 -0
- package/chunks/{i18n-R6HJENXA.js → i18n-VUJJZIMU.js} +44 -36
- package/chunks/image-gen-Z3VPGKRC.js +240 -0
- package/chunks/initializer-UWAK5U5O.js +86 -0
- package/chunks/installationInfo-6O2YAA52.js +80 -0
- package/chunks/{ja-KY4ROZTE.js → ja-B7DF7DFG.js} +1 -0
- package/chunks/{keychain-token-storage-6ACJDYIB.js → keychain-token-storage-MDTG3WRM.js} +3 -3
- package/chunks/{kittyProtocolDetector-HCNNKJTI.js → kittyProtocolDetector-MBRTDRBK.js} +5 -3
- package/chunks/list-GB4ESM3T.js +89 -0
- package/chunks/list-agents-5KJJHR6I.js +80 -0
- package/chunks/loadedSettingsAdapter-OT6JVQ7U.js +83 -0
- package/chunks/loggingContentGenerator-HS3S5H3Q.js +1077 -0
- package/chunks/{loop-wakeup-RNMRVA66.js → loop-wakeup-FXKNNYSY.js} +7 -7
- package/chunks/{ls-J2ZI5XYK.js → ls-NTK6VOQJ.js} +5 -5
- package/chunks/{lsp-UMS3NUB5.js → lsp-2JI24STP.js} +3 -3
- package/chunks/{managed-npm-update-4KNYSOYC.js → managed-npm-update-JYEMMXA3.js} +94 -38
- package/chunks/mcp-6DBDJPFU.js +83 -0
- package/chunks/{monitor-DMHKE4SW.js → monitor-R3ODH5U6.js} +45 -36
- package/chunks/node-UUDY34IG.js +305 -0
- package/chunks/nonInteractiveCli-MOYCYBBU.js +141 -0
- package/chunks/{notebook-edit-35SJGEOR.js → notebook-edit-BNOK452R.js} +43 -35
- package/chunks/{openaiContentGenerator-5LPAFXPF.js → openaiContentGenerator-WMCU3O2H.js} +27 -17
- package/chunks/pidfile-TFRZZZIO.js +86 -0
- package/chunks/{processUtils-GM2I55KF.js → processUtils-RT7UNCC2.js} +2 -2
- package/chunks/{pt-OK455PLH.js → pt-22Q3FP73.js} +1 -0
- package/chunks/{qwenContentGenerator-HKOYNP7H.js → qwenContentGenerator-HHCRK4SX.js} +56 -42
- package/chunks/{qwenOAuth2-NUUYC3V5.js → qwenOAuth2-OWLB5AKH.js} +14 -27
- package/chunks/read-file-APMO3PSX.js +31 -0
- package/chunks/{read-mcp-resource-F6HYMDUY.js → read-mcp-resource-4DKQWGHD.js} +3 -3
- package/chunks/{record-artifact-7GCFLDD7.js → record-artifact-RQKFYO5B.js} +3 -3
- package/chunks/resumeHistoryUtils-6KRYEAWZ.js +91 -0
- package/chunks/ripGrep-BEJDEDXW.js +73 -0
- package/chunks/{ru-7SPDGMGD.js → ru-FZCNZHDC.js} +1 -0
- package/chunks/{run-qwen-serve-5VH3F4NW.js → run-qwen-serve-FU6HEM4J.js} +271 -57
- package/chunks/{runtime-OH77YH7W.js → runtime-XXRRTNP6.js} +55 -45
- package/chunks/{scheduler-WJQSLCSV.js → scheduler-G2ZS2Z7E.js} +43 -35
- package/chunks/{sdk-exporters-grpc-ETLH47EP.js → sdk-exporters-grpc-AK3LGHNO.js} +3 -3
- package/chunks/{sdk-exporters-http-T3POX73F.js → sdk-exporters-http-FYBSUCPD.js} +6 -6
- package/chunks/{sdk-impl-NSLPDH6I.js → sdk-impl-GMVPB7NB.js} +6 -6
- package/chunks/{send-message-PYIJ2PZL.js → send-message-Q6OOR6BR.js} +46 -9
- package/chunks/serve-7BSTXJ4T.js +89 -0
- package/chunks/{server-E4N4AI6Z.js → server-4UMH7OIZ.js} +2362 -411
- package/chunks/{session-5YUWIOQE.js → session-K3O3Q2SV.js} +105 -87
- package/chunks/{settings-YY7ZSFO7.js → settings-CR2EWTBA.js} +53 -45
- package/chunks/shell-HH3PF3A2.js +83 -0
- package/chunks/{skill-PAIDX3EU.js → skill-I3SDA4MB.js} +17 -16
- package/chunks/spawnChannel-RWNDBXGA.js +82 -0
- package/chunks/{src-IZXLJI5M.js → src-GE4TTTML.js} +302 -184
- package/chunks/{standalone-update-X675JVBL.js → standalone-update-Q6WFRZZQ.js} +45 -37
- package/chunks/{startInteractiveUI-ND2IVBU3.js → startInteractiveUI-SLZGHRPH.js} +747 -310
- package/chunks/{syntheticOutput-H7RTI5KL.js → syntheticOutput-I3757IWH.js} +4 -4
- package/chunks/{task-create-7474AJJD.js → task-create-N7WQSGYA.js} +10 -10
- package/chunks/{task-list-633HGOIB.js → task-list-FOPULZEP.js} +7 -7
- package/chunks/{task-stop-MNUGHPIA.js → task-stop-H6RHXFVQ.js} +4 -4
- package/chunks/{task-update-66GQB5LI.js → task-update-M57TFZJT.js} +10 -10
- package/chunks/{team-create-2DEYNMMN.js → team-create-YJALH5D2.js} +46 -38
- package/chunks/{team-delete-BB3CG3QF.js → team-delete-QE2UXJL7.js} +7 -7
- package/chunks/{team-plan-approval-65AVAOCT.js → team-plan-approval-34QFYKGN.js} +43 -35
- package/chunks/theme-manager-SWRILQHI.js +77 -0
- package/chunks/{todoWrite-KRAUN54W.js → todoWrite-VQ7FKOHL.js} +5 -5
- package/chunks/{tool-search-ZQP3SMTV.js → tool-search-NF7GB6LE.js} +16 -16
- package/chunks/total-session-admission-DLHHHLD3.js +84 -0
- package/chunks/{tree-sitter-FS4VPMZA.js → tree-sitter-4D7QS7F6.js} +1 -1
- package/chunks/{tree-sitter-bash-6B46JJCV.js → tree-sitter-bash-VEJGF5XF.js} +1 -1
- package/chunks/{trustedFolders-LURI52LP.js → trustedFolders-KHXHY6PY.js} +44 -36
- package/chunks/{update-relaunch-BPWFIDLM.js → update-relaunch-WBUZJC5O.js} +5 -5
- package/chunks/updateCheck-RKL6M5XN.js +92 -0
- package/chunks/useAutoAcceptIndicator-CFQ5BUJL.js +93 -0
- package/chunks/{validateNonInterActiveAuth-HWD6Y22I.js → validateNonInterActiveAuth-3R223G3R.js} +89 -80
- package/chunks/{version-OD4JAFG7.js → version-HS7YSFHV.js} +1 -1
- package/chunks/{web-fetch-RFBKNU24.js → web-fetch-NKCSG7ZE.js} +18 -16
- package/chunks/{web-search-AKTVS5YZ.js → web-search-S62WAP4S.js} +13 -27
- package/chunks/{workflow-VZVCOSZN.js → workflow-QAGU5RU4.js} +44 -36
- package/chunks/workspace-providers-status-QSVZUETE.js +86 -0
- package/chunks/{workspace-registration-store-Q5SFJSX4.js → workspace-registration-store-24JMHDGF.js} +2 -2
- package/chunks/workspace-registry-UT4RBNBM.js +88 -0
- package/chunks/workspace-service-JFWRUS4V.js +98 -0
- package/chunks/workspace-skills-status-ZBBKJOI2.js +85 -0
- package/chunks/write-file-VHIXW5M7.js +73 -0
- package/chunks/{zh-WY5DWYZD.js → zh-LUIGBD55.js} +15 -0
- package/chunks/{zh-TW-BM47YBFH.js → zh-TW-F5KG2IYD.js} +15 -0
- package/cli-entry.js +10 -1
- package/cli.js +13 -13
- package/locales/ca.js +2 -0
- package/locales/de.js +1 -0
- package/locales/en.js +25 -0
- package/locales/fr.js +1 -0
- package/locales/ja.js +1 -0
- package/locales/pt.js +1 -0
- package/locales/ru.js +1 -0
- package/locales/zh-TW.js +23 -0
- package/locales/zh.js +23 -0
- package/package.json +3 -3
- package/web-shell/assets/{arc-BWFm0SI0.js → arc-DcbWnB9T.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-CZ_yL-DQ.js → architectureDiagram-3BPJPVTR-kMMF5sud.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-B9F9mJvG.js → blockDiagram-GPEHLZMM-Htl9vTJS.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-BUdwJW5f.js → c4Diagram-AAUBKEIU-BnZnm0mQ.js} +1 -1
- package/web-shell/assets/channel-Cq7YKtfC.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-w4cF-qlF.js → chunk-2J33WTMH-DziB7kDG.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-BXwURxHJ.js → chunk-4BX2VUAB-CmkD8daw.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-Gem3LalC.js → chunk-55IACEB6-CHAd9A_U.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-A3ddVojI.js → chunk-727SXJPM-Dqaam3fE.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-CjHZ5L_R.js → chunk-AQP2D5EJ-D_-saBYM.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-CKgdgcpv.js → chunk-FMBD7UC4-B9r_veWD.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-Cn2Dykjb.js → chunk-ND2GUHAM-B3EaCSpL.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN--0SyraC5.js → chunk-QZHKN3VN-CYq8x9mn.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-CQ9aC1Tg.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CQ9aC1Tg.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-CphhAity.js → cose-bilkent-S5V4N54A-D0ng4uiB.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-DU--jiKp.js → dagre-BM42HDAG-DCZollQv.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-BzvuZw1Y.js → diagram-2AECGRRQ-Dfk2pWS0.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-D84-49Y0.js → diagram-5GNKFQAL-kX38ltWR.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-DQTq-3_3.js → diagram-KO2AKTUF-CJz2vsXh.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-8FTrshzN.js → diagram-LMA3HP47-BvMLZm_7.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-BCjpDBCm.js → diagram-OG6HWLK6-l7kfStkO.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-BtRObkmg.js → erDiagram-TEJ5UH35-BSVa8GGT.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-DTrW6oxy.js → flowDiagram-I6XJVG4X-CoawKIXH.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-BgPNSW6j.js → ganttDiagram-6RSMTGT7-DFUDH0zF.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-BTclNgGV.js → gitGraphDiagram-PVQCEYII-Y2pvpT4e.js} +1 -1
- package/web-shell/assets/{index-CxA7AqY6.js → index-D0GX0zZf.js} +1 -1
- package/web-shell/assets/index-D9haPt0X.css +5 -0
- package/web-shell/assets/index-ckX9Pq5k.js +1230 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-DCE4AJt2.js → infoDiagram-5YYISTIA-CU8_zLiX.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-C8iE6q4Y.js → ishikawaDiagram-YF4QCWOH-AVQiV0DU.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-C_dxdyEc.js → journeyDiagram-JHISSGLW-DQ0VSKa3.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-Dw3n1u3w.js → kanban-definition-UN3LZRKU-BqnWqsE_.js} +1 -1
- package/web-shell/assets/{linear-C2BF2zJ9.js → linear-BkoihsaA.js} +1 -1
- package/web-shell/assets/{mermaid.core-CGTQU3MA.js → mermaid.core-5RJs-31j.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-BVFZm9ZC.js → mindmap-definition-RKZ34NQL-D33Bxnpd.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-Cc-TNN3n.js → pieDiagram-4H26LBE5-BuEAw3BH.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-CgW3Rzsi.js → quadrantDiagram-W4KKPZXB-Kox_usEq.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-BAaj0Y3B.js → requirementDiagram-4Y6WPE33-CNjeUif0.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-XJWmekxS.js → sankeyDiagram-5OEKKPKP-BCd2OL_U.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CtRc_0wf.js → sequenceDiagram-3UESZ5HK-CF2ZTsz0.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-WCnvMGy5.js → stateDiagram-AJRCARHV-qenSzHtm.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-B7W4zlCr.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-C9cRx49L.js → timeline-definition-PNZ67QCA-B5DyWdgs.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-BvXOCEt-.js → vennDiagram-CIIHVFJN-DqP4I_o_.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-ByafGtzu.js → wardley-L42UT6IY-CJe2e4mg.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-CozAnw8x.js → wardleyDiagram-YWT4CUSO-BMDSw-Rr.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-Camu9Qvq.js → xychartDiagram-2RQKCTM6-BTVZYkxD.js} +1 -1
- package/web-shell/index.html +17 -13
- package/chunks/MaxSizedBox-3XQIBACV.js +0 -78
- package/chunks/agent-QXD5NSKA.js +0 -73
- package/chunks/agent-headless-4VXR2TBK.js +0 -67
- package/chunks/bridge-GIBRSPE6.js +0 -81
- package/chunks/chunk-CBOQ3HY7.js +0 -2019
- package/chunks/chunk-MA6GYKK7.js +0 -6928
- package/chunks/contextCommand-XQU7KLIH.js +0 -72
- package/chunks/daemon-status-provider-KQVNB4VA.js +0 -80
- package/chunks/earlyInputCapture-WP5SA3KH.js +0 -74
- package/chunks/errors-JEYPXX4S.js +0 -80
- package/chunks/handleAutoUpdate-2VJPAW43.js +0 -73
- package/chunks/initializer-UOX67ZFQ.js +0 -78
- package/chunks/installationInfo-NQNY34X3.js +0 -72
- package/chunks/list-2Z7KS7ZF.js +0 -81
- package/chunks/loadedSettingsAdapter-LIYY3LE4.js +0 -75
- package/chunks/mcp-AJ4QW3JA.js +0 -75
- package/chunks/nonInteractiveCli-PUSO5QF6.js +0 -134
- package/chunks/pidfile-EH2JW2PB.js +0 -78
- package/chunks/read-file-JZ5VXILQ.js +0 -31
- package/chunks/resumeHistoryUtils-Z3HG4WKM.js +0 -84
- package/chunks/ripGrep-JNLJCT2B.js +0 -65
- package/chunks/serve-NN5FXWR6.js +0 -81
- package/chunks/shell-FXT3NVC6.js +0 -75
- package/chunks/spawnChannel-XAWLXNOD.js +0 -74
- package/chunks/theme-manager-2WZHPK2M.js +0 -69
- package/chunks/total-session-admission-HULB2TEQ.js +0 -75
- package/chunks/updateCheck-D4ESCHBJ.js +0 -88
- package/chunks/useAutoAcceptIndicator-CBNLOF2P.js +0 -86
- package/chunks/workspace-providers-status-TJTVHORI.js +0 -78
- package/chunks/workspace-registry-H6VM5WXK.js +0 -79
- package/chunks/workspace-service-ZNKD3I2J.js +0 -90
- package/chunks/workspace-skills-status-OOBIXADG.js +0 -77
- package/chunks/write-file-CAKK5IAO.js +0 -65
- package/web-shell/assets/channel-DiLlxxIf.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-CkylTdM4.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CkylTdM4.js +0 -1
- package/web-shell/assets/index-CGtQqOIa.css +0 -5
- package/web-shell/assets/index-TtM0hVjU.js +0 -1207
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-D1gzH2Ue.js +0 -1
package/chunks/chunk-CBOQ3HY7.js
DELETED
|
@@ -1,2019 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import {
|
|
4
|
-
createDebugLogger
|
|
5
|
-
} from "./chunk-OQB4EXO4.js";
|
|
6
|
-
import {
|
|
7
|
-
init_esbuild_shims
|
|
8
|
-
} from "./chunk-5O2XNYP6.js";
|
|
9
|
-
import {
|
|
10
|
-
__name
|
|
11
|
-
} from "./chunk-J2S4EL5Y.js";
|
|
12
|
-
|
|
13
|
-
// packages/core/src/core/tokenLimits.ts
|
|
14
|
-
init_esbuild_shims();
|
|
15
|
-
var DEFAULT_TOKEN_LIMIT = 2e5;
|
|
16
|
-
var DEFAULT_OUTPUT_TOKEN_LIMIT = 32e3;
|
|
17
|
-
var ESCALATED_MAX_TOKENS = 64e3;
|
|
18
|
-
var OUTPUT_TOKEN_CEILING = ESCALATED_MAX_TOKENS;
|
|
19
|
-
var MIN_CLAMPED_OUTPUT_TOKENS = 4e3;
|
|
20
|
-
function outputClampMargin(contextWindowSize) {
|
|
21
|
-
return Math.max(1e4, Math.round(0.05 * contextWindowSize));
|
|
22
|
-
}
|
|
23
|
-
__name(outputClampMargin, "outputClampMargin");
|
|
24
|
-
function clampOutputTokensToWindow(outputCeiling, contextWindowSize, promptTokens) {
|
|
25
|
-
const room = contextWindowSize - promptTokens - outputClampMargin(contextWindowSize);
|
|
26
|
-
return Math.min(outputCeiling, Math.max(MIN_CLAMPED_OUTPUT_TOKENS, room));
|
|
27
|
-
}
|
|
28
|
-
__name(clampOutputTokensToWindow, "clampOutputTokensToWindow");
|
|
29
|
-
function parsePositiveIntegerEnvValue(raw) {
|
|
30
|
-
if (raw === void 0) return void 0;
|
|
31
|
-
const trimmed = raw.trim();
|
|
32
|
-
if (!/^\d+$/.test(trimmed)) return void 0;
|
|
33
|
-
const parsed = Number(trimmed);
|
|
34
|
-
if (!Number.isSafeInteger(parsed) || parsed <= 0) return void 0;
|
|
35
|
-
return parsed;
|
|
36
|
-
}
|
|
37
|
-
__name(parsePositiveIntegerEnvValue, "parsePositiveIntegerEnvValue");
|
|
38
|
-
var LIMITS = {
|
|
39
|
-
"32k": 32768,
|
|
40
|
-
"64k": 65536,
|
|
41
|
-
"128k": 131072,
|
|
42
|
-
"192k": 196608,
|
|
43
|
-
// MiniMax-M2.5 context window
|
|
44
|
-
"200k": 2e5,
|
|
45
|
-
// vendor-declared decimal, used by OpenAI, Anthropic, etc.
|
|
46
|
-
"256k": 262144,
|
|
47
|
-
"272k": 272e3,
|
|
48
|
-
// vendor-declared decimal, GPT-5.x input (400K total - 128K output)
|
|
49
|
-
"384k": 384e3,
|
|
50
|
-
// vendor-declared decimal, DeepSeek V4 max output
|
|
51
|
-
"400k": 4e5,
|
|
52
|
-
// vendor-declared decimal, used by OpenAI GPT-5.x
|
|
53
|
-
"512k": 524288,
|
|
54
|
-
"1m": 1e6,
|
|
55
|
-
// Output token limits (typically much smaller than input limits)
|
|
56
|
-
"4k": 4096,
|
|
57
|
-
"8k": 8192,
|
|
58
|
-
"16k": 16384
|
|
59
|
-
};
|
|
60
|
-
function normalize(model) {
|
|
61
|
-
let s = (model ?? "").toLowerCase().trim();
|
|
62
|
-
s = s.replace(/^.*\//, "");
|
|
63
|
-
s = s.split("|").pop() ?? s;
|
|
64
|
-
s = s.split(":").pop() ?? s;
|
|
65
|
-
s = s.replace(/\s+/g, "-");
|
|
66
|
-
s = s.replace(/-preview/g, "");
|
|
67
|
-
if (!s.match(/^qwen-(?:plus|flash|vl-max)-latest$/) && !s.match(/^kimi-k2-\d{4}$/)) {
|
|
68
|
-
s = s.replace(
|
|
69
|
-
/-(?:\d{4,}|\d+x\d+b|v\d+(?:\.\d+)*|(?<=-[^-]+-)\d+(?:\.\d+)+|latest|exp)$/g,
|
|
70
|
-
""
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
s = s.replace(/-(?:\d?bit|int[48]|bf16|fp16|q[45]|quantized)$/g, "");
|
|
74
|
-
return s;
|
|
75
|
-
}
|
|
76
|
-
__name(normalize, "normalize");
|
|
77
|
-
var PATTERNS = [
|
|
78
|
-
// -------------------
|
|
79
|
-
// Google Gemini
|
|
80
|
-
// -------------------
|
|
81
|
-
[/^gemini-3/, LIMITS["1m"]],
|
|
82
|
-
// Gemini 3.x (Pro, Flash, 3.1, etc.): 1M
|
|
83
|
-
[/^gemini-/, LIMITS["1m"]],
|
|
84
|
-
// Gemini fallback (1.5, 2.x): 1M
|
|
85
|
-
// -------------------
|
|
86
|
-
// OpenAI
|
|
87
|
-
// -------------------
|
|
88
|
-
[/^gpt-5/, LIMITS["272k"]],
|
|
89
|
-
// GPT-5.x: 272K input (400K total - 128K output)
|
|
90
|
-
[/^gpt-/, LIMITS["128k"]],
|
|
91
|
-
// GPT fallback (4o, 4.1, etc.): 128K
|
|
92
|
-
[/^o\d/, LIMITS["200k"]],
|
|
93
|
-
// o-series (o3, o4-mini, etc.): 200K
|
|
94
|
-
// -------------------
|
|
95
|
-
// Anthropic Claude
|
|
96
|
-
// -------------------
|
|
97
|
-
[/^claude-opus-4-(?:6|7|8)/, LIMITS["1m"]],
|
|
98
|
-
// Opus 4.6-4.8: 1M
|
|
99
|
-
[/^claude-/, LIMITS["200k"]],
|
|
100
|
-
// All Claude models: 200K
|
|
101
|
-
// -------------------
|
|
102
|
-
// Alibaba / Qwen
|
|
103
|
-
// -------------------
|
|
104
|
-
// Commercial API models (1,000,000 context)
|
|
105
|
-
[/^qwen3-coder-plus/, LIMITS["1m"]],
|
|
106
|
-
[/^qwen3-coder-flash/, LIMITS["1m"]],
|
|
107
|
-
[/^qwen3\.\d/, LIMITS["1m"]],
|
|
108
|
-
[/^qwen-plus-latest$/, LIMITS["1m"]],
|
|
109
|
-
[/^qwen-flash-latest$/, LIMITS["1m"]],
|
|
110
|
-
[/^coder-model$/, LIMITS["1m"]],
|
|
111
|
-
// Commercial API models (256K context)
|
|
112
|
-
[/^qwen3-max/, LIMITS["256k"]],
|
|
113
|
-
// Open-source Qwen3 variants: 256K native
|
|
114
|
-
[/^qwen3-coder-/, LIMITS["256k"]],
|
|
115
|
-
// Qwen fallback (VL, turbo, plus, 2.5, etc.): 256K
|
|
116
|
-
[/^qwen/, LIMITS["256k"]],
|
|
117
|
-
// -------------------
|
|
118
|
-
// DeepSeek
|
|
119
|
-
// -------------------
|
|
120
|
-
[/^deepseek-v4/, LIMITS["1m"]],
|
|
121
|
-
// DeepSeek V4 (flash, pro): 1M
|
|
122
|
-
[/^deepseek/, LIMITS["128k"]],
|
|
123
|
-
// -------------------
|
|
124
|
-
// Zhipu GLM
|
|
125
|
-
// -------------------
|
|
126
|
-
// 1M context is the forward default for new GLM releases (GLM-5.2+, GLM-6.x,
|
|
127
|
-
// and beyond) so they need no future code change. Confirmed 200K families
|
|
128
|
-
// (GLM-5 / 5.0 / 5.1, GLM-4.x and older) are pinned explicitly first.
|
|
129
|
-
[/^glm-5(\.[01])?(-|$)/, 202752],
|
|
130
|
-
// GLM-5 / 5.0 / 5.1: 200K
|
|
131
|
-
[/^glm-(?:[5-9]|\d{2,})/, LIMITS["1m"]],
|
|
132
|
-
// GLM-5.2+, 6.x..9.x, 10.x+: 1M
|
|
133
|
-
[/^glm-/, 202752],
|
|
134
|
-
// GLM <=4.x / non-numeric fallback: 200K
|
|
135
|
-
// -------------------
|
|
136
|
-
// MiniMax
|
|
137
|
-
// -------------------
|
|
138
|
-
[/^minimax-m3/i, LIMITS["1m"]],
|
|
139
|
-
// MiniMax-M3: 1,000,000
|
|
140
|
-
[/^minimax-m2\.5/i, LIMITS["192k"]],
|
|
141
|
-
// MiniMax-M2.5: 196,608
|
|
142
|
-
[/^minimax-/i, LIMITS["200k"]],
|
|
143
|
-
// MiniMax fallback: 200K
|
|
144
|
-
// -------------------
|
|
145
|
-
// Moonshot / Kimi
|
|
146
|
-
// -------------------
|
|
147
|
-
[/^kimi-k3/, LIMITS["1m"]],
|
|
148
|
-
// Kimi K3: 1M
|
|
149
|
-
[/^kimi-/, LIMITS["256k"]],
|
|
150
|
-
// Kimi fallback: 256K
|
|
151
|
-
// -------------------
|
|
152
|
-
// ByteDance Seed-OSS (512K)
|
|
153
|
-
// -------------------
|
|
154
|
-
[/^seed-oss/, LIMITS["512k"]]
|
|
155
|
-
];
|
|
156
|
-
var OUTPUT_PATTERNS = [
|
|
157
|
-
// Google Gemini
|
|
158
|
-
[/^gemini-3/, LIMITS["64k"]],
|
|
159
|
-
// Gemini 3.x: 64K
|
|
160
|
-
[/^gemini-/, LIMITS["8k"]],
|
|
161
|
-
// Gemini fallback: 8K
|
|
162
|
-
// OpenAI
|
|
163
|
-
[/^gpt-5/, LIMITS["128k"]],
|
|
164
|
-
// GPT-5.x: 128K
|
|
165
|
-
[/^gpt-/, LIMITS["16k"]],
|
|
166
|
-
// GPT fallback: 16K
|
|
167
|
-
[/^o\d/, LIMITS["128k"]],
|
|
168
|
-
// o-series: 128K
|
|
169
|
-
// Anthropic Claude
|
|
170
|
-
[/^claude-opus-4-(?:6|7|8)/, 128e3],
|
|
171
|
-
// Opus 4.6-4.8: 128K
|
|
172
|
-
[/^claude-sonnet-4-6/, LIMITS["64k"]],
|
|
173
|
-
// Sonnet 4.6: 64K
|
|
174
|
-
[/^claude-/, LIMITS["64k"]],
|
|
175
|
-
// Claude fallback: 64K
|
|
176
|
-
// Alibaba / Qwen
|
|
177
|
-
[/^qwen3\.\d/, LIMITS["64k"]],
|
|
178
|
-
[/^coder-model$/, LIMITS["64k"]],
|
|
179
|
-
[/^qwen/, LIMITS["32k"]],
|
|
180
|
-
// Qwen fallback (VL, turbo, plus, etc.): 32K
|
|
181
|
-
// DeepSeek
|
|
182
|
-
[/^deepseek-v4/, LIMITS["384k"]],
|
|
183
|
-
// DeepSeek V4 (flash, pro): 384K
|
|
184
|
-
[/^deepseek-reasoner/, LIMITS["64k"]],
|
|
185
|
-
[/^deepseek-r1/, LIMITS["64k"]],
|
|
186
|
-
[/^deepseek-chat/, LIMITS["8k"]],
|
|
187
|
-
// Zhipu GLM
|
|
188
|
-
[/^glm-5(?:\.\d+)?(?:-|$)/, LIMITS["128k"]],
|
|
189
|
-
[/^glm-4\.7/, LIMITS["16k"]],
|
|
190
|
-
// MiniMax
|
|
191
|
-
[/^minimax-m2\.5/i, LIMITS["64k"]],
|
|
192
|
-
// Kimi
|
|
193
|
-
[/^kimi-k3/, LIMITS["128k"]],
|
|
194
|
-
// Kimi K3: 128K default max output (up to 1M configurable)
|
|
195
|
-
[/^kimi-k2\.5/, LIMITS["32k"]]
|
|
196
|
-
];
|
|
197
|
-
function findTokenLimit(model, type = "input") {
|
|
198
|
-
const norm = normalize(model);
|
|
199
|
-
const patterns = type === "output" ? OUTPUT_PATTERNS : PATTERNS;
|
|
200
|
-
for (const [regex, limit] of patterns) {
|
|
201
|
-
if (regex.test(norm)) {
|
|
202
|
-
return limit;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return void 0;
|
|
206
|
-
}
|
|
207
|
-
__name(findTokenLimit, "findTokenLimit");
|
|
208
|
-
function hasExplicitOutputLimit(model) {
|
|
209
|
-
const norm = normalize(model);
|
|
210
|
-
return OUTPUT_PATTERNS.some(([regex]) => regex.test(norm));
|
|
211
|
-
}
|
|
212
|
-
__name(hasExplicitOutputLimit, "hasExplicitOutputLimit");
|
|
213
|
-
function knownTokenLimit(model, type = "input") {
|
|
214
|
-
return findTokenLimit(model, type);
|
|
215
|
-
}
|
|
216
|
-
__name(knownTokenLimit, "knownTokenLimit");
|
|
217
|
-
function tokenLimit(model, type = "input") {
|
|
218
|
-
return knownTokenLimit(model, type) ?? (type === "output" ? DEFAULT_OUTPUT_TOKEN_LIMIT : DEFAULT_TOKEN_LIMIT);
|
|
219
|
-
}
|
|
220
|
-
__name(tokenLimit, "tokenLimit");
|
|
221
|
-
function defaultOutputCeiling(model) {
|
|
222
|
-
const outputLimit = tokenLimit(model, "output");
|
|
223
|
-
if (/^claude-opus-4-(?:6|7|8)/.test(normalize(model))) {
|
|
224
|
-
return outputLimit;
|
|
225
|
-
}
|
|
226
|
-
return Math.min(outputLimit, OUTPUT_TOKEN_CEILING);
|
|
227
|
-
}
|
|
228
|
-
__name(defaultOutputCeiling, "defaultOutputCeiling");
|
|
229
|
-
function reconcileMaxTokens(configMaxTokens, requestMaxTokens) {
|
|
230
|
-
if (typeof configMaxTokens === "number" && typeof requestMaxTokens === "number") {
|
|
231
|
-
return Math.min(configMaxTokens, requestMaxTokens);
|
|
232
|
-
}
|
|
233
|
-
return void 0;
|
|
234
|
-
}
|
|
235
|
-
__name(reconcileMaxTokens, "reconcileMaxTokens");
|
|
236
|
-
|
|
237
|
-
// packages/core/src/utils/request-tokenizer/textTokenizer.ts
|
|
238
|
-
init_esbuild_shims();
|
|
239
|
-
var NON_ASCII_RE = /[\u0080-\uffff]/;
|
|
240
|
-
var TOKEN_ESTIMATE_UNITS_PER_TOKEN = 20;
|
|
241
|
-
function estimateTextTokens(text) {
|
|
242
|
-
if (!text || text.length === 0) {
|
|
243
|
-
return 0;
|
|
244
|
-
}
|
|
245
|
-
if (!NON_ASCII_RE.test(text)) {
|
|
246
|
-
return Math.ceil(text.length / 4);
|
|
247
|
-
}
|
|
248
|
-
const nonAsciiChars = countNonAsciiChars(text);
|
|
249
|
-
const asciiChars = text.length - nonAsciiChars;
|
|
250
|
-
return Math.ceil(asciiChars / 4 + nonAsciiChars * 1.1);
|
|
251
|
-
}
|
|
252
|
-
__name(estimateTextTokens, "estimateTextTokens");
|
|
253
|
-
function estimateTextTokenUnits(text) {
|
|
254
|
-
if (!text || text.length === 0) {
|
|
255
|
-
return 0;
|
|
256
|
-
}
|
|
257
|
-
if (!NON_ASCII_RE.test(text)) {
|
|
258
|
-
return text.length * 5;
|
|
259
|
-
}
|
|
260
|
-
const nonAsciiChars = countNonAsciiChars(text);
|
|
261
|
-
const asciiChars = text.length - nonAsciiChars;
|
|
262
|
-
return asciiChars * 5 + nonAsciiChars * 22;
|
|
263
|
-
}
|
|
264
|
-
__name(estimateTextTokenUnits, "estimateTextTokenUnits");
|
|
265
|
-
function countNonAsciiChars(text) {
|
|
266
|
-
let count = 0;
|
|
267
|
-
for (let i = 0; i < text.length; i++) {
|
|
268
|
-
if (text.charCodeAt(i) >= 128) {
|
|
269
|
-
count++;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
return count;
|
|
273
|
-
}
|
|
274
|
-
__name(countNonAsciiChars, "countNonAsciiChars");
|
|
275
|
-
var TextTokenizer = class {
|
|
276
|
-
static {
|
|
277
|
-
__name(this, "TextTokenizer");
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Calculate tokens for text content
|
|
281
|
-
*
|
|
282
|
-
* @param text - The text to estimate tokens for
|
|
283
|
-
* @returns The estimated token count
|
|
284
|
-
*/
|
|
285
|
-
async calculateTokens(text) {
|
|
286
|
-
return this.calculateTokensSync(text);
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Calculate tokens for multiple text strings
|
|
290
|
-
*
|
|
291
|
-
* @param texts - Array of text strings to estimate tokens for
|
|
292
|
-
* @returns Array of token counts corresponding to each input text
|
|
293
|
-
*/
|
|
294
|
-
async calculateTokensBatch(texts) {
|
|
295
|
-
return texts.map((text) => this.calculateTokensSync(text));
|
|
296
|
-
}
|
|
297
|
-
calculateTokensSync(text) {
|
|
298
|
-
return estimateTextTokens(text);
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
// packages/core/src/core/tool-call-preparation.ts
|
|
303
|
-
init_esbuild_shims();
|
|
304
|
-
var preparationsByResponse = /* @__PURE__ */ new WeakMap();
|
|
305
|
-
function setToolCallPreparations(response, preparations) {
|
|
306
|
-
preparationsByResponse.set(response, preparations);
|
|
307
|
-
}
|
|
308
|
-
__name(setToolCallPreparations, "setToolCallPreparations");
|
|
309
|
-
function getToolCallPreparations(response) {
|
|
310
|
-
return preparationsByResponse.get(response) ?? [];
|
|
311
|
-
}
|
|
312
|
-
__name(getToolCallPreparations, "getToolCallPreparations");
|
|
313
|
-
|
|
314
|
-
// packages/core/src/utils/runtimeDiagnostics.ts
|
|
315
|
-
init_esbuild_shims();
|
|
316
|
-
var RUNTIME_PROFILE_ENV = "QWEN_CODE_PROFILE_RUNTIME";
|
|
317
|
-
function isRuntimeDiagnosticsEnabled(env = process.env) {
|
|
318
|
-
return env[RUNTIME_PROFILE_ENV] === "1";
|
|
319
|
-
}
|
|
320
|
-
__name(isRuntimeDiagnosticsEnabled, "isRuntimeDiagnosticsEnabled");
|
|
321
|
-
var RuntimeDiagnosticsCollector = class {
|
|
322
|
-
static {
|
|
323
|
-
__name(this, "RuntimeDiagnosticsCollector");
|
|
324
|
-
}
|
|
325
|
-
enabled;
|
|
326
|
-
now;
|
|
327
|
-
startedAt;
|
|
328
|
-
requestIndex = 0;
|
|
329
|
-
openAIWireRequestIndex = 0;
|
|
330
|
-
anthropicWireRequestIndex = 0;
|
|
331
|
-
requests = [];
|
|
332
|
-
openaiWireRequests = [];
|
|
333
|
-
anthropicWireRequests = [];
|
|
334
|
-
tools = createInitialToolDiagnostics();
|
|
335
|
-
constructor(options = {}) {
|
|
336
|
-
this.enabled = options.enabled ?? isRuntimeDiagnosticsEnabled();
|
|
337
|
-
this.now = options.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
|
|
338
|
-
this.startedAt = this.now();
|
|
339
|
-
}
|
|
340
|
-
reset(options = {}) {
|
|
341
|
-
this.enabled = options.enabled ?? isRuntimeDiagnosticsEnabled();
|
|
342
|
-
this.startedAt = this.now();
|
|
343
|
-
this.requestIndex = 0;
|
|
344
|
-
this.openAIWireRequestIndex = 0;
|
|
345
|
-
this.anthropicWireRequestIndex = 0;
|
|
346
|
-
this.requests = [];
|
|
347
|
-
this.openaiWireRequests = [];
|
|
348
|
-
this.anthropicWireRequests = [];
|
|
349
|
-
this.tools = createInitialToolDiagnostics();
|
|
350
|
-
}
|
|
351
|
-
isEnabled() {
|
|
352
|
-
return this.enabled;
|
|
353
|
-
}
|
|
354
|
-
recordGenerateContentRequest(request, options) {
|
|
355
|
-
if (!this.enabled) {
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
this.requestIndex += 1;
|
|
359
|
-
this.requests.push({
|
|
360
|
-
index: this.requestIndex,
|
|
361
|
-
timestamp: this.now(),
|
|
362
|
-
source: options.source,
|
|
363
|
-
model: request.model,
|
|
364
|
-
stream: options.stream,
|
|
365
|
-
serializedBytes: utf8Bytes(toJsonSafeRequest(request)),
|
|
366
|
-
contents: summarizeContents(request.contents),
|
|
367
|
-
systemInstructionBytes: summarizeContentTextBytes(
|
|
368
|
-
request.config?.systemInstruction
|
|
369
|
-
),
|
|
370
|
-
generationConfigBytes: utf8Bytes(toJsonSafeConfig(request.config)),
|
|
371
|
-
tools: summarizeToolSchemas(request.config?.tools)
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
recordOpenAIWireRequest(request) {
|
|
375
|
-
if (!this.enabled) {
|
|
376
|
-
return;
|
|
377
|
-
}
|
|
378
|
-
this.openAIWireRequestIndex += 1;
|
|
379
|
-
this.openaiWireRequests.push({
|
|
380
|
-
index: this.openAIWireRequestIndex,
|
|
381
|
-
timestamp: this.now(),
|
|
382
|
-
...summarizeOpenAIWireRequest(request)
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
recordAnthropicWireRequest(request) {
|
|
386
|
-
if (!this.enabled) {
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
this.anthropicWireRequestIndex += 1;
|
|
390
|
-
this.anthropicWireRequests.push({
|
|
391
|
-
index: this.anthropicWireRequestIndex,
|
|
392
|
-
timestamp: this.now(),
|
|
393
|
-
...summarizeAnthropicWireRequest(request)
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
recordToolUse(name, args) {
|
|
397
|
-
if (!this.enabled) {
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
const argBytes = utf8Bytes(args);
|
|
401
|
-
const tool = this.getToolNameDiagnostics(name);
|
|
402
|
-
tool.uses += 1;
|
|
403
|
-
tool.argBytes += argBytes;
|
|
404
|
-
tool.maxArgBytes = Math.max(tool.maxArgBytes, argBytes);
|
|
405
|
-
this.tools.toolUseCount += 1;
|
|
406
|
-
this.tools.totalToolUseArgBytes += argBytes;
|
|
407
|
-
this.tools.maxToolUseArgBytes = Math.max(
|
|
408
|
-
this.tools.maxToolUseArgBytes,
|
|
409
|
-
argBytes
|
|
410
|
-
);
|
|
411
|
-
}
|
|
412
|
-
recordToolResult(record) {
|
|
413
|
-
if (!this.enabled) {
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
const tool = this.getToolNameDiagnostics(record.name);
|
|
417
|
-
tool.results += 1;
|
|
418
|
-
tool.resultBytes += record.resultBytes;
|
|
419
|
-
tool.maxResultBytes = Math.max(tool.maxResultBytes, record.resultBytes);
|
|
420
|
-
if (record.isError) {
|
|
421
|
-
tool.errors += 1;
|
|
422
|
-
this.tools.toolResultErrorCount += 1;
|
|
423
|
-
}
|
|
424
|
-
this.tools.toolResultCount += 1;
|
|
425
|
-
this.tools.totalToolResultBytes += record.resultBytes;
|
|
426
|
-
this.tools.maxToolResultBytes = Math.max(
|
|
427
|
-
this.tools.maxToolResultBytes,
|
|
428
|
-
record.resultBytes
|
|
429
|
-
);
|
|
430
|
-
}
|
|
431
|
-
snapshot() {
|
|
432
|
-
return {
|
|
433
|
-
enabled: this.enabled,
|
|
434
|
-
startedAt: this.startedAt,
|
|
435
|
-
requests: this.requests.map((request) => ({
|
|
436
|
-
...request,
|
|
437
|
-
contents: {
|
|
438
|
-
...request.contents,
|
|
439
|
-
roleCounts: { ...request.contents.roleCounts }
|
|
440
|
-
},
|
|
441
|
-
tools: { ...request.tools }
|
|
442
|
-
})),
|
|
443
|
-
openaiWireRequests: this.openaiWireRequests.map((request) => ({
|
|
444
|
-
...request,
|
|
445
|
-
messageBytesByRole: { ...request.messageBytesByRole },
|
|
446
|
-
topLevelKeys: [...request.topLevelKeys]
|
|
447
|
-
})),
|
|
448
|
-
anthropicWireRequests: this.anthropicWireRequests.map((request) => ({
|
|
449
|
-
...request,
|
|
450
|
-
messageBytesByRole: { ...request.messageBytesByRole },
|
|
451
|
-
topLevelKeys: [...request.topLevelKeys]
|
|
452
|
-
})),
|
|
453
|
-
tools: {
|
|
454
|
-
...this.tools,
|
|
455
|
-
byName: Object.fromEntries(
|
|
456
|
-
Object.entries(this.tools.byName).map(([name, value]) => [
|
|
457
|
-
name,
|
|
458
|
-
{ ...value }
|
|
459
|
-
])
|
|
460
|
-
)
|
|
461
|
-
}
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
getToolNameDiagnostics(name) {
|
|
465
|
-
const existing = this.tools.byName[name];
|
|
466
|
-
if (existing) {
|
|
467
|
-
return existing;
|
|
468
|
-
}
|
|
469
|
-
const created = createInitialToolNameDiagnostics();
|
|
470
|
-
this.tools.byName[name] = created;
|
|
471
|
-
return created;
|
|
472
|
-
}
|
|
473
|
-
};
|
|
474
|
-
var runtimeDiagnostics = new RuntimeDiagnosticsCollector();
|
|
475
|
-
function summarizeOpenAIWireRequest(request) {
|
|
476
|
-
const requestRecord = asRecord(request);
|
|
477
|
-
const messages = Array.isArray(requestRecord["messages"]) ? requestRecord["messages"] : [];
|
|
478
|
-
const tools = Array.isArray(requestRecord["tools"]) ? requestRecord["tools"] : [];
|
|
479
|
-
const messageBytesByRole = {};
|
|
480
|
-
for (const message of messages) {
|
|
481
|
-
const messageRecord = asRecord(message);
|
|
482
|
-
const role = typeof messageRecord["role"] === "string" ? messageRecord["role"] : "unknown";
|
|
483
|
-
messageBytesByRole[role] = (messageBytesByRole[role] ?? 0) + utf8Bytes(messageRecord["content"]);
|
|
484
|
-
}
|
|
485
|
-
return {
|
|
486
|
-
model: typeof requestRecord["model"] === "string" ? requestRecord["model"] : "unknown",
|
|
487
|
-
stream: requestRecord["stream"] === true,
|
|
488
|
-
bodyBytes: utf8Bytes(request),
|
|
489
|
-
messageCount: messages.length,
|
|
490
|
-
messageBytesByRole,
|
|
491
|
-
toolsCount: tools.length,
|
|
492
|
-
toolSchemaBytes: utf8Bytes(tools),
|
|
493
|
-
topLevelKeys: Object.keys(requestRecord).sort()
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
__name(summarizeOpenAIWireRequest, "summarizeOpenAIWireRequest");
|
|
497
|
-
function summarizeAnthropicWireRequest(request) {
|
|
498
|
-
const requestRecord = asRecord(request);
|
|
499
|
-
const messages = Array.isArray(requestRecord["messages"]) ? requestRecord["messages"] : [];
|
|
500
|
-
const tools = Array.isArray(requestRecord["tools"]) ? requestRecord["tools"] : [];
|
|
501
|
-
const messageBytesByRole = {};
|
|
502
|
-
for (const message of messages) {
|
|
503
|
-
const messageRecord = asRecord(message);
|
|
504
|
-
const role = typeof messageRecord["role"] === "string" ? messageRecord["role"] : "unknown";
|
|
505
|
-
messageBytesByRole[role] = (messageBytesByRole[role] ?? 0) + utf8Bytes(messageRecord["content"]);
|
|
506
|
-
}
|
|
507
|
-
return {
|
|
508
|
-
model: typeof requestRecord["model"] === "string" ? requestRecord["model"] : "unknown",
|
|
509
|
-
stream: requestRecord["stream"] === true,
|
|
510
|
-
bodyBytes: utf8Bytes(request),
|
|
511
|
-
messageCount: messages.length,
|
|
512
|
-
messageBytesByRole,
|
|
513
|
-
systemBytes: utf8Bytes(requestRecord["system"]),
|
|
514
|
-
toolsCount: tools.length,
|
|
515
|
-
toolSchemaBytes: utf8Bytes(tools),
|
|
516
|
-
topLevelKeys: Object.keys(requestRecord).sort()
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
__name(summarizeAnthropicWireRequest, "summarizeAnthropicWireRequest");
|
|
520
|
-
function createInitialToolDiagnostics() {
|
|
521
|
-
return {
|
|
522
|
-
toolUseCount: 0,
|
|
523
|
-
toolResultCount: 0,
|
|
524
|
-
toolResultErrorCount: 0,
|
|
525
|
-
totalToolUseArgBytes: 0,
|
|
526
|
-
maxToolUseArgBytes: 0,
|
|
527
|
-
totalToolResultBytes: 0,
|
|
528
|
-
maxToolResultBytes: 0,
|
|
529
|
-
byName: /* @__PURE__ */ Object.create(null)
|
|
530
|
-
};
|
|
531
|
-
}
|
|
532
|
-
__name(createInitialToolDiagnostics, "createInitialToolDiagnostics");
|
|
533
|
-
function createInitialToolNameDiagnostics() {
|
|
534
|
-
return {
|
|
535
|
-
uses: 0,
|
|
536
|
-
argBytes: 0,
|
|
537
|
-
maxArgBytes: 0,
|
|
538
|
-
results: 0,
|
|
539
|
-
errors: 0,
|
|
540
|
-
resultBytes: 0,
|
|
541
|
-
maxResultBytes: 0
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
__name(createInitialToolNameDiagnostics, "createInitialToolNameDiagnostics");
|
|
545
|
-
function summarizeContents(contents) {
|
|
546
|
-
const summary = {
|
|
547
|
-
count: 0,
|
|
548
|
-
roleCounts: {},
|
|
549
|
-
partCount: 0,
|
|
550
|
-
textBytes: 0,
|
|
551
|
-
functionCallCount: 0,
|
|
552
|
-
functionCallArgBytes: 0,
|
|
553
|
-
functionResponseCount: 0,
|
|
554
|
-
functionResponseBytes: 0,
|
|
555
|
-
inlineDataCount: 0,
|
|
556
|
-
inlineDataBytes: 0,
|
|
557
|
-
fileDataCount: 0
|
|
558
|
-
};
|
|
559
|
-
const contentItems = Array.isArray(contents) ? contents : contents === void 0 || contents === null ? [] : [contents];
|
|
560
|
-
for (const content of contentItems) {
|
|
561
|
-
summary.count += 1;
|
|
562
|
-
if (typeof content === "string") {
|
|
563
|
-
summary.roleCounts["user"] = (summary.roleCounts["user"] ?? 0) + 1;
|
|
564
|
-
summary.partCount += 1;
|
|
565
|
-
summary.textBytes += utf8Bytes(content);
|
|
566
|
-
continue;
|
|
567
|
-
}
|
|
568
|
-
const contentRecord = asRecord(content);
|
|
569
|
-
const role = typeof contentRecord["role"] === "string" ? contentRecord["role"] : "unknown";
|
|
570
|
-
summary.roleCounts[role] = (summary.roleCounts[role] ?? 0) + 1;
|
|
571
|
-
const parts = Array.isArray(contentRecord["parts"]) ? contentRecord["parts"] : [];
|
|
572
|
-
summarizeParts(parts, summary);
|
|
573
|
-
}
|
|
574
|
-
return summary;
|
|
575
|
-
}
|
|
576
|
-
__name(summarizeContents, "summarizeContents");
|
|
577
|
-
function summarizeContentTextBytes(content) {
|
|
578
|
-
const summary = summarizeContents(content);
|
|
579
|
-
return summary.textBytes;
|
|
580
|
-
}
|
|
581
|
-
__name(summarizeContentTextBytes, "summarizeContentTextBytes");
|
|
582
|
-
function summarizeParts(parts, summary) {
|
|
583
|
-
for (const part of parts) {
|
|
584
|
-
summary.partCount += 1;
|
|
585
|
-
if (typeof part === "string") {
|
|
586
|
-
summary.textBytes += utf8Bytes(part);
|
|
587
|
-
continue;
|
|
588
|
-
}
|
|
589
|
-
const partRecord = asRecord(part);
|
|
590
|
-
if (typeof partRecord["text"] === "string") {
|
|
591
|
-
summary.textBytes += utf8Bytes(partRecord["text"]);
|
|
592
|
-
}
|
|
593
|
-
const functionCall = asOptionalRecord(partRecord["functionCall"]);
|
|
594
|
-
if (functionCall) {
|
|
595
|
-
summary.functionCallCount += 1;
|
|
596
|
-
summary.functionCallArgBytes += utf8Bytes(functionCall["args"]);
|
|
597
|
-
}
|
|
598
|
-
const functionResponse = asOptionalRecord(partRecord["functionResponse"]);
|
|
599
|
-
if (functionResponse) {
|
|
600
|
-
summary.functionResponseCount += 1;
|
|
601
|
-
summary.functionResponseBytes += utf8Bytes(functionResponse["response"]) + utf8Bytes(functionResponse["parts"]);
|
|
602
|
-
}
|
|
603
|
-
const inlineData = asOptionalRecord(partRecord["inlineData"]);
|
|
604
|
-
if (inlineData) {
|
|
605
|
-
summary.inlineDataCount += 1;
|
|
606
|
-
summary.inlineDataBytes += utf8Bytes(inlineData["data"]);
|
|
607
|
-
}
|
|
608
|
-
if (partRecord["fileData"]) {
|
|
609
|
-
summary.fileDataCount += 1;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
__name(summarizeParts, "summarizeParts");
|
|
614
|
-
function summarizeToolSchemas(tools) {
|
|
615
|
-
const toolList = Array.isArray(tools) ? tools : [];
|
|
616
|
-
let functionDeclarationCount = 0;
|
|
617
|
-
for (const tool of toolList) {
|
|
618
|
-
const toolRecord = asRecord(tool);
|
|
619
|
-
const declarations = Array.isArray(toolRecord["functionDeclarations"]) ? toolRecord["functionDeclarations"] : [];
|
|
620
|
-
functionDeclarationCount += declarations.length;
|
|
621
|
-
}
|
|
622
|
-
return {
|
|
623
|
-
count: toolList.length,
|
|
624
|
-
functionDeclarationCount,
|
|
625
|
-
schemaBytes: utf8Bytes(toolList)
|
|
626
|
-
};
|
|
627
|
-
}
|
|
628
|
-
__name(summarizeToolSchemas, "summarizeToolSchemas");
|
|
629
|
-
function toJsonSafeRequest(request) {
|
|
630
|
-
return {
|
|
631
|
-
model: request.model,
|
|
632
|
-
contents: request.contents,
|
|
633
|
-
config: toJsonSafeConfig(request.config)
|
|
634
|
-
};
|
|
635
|
-
}
|
|
636
|
-
__name(toJsonSafeRequest, "toJsonSafeRequest");
|
|
637
|
-
function toJsonSafeConfig(config) {
|
|
638
|
-
if (!config) {
|
|
639
|
-
return void 0;
|
|
640
|
-
}
|
|
641
|
-
const configRecord = asRecord(config);
|
|
642
|
-
const safeConfig = {};
|
|
643
|
-
for (const [key, value] of Object.entries(configRecord)) {
|
|
644
|
-
if (key === "abortSignal") {
|
|
645
|
-
continue;
|
|
646
|
-
}
|
|
647
|
-
safeConfig[key] = value;
|
|
648
|
-
}
|
|
649
|
-
return safeConfig;
|
|
650
|
-
}
|
|
651
|
-
__name(toJsonSafeConfig, "toJsonSafeConfig");
|
|
652
|
-
function utf8Bytes(value) {
|
|
653
|
-
if (value === void 0 || value === null) {
|
|
654
|
-
return 0;
|
|
655
|
-
}
|
|
656
|
-
if (typeof value === "string") {
|
|
657
|
-
return Buffer.byteLength(value, "utf8");
|
|
658
|
-
}
|
|
659
|
-
return Buffer.byteLength(safeStringify(value), "utf8");
|
|
660
|
-
}
|
|
661
|
-
__name(utf8Bytes, "utf8Bytes");
|
|
662
|
-
function safeStringify(value) {
|
|
663
|
-
try {
|
|
664
|
-
return JSON.stringify(value) ?? "";
|
|
665
|
-
} catch {
|
|
666
|
-
return "[unserializable]";
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
__name(safeStringify, "safeStringify");
|
|
670
|
-
function asRecord(value) {
|
|
671
|
-
return typeof value === "object" && value !== null ? value : {};
|
|
672
|
-
}
|
|
673
|
-
__name(asRecord, "asRecord");
|
|
674
|
-
function asOptionalRecord(value) {
|
|
675
|
-
return typeof value === "object" && value !== null ? value : null;
|
|
676
|
-
}
|
|
677
|
-
__name(asOptionalRecord, "asOptionalRecord");
|
|
678
|
-
|
|
679
|
-
// packages/core/src/utils/runtimeFetchOptions.ts
|
|
680
|
-
init_esbuild_shims();
|
|
681
|
-
var debugLogger = createDebugLogger("RUNTIME_FETCH");
|
|
682
|
-
var undiciModule;
|
|
683
|
-
var undiciModulePromise;
|
|
684
|
-
async function loadUndici() {
|
|
685
|
-
undiciModulePromise ??= import("./undici-3FJYTMOF.js").then((mod) => {
|
|
686
|
-
const keys = Object.keys(mod);
|
|
687
|
-
if (keys.length === 1 && keys[0] === "default") {
|
|
688
|
-
return mod.default;
|
|
689
|
-
}
|
|
690
|
-
return mod;
|
|
691
|
-
});
|
|
692
|
-
return undiciModulePromise;
|
|
693
|
-
}
|
|
694
|
-
__name(loadUndici, "loadUndici");
|
|
695
|
-
async function preloadRuntimeFetchModule() {
|
|
696
|
-
if (undiciModule) return;
|
|
697
|
-
undiciModule = await loadUndici();
|
|
698
|
-
}
|
|
699
|
-
__name(preloadRuntimeFetchModule, "preloadRuntimeFetchModule");
|
|
700
|
-
function requireUndici() {
|
|
701
|
-
if (!undiciModule) {
|
|
702
|
-
throw new Error(
|
|
703
|
-
"undici is not loaded yet; await preloadRuntimeFetchModule() before building runtime fetch options or dispatchers"
|
|
704
|
-
);
|
|
705
|
-
}
|
|
706
|
-
return undiciModule;
|
|
707
|
-
}
|
|
708
|
-
__name(requireUndici, "requireUndici");
|
|
709
|
-
function isTlsVerificationDisabled() {
|
|
710
|
-
const flag = process.env["QWEN_TLS_INSECURE"];
|
|
711
|
-
if (flag !== void 0 && /^(1|true|yes|on)$/i.test(flag.trim())) {
|
|
712
|
-
return true;
|
|
713
|
-
}
|
|
714
|
-
return process.env["NODE_TLS_REJECT_UNAUTHORIZED"] === "0";
|
|
715
|
-
}
|
|
716
|
-
__name(isTlsVerificationDisabled, "isTlsVerificationDisabled");
|
|
717
|
-
function detectRuntime() {
|
|
718
|
-
if (typeof process !== "undefined" && process.versions?.["bun"]) {
|
|
719
|
-
return "bun";
|
|
720
|
-
}
|
|
721
|
-
if (typeof process !== "undefined" && process.versions?.node) {
|
|
722
|
-
return "node";
|
|
723
|
-
}
|
|
724
|
-
return "unknown";
|
|
725
|
-
}
|
|
726
|
-
__name(detectRuntime, "detectRuntime");
|
|
727
|
-
function buildRuntimeFetchOptions(sdkType, proxyUrl) {
|
|
728
|
-
const runtime = detectRuntime();
|
|
729
|
-
switch (runtime) {
|
|
730
|
-
case "bun": {
|
|
731
|
-
if (sdkType === "openai") {
|
|
732
|
-
return {
|
|
733
|
-
fetchOptions: {
|
|
734
|
-
timeout: false
|
|
735
|
-
}
|
|
736
|
-
};
|
|
737
|
-
} else {
|
|
738
|
-
const bunFetch = /* @__PURE__ */ __name(async (input, init) => {
|
|
739
|
-
const bunFetchOptions = {
|
|
740
|
-
...init,
|
|
741
|
-
// @ts-expect-error - Bun-specific timeout option
|
|
742
|
-
timeout: false
|
|
743
|
-
};
|
|
744
|
-
return fetch(input, bunFetchOptions);
|
|
745
|
-
}, "bunFetch");
|
|
746
|
-
return {
|
|
747
|
-
fetch: bunFetch
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
case "node": {
|
|
752
|
-
return buildFetchOptionsWithDispatcher(sdkType, proxyUrl);
|
|
753
|
-
}
|
|
754
|
-
default: {
|
|
755
|
-
return buildFetchOptionsWithDispatcher(sdkType, proxyUrl);
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
__name(buildRuntimeFetchOptions, "buildRuntimeFetchOptions");
|
|
760
|
-
var dispatcherCache = /* @__PURE__ */ new Map();
|
|
761
|
-
var proxyFailureCounts = /* @__PURE__ */ new Map();
|
|
762
|
-
var NO_DISPATCHER_FALLBACK = {
|
|
763
|
-
openai: void 0,
|
|
764
|
-
anthropic: {}
|
|
765
|
-
};
|
|
766
|
-
function getOrCreateSharedDispatcher(proxyUrl, insecure = isTlsVerificationDisabled()) {
|
|
767
|
-
const cacheKey = insecure ? `${proxyUrl}#insecure` : proxyUrl;
|
|
768
|
-
const cached = dispatcherCache.get(cacheKey);
|
|
769
|
-
if (cached) {
|
|
770
|
-
return cached;
|
|
771
|
-
}
|
|
772
|
-
const { EnvHttpProxyAgent } = requireUndici();
|
|
773
|
-
const dispatcher = new EnvHttpProxyAgent({
|
|
774
|
-
httpProxy: proxyUrl,
|
|
775
|
-
httpsProxy: proxyUrl,
|
|
776
|
-
headersTimeout: 0,
|
|
777
|
-
bodyTimeout: 0,
|
|
778
|
-
keepAliveTimeout: 6e4,
|
|
779
|
-
// EnvHttpProxyAgent can dispatch either directly or through a proxy.
|
|
780
|
-
// `connect` covers a direct NO_PROXY connection, `requestTls` covers the
|
|
781
|
-
// origin through a proxy, and `proxyTls` covers an HTTPS proxy itself.
|
|
782
|
-
...insecure ? {
|
|
783
|
-
connect: { rejectUnauthorized: false },
|
|
784
|
-
requestTls: { rejectUnauthorized: false },
|
|
785
|
-
proxyTls: { rejectUnauthorized: false }
|
|
786
|
-
} : {}
|
|
787
|
-
});
|
|
788
|
-
dispatcherCache.set(cacheKey, dispatcher);
|
|
789
|
-
return dispatcher;
|
|
790
|
-
}
|
|
791
|
-
__name(getOrCreateSharedDispatcher, "getOrCreateSharedDispatcher");
|
|
792
|
-
function extractHostnameFromProxyUrl(proxyUrl) {
|
|
793
|
-
try {
|
|
794
|
-
const url = new URL(proxyUrl);
|
|
795
|
-
if (url.hostname) {
|
|
796
|
-
return url.port ? `${url.hostname}:${url.port}` : url.hostname;
|
|
797
|
-
}
|
|
798
|
-
} catch {
|
|
799
|
-
}
|
|
800
|
-
const match = proxyUrl.match(/@([^:/\s]+)(:\d+)?/);
|
|
801
|
-
return match ? match[1] + (match[2] ?? "") : redactProxyCredentials(proxyUrl);
|
|
802
|
-
}
|
|
803
|
-
__name(extractHostnameFromProxyUrl, "extractHostnameFromProxyUrl");
|
|
804
|
-
function hasPlausibleProxyPort(host) {
|
|
805
|
-
const portMatch = host.match(/:(\d{1,5})$/);
|
|
806
|
-
if (!portMatch) {
|
|
807
|
-
return false;
|
|
808
|
-
}
|
|
809
|
-
const port = Number(portMatch[1]);
|
|
810
|
-
return port >= 80 && port <= 65535;
|
|
811
|
-
}
|
|
812
|
-
__name(hasPlausibleProxyPort, "hasPlausibleProxyPort");
|
|
813
|
-
function hasLocalOrProxyLikeHost(host) {
|
|
814
|
-
const hostWithoutPort = host.replace(/:\d{1,5}$/, "").toLowerCase();
|
|
815
|
-
if (hostWithoutPort === "localhost") {
|
|
816
|
-
return true;
|
|
817
|
-
}
|
|
818
|
-
if (/^\d{1,3}(\.\d{1,3}){3}$/.test(hostWithoutPort)) {
|
|
819
|
-
return true;
|
|
820
|
-
}
|
|
821
|
-
return hostWithoutPort.split(/[.-]/).some((label) => /^(proxy|gateway|gw|squid)\d*$/.test(label));
|
|
822
|
-
}
|
|
823
|
-
__name(hasLocalOrProxyLikeHost, "hasLocalOrProxyLikeHost");
|
|
824
|
-
function hasNetworkErrorContext(message, offset) {
|
|
825
|
-
const context = message.slice(Math.max(0, offset - 80), offset).toLowerCase();
|
|
826
|
-
return /\b(connect|dispatcher|econnrefused|econnreset|enotfound|etimedout|proxy|tunnel)\b/.test(
|
|
827
|
-
context
|
|
828
|
-
);
|
|
829
|
-
}
|
|
830
|
-
__name(hasNetworkErrorContext, "hasNetworkErrorContext");
|
|
831
|
-
function shouldRedactTokenOnlyCredential(host, message, offset) {
|
|
832
|
-
return hasPlausibleProxyPort(host) && (hasLocalOrProxyLikeHost(host) || hasNetworkErrorContext(message, offset));
|
|
833
|
-
}
|
|
834
|
-
__name(shouldRedactTokenOnlyCredential, "shouldRedactTokenOnlyCredential");
|
|
835
|
-
function redactProxyCredentials(message) {
|
|
836
|
-
let result = message.replace(/\/\/[^/\s]*@/g, "//<redacted>@");
|
|
837
|
-
result = result.replace(
|
|
838
|
-
/(^|[\s([=:])([^\s/@()[\]=]+@[^@\s/()[\]=]+)/g,
|
|
839
|
-
(match, prefix, candidate, offset, message2) => {
|
|
840
|
-
const atIndex = candidate.indexOf("@");
|
|
841
|
-
const userInfo = candidate.slice(0, atIndex);
|
|
842
|
-
const host = candidate.slice(atIndex + 1);
|
|
843
|
-
if (!userInfo.includes(":") && !shouldRedactTokenOnlyCredential(host, message2, offset)) {
|
|
844
|
-
return match;
|
|
845
|
-
}
|
|
846
|
-
return `${prefix}<redacted>@${host}`;
|
|
847
|
-
}
|
|
848
|
-
);
|
|
849
|
-
return result;
|
|
850
|
-
}
|
|
851
|
-
__name(redactProxyCredentials, "redactProxyCredentials");
|
|
852
|
-
function redactProxyError(error) {
|
|
853
|
-
return redactProxyErrorValue(error, /* @__PURE__ */ new WeakMap());
|
|
854
|
-
}
|
|
855
|
-
__name(redactProxyError, "redactProxyError");
|
|
856
|
-
function redactProxyErrorValue(error, seen) {
|
|
857
|
-
if (typeof error === "string") {
|
|
858
|
-
return redactProxyCredentials(error);
|
|
859
|
-
}
|
|
860
|
-
if (!error || typeof error !== "object") {
|
|
861
|
-
return error;
|
|
862
|
-
}
|
|
863
|
-
if (seen.has(error)) {
|
|
864
|
-
return seen.get(error);
|
|
865
|
-
}
|
|
866
|
-
const errorRecord = error;
|
|
867
|
-
const needsClone = shouldCloneForRedaction(error, errorRecord);
|
|
868
|
-
const redactedMessage = typeof errorRecord.message === "string" ? redactProxyCredentials(errorRecord.message) : void 0;
|
|
869
|
-
const redactedStack = typeof errorRecord.stack === "string" ? redactProxyCredentials(errorRecord.stack) : void 0;
|
|
870
|
-
let redactedCause = errorRecord.cause;
|
|
871
|
-
let redactedErrors = errorRecord.errors;
|
|
872
|
-
if (needsClone) {
|
|
873
|
-
const clone = Object.create(Object.getPrototypeOf(error));
|
|
874
|
-
seen.set(error, clone);
|
|
875
|
-
if (errorRecord.cause !== void 0) {
|
|
876
|
-
redactedCause = redactProxyErrorValue(errorRecord.cause, seen);
|
|
877
|
-
}
|
|
878
|
-
if (errorRecord.errors !== void 0) {
|
|
879
|
-
redactedErrors = redactProxyErrorCollection(errorRecord.errors, seen);
|
|
880
|
-
}
|
|
881
|
-
cloneErrorWithRedactedFields(
|
|
882
|
-
error,
|
|
883
|
-
clone,
|
|
884
|
-
redactedMessage,
|
|
885
|
-
redactedStack,
|
|
886
|
-
redactedCause,
|
|
887
|
-
redactedErrors
|
|
888
|
-
);
|
|
889
|
-
return clone;
|
|
890
|
-
}
|
|
891
|
-
seen.set(error, error);
|
|
892
|
-
try {
|
|
893
|
-
if (redactedMessage !== void 0) {
|
|
894
|
-
errorRecord.message = redactedMessage;
|
|
895
|
-
}
|
|
896
|
-
if (redactedStack !== void 0) {
|
|
897
|
-
errorRecord.stack = redactedStack;
|
|
898
|
-
}
|
|
899
|
-
if (errorRecord.cause !== void 0) {
|
|
900
|
-
redactedCause = redactProxyErrorValue(errorRecord.cause, seen);
|
|
901
|
-
errorRecord.cause = redactedCause;
|
|
902
|
-
}
|
|
903
|
-
if (errorRecord.errors !== void 0) {
|
|
904
|
-
redactedErrors = redactProxyErrorCollection(errorRecord.errors, seen);
|
|
905
|
-
errorRecord.errors = redactedErrors;
|
|
906
|
-
}
|
|
907
|
-
return error;
|
|
908
|
-
} catch {
|
|
909
|
-
const clone = Object.create(Object.getPrototypeOf(error));
|
|
910
|
-
seen.set(error, clone);
|
|
911
|
-
if (errorRecord.cause !== void 0) {
|
|
912
|
-
redactedCause = redactProxyErrorValue(errorRecord.cause, seen);
|
|
913
|
-
}
|
|
914
|
-
if (errorRecord.errors !== void 0) {
|
|
915
|
-
redactedErrors = redactProxyErrorCollection(errorRecord.errors, seen);
|
|
916
|
-
}
|
|
917
|
-
cloneErrorWithRedactedFields(
|
|
918
|
-
error,
|
|
919
|
-
clone,
|
|
920
|
-
redactedMessage,
|
|
921
|
-
redactedStack,
|
|
922
|
-
redactedCause,
|
|
923
|
-
redactedErrors
|
|
924
|
-
);
|
|
925
|
-
return clone;
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
__name(redactProxyErrorValue, "redactProxyErrorValue");
|
|
929
|
-
function redactProxyErrorCollection(errors, seen) {
|
|
930
|
-
if (!Array.isArray(errors)) {
|
|
931
|
-
return redactProxyErrorValue(errors, seen);
|
|
932
|
-
}
|
|
933
|
-
if (seen.has(errors)) {
|
|
934
|
-
return seen.get(errors);
|
|
935
|
-
}
|
|
936
|
-
const redactedErrors = [];
|
|
937
|
-
seen.set(errors, redactedErrors);
|
|
938
|
-
for (const error of errors) {
|
|
939
|
-
redactedErrors.push(redactProxyErrorValue(error, seen));
|
|
940
|
-
}
|
|
941
|
-
return redactedErrors;
|
|
942
|
-
}
|
|
943
|
-
__name(redactProxyErrorCollection, "redactProxyErrorCollection");
|
|
944
|
-
function shouldCloneForRedaction(error, errorRecord) {
|
|
945
|
-
return typeof errorRecord.message === "string" && !canAssignProperty(error, "message") || typeof errorRecord.stack === "string" && !canAssignProperty(error, "stack") || errorRecord.cause !== void 0 && !canAssignProperty(error, "cause") || errorRecord.errors !== void 0 && !canAssignProperty(error, "errors");
|
|
946
|
-
}
|
|
947
|
-
__name(shouldCloneForRedaction, "shouldCloneForRedaction");
|
|
948
|
-
function canAssignProperty(target, key) {
|
|
949
|
-
let current = target;
|
|
950
|
-
while (current) {
|
|
951
|
-
const descriptor = Object.getOwnPropertyDescriptor(current, key);
|
|
952
|
-
if (descriptor) {
|
|
953
|
-
if ("writable" in descriptor) {
|
|
954
|
-
return descriptor.writable === true;
|
|
955
|
-
}
|
|
956
|
-
return typeof descriptor.set === "function";
|
|
957
|
-
}
|
|
958
|
-
current = Object.getPrototypeOf(current);
|
|
959
|
-
}
|
|
960
|
-
return Object.isExtensible(target);
|
|
961
|
-
}
|
|
962
|
-
__name(canAssignProperty, "canAssignProperty");
|
|
963
|
-
function cloneErrorWithRedactedFields(error, clone, redactedMessage, redactedStack, redactedCause, redactedErrors) {
|
|
964
|
-
const copiedKeys = /* @__PURE__ */ new Set();
|
|
965
|
-
for (const key of Reflect.ownKeys(error)) {
|
|
966
|
-
const descriptor = Object.getOwnPropertyDescriptor(error, key);
|
|
967
|
-
if (!descriptor) {
|
|
968
|
-
continue;
|
|
969
|
-
}
|
|
970
|
-
copiedKeys.add(key);
|
|
971
|
-
const updatedDescriptor = getRedactedPropertyDescriptor(
|
|
972
|
-
key,
|
|
973
|
-
descriptor,
|
|
974
|
-
redactedMessage,
|
|
975
|
-
redactedStack,
|
|
976
|
-
redactedCause,
|
|
977
|
-
redactedErrors
|
|
978
|
-
);
|
|
979
|
-
try {
|
|
980
|
-
Object.defineProperty(clone, key, updatedDescriptor);
|
|
981
|
-
} catch {
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
defineMissingRedactedValue(clone, copiedKeys, "message", redactedMessage);
|
|
985
|
-
defineMissingRedactedValue(clone, copiedKeys, "stack", redactedStack);
|
|
986
|
-
defineMissingRedactedValue(clone, copiedKeys, "cause", redactedCause);
|
|
987
|
-
defineMissingRedactedValue(clone, copiedKeys, "errors", redactedErrors);
|
|
988
|
-
}
|
|
989
|
-
__name(cloneErrorWithRedactedFields, "cloneErrorWithRedactedFields");
|
|
990
|
-
function getRedactedPropertyDescriptor(key, descriptor, redactedMessage, redactedStack, redactedCause, redactedErrors) {
|
|
991
|
-
const redactedValue = key === "message" ? redactedMessage : key === "stack" ? redactedStack : key === "cause" ? redactedCause : key === "errors" ? redactedErrors : void 0;
|
|
992
|
-
if (redactedValue === void 0) {
|
|
993
|
-
return { ...descriptor };
|
|
994
|
-
}
|
|
995
|
-
if ("value" in descriptor) {
|
|
996
|
-
return { ...descriptor, value: redactedValue };
|
|
997
|
-
}
|
|
998
|
-
return {
|
|
999
|
-
configurable: descriptor.configurable,
|
|
1000
|
-
enumerable: descriptor.enumerable,
|
|
1001
|
-
value: redactedValue,
|
|
1002
|
-
writable: true
|
|
1003
|
-
};
|
|
1004
|
-
}
|
|
1005
|
-
__name(getRedactedPropertyDescriptor, "getRedactedPropertyDescriptor");
|
|
1006
|
-
function defineMissingRedactedValue(target, copiedKeys, key, value) {
|
|
1007
|
-
if (value === void 0 || copiedKeys.has(key)) {
|
|
1008
|
-
return;
|
|
1009
|
-
}
|
|
1010
|
-
try {
|
|
1011
|
-
Object.defineProperty(target, key, {
|
|
1012
|
-
configurable: true,
|
|
1013
|
-
enumerable: false,
|
|
1014
|
-
value,
|
|
1015
|
-
writable: true
|
|
1016
|
-
});
|
|
1017
|
-
} catch {
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
__name(defineMissingRedactedValue, "defineMissingRedactedValue");
|
|
1021
|
-
function recordProxyFailure(hostname) {
|
|
1022
|
-
const failureCount = (proxyFailureCounts.get(hostname) ?? 0) + 1;
|
|
1023
|
-
proxyFailureCounts.set(hostname, failureCount);
|
|
1024
|
-
return failureCount;
|
|
1025
|
-
}
|
|
1026
|
-
__name(recordProxyFailure, "recordProxyFailure");
|
|
1027
|
-
function buildFetchOptionsWithDispatcher(sdkType, proxyUrl) {
|
|
1028
|
-
const insecure = isTlsVerificationDisabled();
|
|
1029
|
-
const { Agent, fetch: undiciFetch } = requireUndici();
|
|
1030
|
-
if (!proxyUrl) {
|
|
1031
|
-
const NO_PROXY_KEY = insecure ? "__no_proxy__#insecure" : "__no_proxy__";
|
|
1032
|
-
let dispatcher = dispatcherCache.get(NO_PROXY_KEY);
|
|
1033
|
-
if (!dispatcher) {
|
|
1034
|
-
dispatcher = new Agent({
|
|
1035
|
-
headersTimeout: 0,
|
|
1036
|
-
bodyTimeout: 0,
|
|
1037
|
-
keepAliveTimeout: 6e4,
|
|
1038
|
-
// For a direct (non-proxy) Agent, `connect` options flow straight to
|
|
1039
|
-
// the TLS connector, so this disables upstream cert verification.
|
|
1040
|
-
...insecure ? { connect: { rejectUnauthorized: false } } : {}
|
|
1041
|
-
});
|
|
1042
|
-
dispatcherCache.set(NO_PROXY_KEY, dispatcher);
|
|
1043
|
-
}
|
|
1044
|
-
return { fetchOptions: { dispatcher }, fetch: undiciFetch };
|
|
1045
|
-
}
|
|
1046
|
-
try {
|
|
1047
|
-
const dispatcher = getOrCreateSharedDispatcher(proxyUrl, insecure);
|
|
1048
|
-
return { fetchOptions: { dispatcher }, fetch: undiciFetch };
|
|
1049
|
-
} catch (error) {
|
|
1050
|
-
const hostname = extractHostnameFromProxyUrl(proxyUrl);
|
|
1051
|
-
const failureCount = recordProxyFailure(hostname);
|
|
1052
|
-
const failureLabel = failureCount === 1 ? "first failure" : `failure #${failureCount}`;
|
|
1053
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1054
|
-
const redactedMessage = redactProxyCredentials(errorMessage);
|
|
1055
|
-
const logMessage = `Failed to create proxy dispatcher for ${hostname} (${failureLabel}), falling back to direct connection: ${redactedMessage}`;
|
|
1056
|
-
debugLogger.warn(logMessage);
|
|
1057
|
-
console.error(`[RUNTIME_FETCH] ${logMessage}`);
|
|
1058
|
-
return NO_DISPATCHER_FALLBACK[sdkType];
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
__name(buildFetchOptionsWithDispatcher, "buildFetchOptionsWithDispatcher");
|
|
1062
|
-
|
|
1063
|
-
// packages/core/src/utils/tool-name-utils.ts
|
|
1064
|
-
init_esbuild_shims();
|
|
1065
|
-
var MAX_TOOL_NAME_LENGTH = 63;
|
|
1066
|
-
var PROVIDER_SAFE_TOOL_NAME = /^[A-Za-z][A-Za-z0-9_-]*$/;
|
|
1067
|
-
function normalizeToolNameForProvider(name) {
|
|
1068
|
-
if (name.length <= MAX_TOOL_NAME_LENGTH && PROVIDER_SAFE_TOOL_NAME.test(name)) {
|
|
1069
|
-
return name;
|
|
1070
|
-
}
|
|
1071
|
-
const normalized = sanitizeToolNameForProvider(name);
|
|
1072
|
-
const suffix = `_${stableToolNameHash(name)}`;
|
|
1073
|
-
return `${normalized.slice(0, MAX_TOOL_NAME_LENGTH - suffix.length)}${suffix}`;
|
|
1074
|
-
}
|
|
1075
|
-
__name(normalizeToolNameForProvider, "normalizeToolNameForProvider");
|
|
1076
|
-
function sanitizeToolNameForProvider(name) {
|
|
1077
|
-
const sanitized = name.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
1078
|
-
return /^[A-Za-z]/.test(sanitized) ? sanitized : `tool_${sanitized}`;
|
|
1079
|
-
}
|
|
1080
|
-
__name(sanitizeToolNameForProvider, "sanitizeToolNameForProvider");
|
|
1081
|
-
function normalizeMcpToolName(name) {
|
|
1082
|
-
return name.startsWith("mcp__") ? normalizeToolNameForProvider(name) : name;
|
|
1083
|
-
}
|
|
1084
|
-
__name(normalizeMcpToolName, "normalizeMcpToolName");
|
|
1085
|
-
function generateLegacyMcpToolName(name) {
|
|
1086
|
-
let legacyName = name.replace(/[^A-Za-z0-9_.-]/g, "_");
|
|
1087
|
-
if (legacyName.length > MAX_TOOL_NAME_LENGTH) {
|
|
1088
|
-
legacyName = legacyName.slice(0, 28) + "___" + legacyName.slice(-32);
|
|
1089
|
-
}
|
|
1090
|
-
return legacyName;
|
|
1091
|
-
}
|
|
1092
|
-
__name(generateLegacyMcpToolName, "generateLegacyMcpToolName");
|
|
1093
|
-
function stableToolNameHash(name) {
|
|
1094
|
-
let hash = 2166136261;
|
|
1095
|
-
for (let index = 0; index < name.length; index += 1) {
|
|
1096
|
-
hash = Math.imul(hash ^ name.charCodeAt(index), 16777619);
|
|
1097
|
-
}
|
|
1098
|
-
return (hash >>> 0).toString(36).padStart(7, "0");
|
|
1099
|
-
}
|
|
1100
|
-
__name(stableToolNameHash, "stableToolNameHash");
|
|
1101
|
-
|
|
1102
|
-
// packages/core/src/utils/safeJsonParse.ts
|
|
1103
|
-
init_esbuild_shims();
|
|
1104
|
-
|
|
1105
|
-
// node_modules/jsonrepair/lib/esm/index.js
|
|
1106
|
-
init_esbuild_shims();
|
|
1107
|
-
|
|
1108
|
-
// node_modules/jsonrepair/lib/esm/regular/jsonrepair.js
|
|
1109
|
-
init_esbuild_shims();
|
|
1110
|
-
|
|
1111
|
-
// node_modules/jsonrepair/lib/esm/utils/JSONRepairError.js
|
|
1112
|
-
init_esbuild_shims();
|
|
1113
|
-
var JSONRepairError = class extends Error {
|
|
1114
|
-
static {
|
|
1115
|
-
__name(this, "JSONRepairError");
|
|
1116
|
-
}
|
|
1117
|
-
constructor(message, position) {
|
|
1118
|
-
super(`${message} at position ${position}`);
|
|
1119
|
-
this.position = position;
|
|
1120
|
-
}
|
|
1121
|
-
};
|
|
1122
|
-
|
|
1123
|
-
// node_modules/jsonrepair/lib/esm/utils/stringUtils.js
|
|
1124
|
-
init_esbuild_shims();
|
|
1125
|
-
var codeSpace = 32;
|
|
1126
|
-
var codeNewline = 10;
|
|
1127
|
-
var codeTab = 9;
|
|
1128
|
-
var codeReturn = 13;
|
|
1129
|
-
var codeNonBreakingSpace = 160;
|
|
1130
|
-
var codeEnQuad = 8192;
|
|
1131
|
-
var codeHairSpace = 8202;
|
|
1132
|
-
var codeNarrowNoBreakSpace = 8239;
|
|
1133
|
-
var codeMediumMathematicalSpace = 8287;
|
|
1134
|
-
var codeIdeographicSpace = 12288;
|
|
1135
|
-
function isHex(char) {
|
|
1136
|
-
return /^[0-9A-Fa-f]$/.test(char);
|
|
1137
|
-
}
|
|
1138
|
-
__name(isHex, "isHex");
|
|
1139
|
-
function isDigit(char) {
|
|
1140
|
-
return char >= "0" && char <= "9";
|
|
1141
|
-
}
|
|
1142
|
-
__name(isDigit, "isDigit");
|
|
1143
|
-
function isValidStringCharacter(char) {
|
|
1144
|
-
return char >= " ";
|
|
1145
|
-
}
|
|
1146
|
-
__name(isValidStringCharacter, "isValidStringCharacter");
|
|
1147
|
-
function isDelimiter(char) {
|
|
1148
|
-
return ",:[]/{}()\n+".includes(char);
|
|
1149
|
-
}
|
|
1150
|
-
__name(isDelimiter, "isDelimiter");
|
|
1151
|
-
function isFunctionNameCharStart(char) {
|
|
1152
|
-
return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$";
|
|
1153
|
-
}
|
|
1154
|
-
__name(isFunctionNameCharStart, "isFunctionNameCharStart");
|
|
1155
|
-
function isFunctionNameChar(char) {
|
|
1156
|
-
return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$" || char >= "0" && char <= "9";
|
|
1157
|
-
}
|
|
1158
|
-
__name(isFunctionNameChar, "isFunctionNameChar");
|
|
1159
|
-
var regexUrlStart = /^(http|https|ftp|mailto|file|data|irc):\/\/$/;
|
|
1160
|
-
var regexUrlChar = /^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;
|
|
1161
|
-
function isUnquotedStringDelimiter(char) {
|
|
1162
|
-
return ",[]/{}\n+".includes(char);
|
|
1163
|
-
}
|
|
1164
|
-
__name(isUnquotedStringDelimiter, "isUnquotedStringDelimiter");
|
|
1165
|
-
function isStartOfValue(char) {
|
|
1166
|
-
return isQuote(char) || regexStartOfValue.test(char);
|
|
1167
|
-
}
|
|
1168
|
-
__name(isStartOfValue, "isStartOfValue");
|
|
1169
|
-
var regexStartOfValue = /^[[{\w-]$/;
|
|
1170
|
-
function isControlCharacter(char) {
|
|
1171
|
-
return char === "\n" || char === "\r" || char === " " || char === "\b" || char === "\f";
|
|
1172
|
-
}
|
|
1173
|
-
__name(isControlCharacter, "isControlCharacter");
|
|
1174
|
-
function isWhitespace(text, index) {
|
|
1175
|
-
const code = text.charCodeAt(index);
|
|
1176
|
-
return code === codeSpace || code === codeNewline || code === codeTab || code === codeReturn;
|
|
1177
|
-
}
|
|
1178
|
-
__name(isWhitespace, "isWhitespace");
|
|
1179
|
-
function isWhitespaceExceptNewline(text, index) {
|
|
1180
|
-
const code = text.charCodeAt(index);
|
|
1181
|
-
return code === codeSpace || code === codeTab || code === codeReturn;
|
|
1182
|
-
}
|
|
1183
|
-
__name(isWhitespaceExceptNewline, "isWhitespaceExceptNewline");
|
|
1184
|
-
function isSpecialWhitespace(text, index) {
|
|
1185
|
-
const code = text.charCodeAt(index);
|
|
1186
|
-
return code === codeNonBreakingSpace || code >= codeEnQuad && code <= codeHairSpace || code === codeNarrowNoBreakSpace || code === codeMediumMathematicalSpace || code === codeIdeographicSpace;
|
|
1187
|
-
}
|
|
1188
|
-
__name(isSpecialWhitespace, "isSpecialWhitespace");
|
|
1189
|
-
function isQuote(char) {
|
|
1190
|
-
return isDoubleQuoteLike(char) || isSingleQuoteLike(char);
|
|
1191
|
-
}
|
|
1192
|
-
__name(isQuote, "isQuote");
|
|
1193
|
-
function isDoubleQuoteLike(char) {
|
|
1194
|
-
return char === '"' || char === "\u201C" || char === "\u201D";
|
|
1195
|
-
}
|
|
1196
|
-
__name(isDoubleQuoteLike, "isDoubleQuoteLike");
|
|
1197
|
-
function isDoubleQuote(char) {
|
|
1198
|
-
return char === '"';
|
|
1199
|
-
}
|
|
1200
|
-
__name(isDoubleQuote, "isDoubleQuote");
|
|
1201
|
-
function isSingleQuoteLike(char) {
|
|
1202
|
-
return char === "'" || char === "\u2018" || char === "\u2019" || char === "`" || char === "\xB4";
|
|
1203
|
-
}
|
|
1204
|
-
__name(isSingleQuoteLike, "isSingleQuoteLike");
|
|
1205
|
-
function isSingleQuote(char) {
|
|
1206
|
-
return char === "'";
|
|
1207
|
-
}
|
|
1208
|
-
__name(isSingleQuote, "isSingleQuote");
|
|
1209
|
-
function stripLastOccurrence(text, textToStrip) {
|
|
1210
|
-
let stripRemainingText = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
1211
|
-
const index = text.lastIndexOf(textToStrip);
|
|
1212
|
-
return index !== -1 ? text.substring(0, index) + (stripRemainingText ? "" : text.substring(index + 1)) : text;
|
|
1213
|
-
}
|
|
1214
|
-
__name(stripLastOccurrence, "stripLastOccurrence");
|
|
1215
|
-
function insertBeforeLastWhitespace(text, textToInsert) {
|
|
1216
|
-
let index = text.length;
|
|
1217
|
-
if (!isWhitespace(text, index - 1)) {
|
|
1218
|
-
return text + textToInsert;
|
|
1219
|
-
}
|
|
1220
|
-
while (isWhitespace(text, index - 1)) {
|
|
1221
|
-
index--;
|
|
1222
|
-
}
|
|
1223
|
-
return text.substring(0, index) + textToInsert + text.substring(index);
|
|
1224
|
-
}
|
|
1225
|
-
__name(insertBeforeLastWhitespace, "insertBeforeLastWhitespace");
|
|
1226
|
-
function removeAtIndex(text, start, count) {
|
|
1227
|
-
return text.substring(0, start) + text.substring(start + count);
|
|
1228
|
-
}
|
|
1229
|
-
__name(removeAtIndex, "removeAtIndex");
|
|
1230
|
-
function endsWithCommaOrNewline(text) {
|
|
1231
|
-
return /[,\n][ \t\r]*$/.test(text);
|
|
1232
|
-
}
|
|
1233
|
-
__name(endsWithCommaOrNewline, "endsWithCommaOrNewline");
|
|
1234
|
-
|
|
1235
|
-
// node_modules/jsonrepair/lib/esm/regular/jsonrepair.js
|
|
1236
|
-
var controlCharacters = {
|
|
1237
|
-
"\b": "\\b",
|
|
1238
|
-
"\f": "\\f",
|
|
1239
|
-
"\n": "\\n",
|
|
1240
|
-
"\r": "\\r",
|
|
1241
|
-
" ": "\\t"
|
|
1242
|
-
};
|
|
1243
|
-
var escapeCharacters = {
|
|
1244
|
-
'"': '"',
|
|
1245
|
-
"\\": "\\",
|
|
1246
|
-
"/": "/",
|
|
1247
|
-
b: "\b",
|
|
1248
|
-
f: "\f",
|
|
1249
|
-
n: "\n",
|
|
1250
|
-
r: "\r",
|
|
1251
|
-
t: " "
|
|
1252
|
-
// note that \u is handled separately in parseString()
|
|
1253
|
-
};
|
|
1254
|
-
function jsonrepair(text) {
|
|
1255
|
-
let i = 0;
|
|
1256
|
-
let output = "";
|
|
1257
|
-
parseMarkdownCodeBlock(["```", "[```", "{```"]);
|
|
1258
|
-
const processed = parseValue();
|
|
1259
|
-
if (!processed) {
|
|
1260
|
-
throwUnexpectedEnd();
|
|
1261
|
-
}
|
|
1262
|
-
parseMarkdownCodeBlock(["```", "```]", "```}"]);
|
|
1263
|
-
const processedComma = parseCharacter(",");
|
|
1264
|
-
if (processedComma) {
|
|
1265
|
-
parseWhitespaceAndSkipComments();
|
|
1266
|
-
}
|
|
1267
|
-
if (isStartOfValue(text[i]) && endsWithCommaOrNewline(output)) {
|
|
1268
|
-
if (!processedComma) {
|
|
1269
|
-
output = insertBeforeLastWhitespace(output, ",");
|
|
1270
|
-
}
|
|
1271
|
-
parseNewlineDelimitedJSON();
|
|
1272
|
-
} else if (processedComma) {
|
|
1273
|
-
output = stripLastOccurrence(output, ",");
|
|
1274
|
-
}
|
|
1275
|
-
while (text[i] === "}" || text[i] === "]") {
|
|
1276
|
-
i++;
|
|
1277
|
-
parseWhitespaceAndSkipComments();
|
|
1278
|
-
}
|
|
1279
|
-
if (i >= text.length) {
|
|
1280
|
-
return output;
|
|
1281
|
-
}
|
|
1282
|
-
throwUnexpectedCharacter();
|
|
1283
|
-
function parseValue() {
|
|
1284
|
-
parseWhitespaceAndSkipComments();
|
|
1285
|
-
const processed2 = parseObject() || parseArray() || parseString() || parseNumber() || parseKeywords() || parseUnquotedString(false) || parseRegex();
|
|
1286
|
-
parseWhitespaceAndSkipComments();
|
|
1287
|
-
return processed2;
|
|
1288
|
-
}
|
|
1289
|
-
__name(parseValue, "parseValue");
|
|
1290
|
-
function parseWhitespaceAndSkipComments() {
|
|
1291
|
-
let skipNewline = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
1292
|
-
const start = i;
|
|
1293
|
-
let changed = parseWhitespace(skipNewline);
|
|
1294
|
-
do {
|
|
1295
|
-
changed = parseComment();
|
|
1296
|
-
if (changed) {
|
|
1297
|
-
changed = parseWhitespace(skipNewline);
|
|
1298
|
-
}
|
|
1299
|
-
} while (changed);
|
|
1300
|
-
return i > start;
|
|
1301
|
-
}
|
|
1302
|
-
__name(parseWhitespaceAndSkipComments, "parseWhitespaceAndSkipComments");
|
|
1303
|
-
function parseWhitespace(skipNewline) {
|
|
1304
|
-
const _isWhiteSpace = skipNewline ? isWhitespace : isWhitespaceExceptNewline;
|
|
1305
|
-
let whitespace = "";
|
|
1306
|
-
while (true) {
|
|
1307
|
-
if (_isWhiteSpace(text, i)) {
|
|
1308
|
-
whitespace += text[i];
|
|
1309
|
-
i++;
|
|
1310
|
-
} else if (isSpecialWhitespace(text, i)) {
|
|
1311
|
-
whitespace += " ";
|
|
1312
|
-
i++;
|
|
1313
|
-
} else {
|
|
1314
|
-
break;
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
if (whitespace.length > 0) {
|
|
1318
|
-
output += whitespace;
|
|
1319
|
-
return true;
|
|
1320
|
-
}
|
|
1321
|
-
return false;
|
|
1322
|
-
}
|
|
1323
|
-
__name(parseWhitespace, "parseWhitespace");
|
|
1324
|
-
function parseComment() {
|
|
1325
|
-
if (text[i] === "/" && text[i + 1] === "*") {
|
|
1326
|
-
while (i < text.length && !atEndOfBlockComment(text, i)) {
|
|
1327
|
-
i++;
|
|
1328
|
-
}
|
|
1329
|
-
i += 2;
|
|
1330
|
-
return true;
|
|
1331
|
-
}
|
|
1332
|
-
if (text[i] === "/" && text[i + 1] === "/") {
|
|
1333
|
-
while (i < text.length && text[i] !== "\n") {
|
|
1334
|
-
i++;
|
|
1335
|
-
}
|
|
1336
|
-
return true;
|
|
1337
|
-
}
|
|
1338
|
-
return false;
|
|
1339
|
-
}
|
|
1340
|
-
__name(parseComment, "parseComment");
|
|
1341
|
-
function parseMarkdownCodeBlock(blocks) {
|
|
1342
|
-
if (skipMarkdownCodeBlock(blocks)) {
|
|
1343
|
-
if (isFunctionNameCharStart(text[i])) {
|
|
1344
|
-
while (i < text.length && isFunctionNameChar(text[i])) {
|
|
1345
|
-
i++;
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
parseWhitespaceAndSkipComments();
|
|
1349
|
-
return true;
|
|
1350
|
-
}
|
|
1351
|
-
return false;
|
|
1352
|
-
}
|
|
1353
|
-
__name(parseMarkdownCodeBlock, "parseMarkdownCodeBlock");
|
|
1354
|
-
function skipMarkdownCodeBlock(blocks) {
|
|
1355
|
-
parseWhitespace(true);
|
|
1356
|
-
for (const block of blocks) {
|
|
1357
|
-
const end = i + block.length;
|
|
1358
|
-
if (text.slice(i, end) === block) {
|
|
1359
|
-
i = end;
|
|
1360
|
-
return true;
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
return false;
|
|
1364
|
-
}
|
|
1365
|
-
__name(skipMarkdownCodeBlock, "skipMarkdownCodeBlock");
|
|
1366
|
-
function parseCharacter(char) {
|
|
1367
|
-
if (text[i] === char) {
|
|
1368
|
-
output += text[i];
|
|
1369
|
-
i++;
|
|
1370
|
-
return true;
|
|
1371
|
-
}
|
|
1372
|
-
return false;
|
|
1373
|
-
}
|
|
1374
|
-
__name(parseCharacter, "parseCharacter");
|
|
1375
|
-
function skipCharacter(char) {
|
|
1376
|
-
if (text[i] === char) {
|
|
1377
|
-
i++;
|
|
1378
|
-
return true;
|
|
1379
|
-
}
|
|
1380
|
-
return false;
|
|
1381
|
-
}
|
|
1382
|
-
__name(skipCharacter, "skipCharacter");
|
|
1383
|
-
function skipEscapeCharacter() {
|
|
1384
|
-
return skipCharacter("\\");
|
|
1385
|
-
}
|
|
1386
|
-
__name(skipEscapeCharacter, "skipEscapeCharacter");
|
|
1387
|
-
function skipEllipsis() {
|
|
1388
|
-
parseWhitespaceAndSkipComments();
|
|
1389
|
-
if (text[i] === "." && text[i + 1] === "." && text[i + 2] === ".") {
|
|
1390
|
-
i += 3;
|
|
1391
|
-
parseWhitespaceAndSkipComments();
|
|
1392
|
-
skipCharacter(",");
|
|
1393
|
-
return true;
|
|
1394
|
-
}
|
|
1395
|
-
return false;
|
|
1396
|
-
}
|
|
1397
|
-
__name(skipEllipsis, "skipEllipsis");
|
|
1398
|
-
function parseObject() {
|
|
1399
|
-
if (text[i] === "{") {
|
|
1400
|
-
output += "{";
|
|
1401
|
-
i++;
|
|
1402
|
-
parseWhitespaceAndSkipComments();
|
|
1403
|
-
if (skipCharacter(",")) {
|
|
1404
|
-
parseWhitespaceAndSkipComments();
|
|
1405
|
-
}
|
|
1406
|
-
let initial = true;
|
|
1407
|
-
while (i < text.length && text[i] !== "}") {
|
|
1408
|
-
let processedComma2;
|
|
1409
|
-
if (!initial) {
|
|
1410
|
-
processedComma2 = parseCharacter(",");
|
|
1411
|
-
if (!processedComma2) {
|
|
1412
|
-
output = insertBeforeLastWhitespace(output, ",");
|
|
1413
|
-
}
|
|
1414
|
-
parseWhitespaceAndSkipComments();
|
|
1415
|
-
} else {
|
|
1416
|
-
processedComma2 = true;
|
|
1417
|
-
initial = false;
|
|
1418
|
-
}
|
|
1419
|
-
skipEllipsis();
|
|
1420
|
-
const processedKey = parseString() || parseUnquotedString(true);
|
|
1421
|
-
if (!processedKey) {
|
|
1422
|
-
if (text[i] === "}" || text[i] === "{" || text[i] === "]" || text[i] === "[" || text[i] === void 0) {
|
|
1423
|
-
output = stripLastOccurrence(output, ",");
|
|
1424
|
-
} else {
|
|
1425
|
-
throwObjectKeyExpected();
|
|
1426
|
-
}
|
|
1427
|
-
break;
|
|
1428
|
-
}
|
|
1429
|
-
parseWhitespaceAndSkipComments();
|
|
1430
|
-
const processedColon = parseCharacter(":");
|
|
1431
|
-
const truncatedText = i >= text.length;
|
|
1432
|
-
if (!processedColon) {
|
|
1433
|
-
if (isStartOfValue(text[i]) || truncatedText) {
|
|
1434
|
-
output = insertBeforeLastWhitespace(output, ":");
|
|
1435
|
-
} else {
|
|
1436
|
-
throwColonExpected();
|
|
1437
|
-
}
|
|
1438
|
-
}
|
|
1439
|
-
const processedValue = parseValue();
|
|
1440
|
-
if (!processedValue) {
|
|
1441
|
-
if (processedColon || truncatedText) {
|
|
1442
|
-
output += "null";
|
|
1443
|
-
} else {
|
|
1444
|
-
throwColonExpected();
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
if (text[i] === "}") {
|
|
1449
|
-
output += "}";
|
|
1450
|
-
i++;
|
|
1451
|
-
} else {
|
|
1452
|
-
output = insertBeforeLastWhitespace(output, "}");
|
|
1453
|
-
}
|
|
1454
|
-
return true;
|
|
1455
|
-
}
|
|
1456
|
-
return false;
|
|
1457
|
-
}
|
|
1458
|
-
__name(parseObject, "parseObject");
|
|
1459
|
-
function parseArray() {
|
|
1460
|
-
if (text[i] === "[") {
|
|
1461
|
-
output += "[";
|
|
1462
|
-
i++;
|
|
1463
|
-
parseWhitespaceAndSkipComments();
|
|
1464
|
-
if (skipCharacter(",")) {
|
|
1465
|
-
parseWhitespaceAndSkipComments();
|
|
1466
|
-
}
|
|
1467
|
-
let initial = true;
|
|
1468
|
-
while (i < text.length && text[i] !== "]") {
|
|
1469
|
-
if (!initial) {
|
|
1470
|
-
const processedComma2 = parseCharacter(",");
|
|
1471
|
-
if (!processedComma2) {
|
|
1472
|
-
output = insertBeforeLastWhitespace(output, ",");
|
|
1473
|
-
}
|
|
1474
|
-
} else {
|
|
1475
|
-
initial = false;
|
|
1476
|
-
}
|
|
1477
|
-
skipEllipsis();
|
|
1478
|
-
const processedValue = parseValue();
|
|
1479
|
-
if (!processedValue) {
|
|
1480
|
-
output = stripLastOccurrence(output, ",");
|
|
1481
|
-
break;
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
if (text[i] === "]") {
|
|
1485
|
-
output += "]";
|
|
1486
|
-
i++;
|
|
1487
|
-
} else {
|
|
1488
|
-
output = insertBeforeLastWhitespace(output, "]");
|
|
1489
|
-
}
|
|
1490
|
-
return true;
|
|
1491
|
-
}
|
|
1492
|
-
return false;
|
|
1493
|
-
}
|
|
1494
|
-
__name(parseArray, "parseArray");
|
|
1495
|
-
function parseNewlineDelimitedJSON() {
|
|
1496
|
-
let initial = true;
|
|
1497
|
-
let processedValue = true;
|
|
1498
|
-
while (processedValue) {
|
|
1499
|
-
if (!initial) {
|
|
1500
|
-
const processedComma2 = parseCharacter(",");
|
|
1501
|
-
if (!processedComma2) {
|
|
1502
|
-
output = insertBeforeLastWhitespace(output, ",");
|
|
1503
|
-
}
|
|
1504
|
-
} else {
|
|
1505
|
-
initial = false;
|
|
1506
|
-
}
|
|
1507
|
-
processedValue = parseValue();
|
|
1508
|
-
}
|
|
1509
|
-
if (!processedValue) {
|
|
1510
|
-
output = stripLastOccurrence(output, ",");
|
|
1511
|
-
}
|
|
1512
|
-
output = `[
|
|
1513
|
-
${output}
|
|
1514
|
-
]`;
|
|
1515
|
-
}
|
|
1516
|
-
__name(parseNewlineDelimitedJSON, "parseNewlineDelimitedJSON");
|
|
1517
|
-
function parseString() {
|
|
1518
|
-
let stopAtDelimiter = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
1519
|
-
let stopAtIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -1;
|
|
1520
|
-
let skipEscapeChars = text[i] === "\\";
|
|
1521
|
-
if (skipEscapeChars) {
|
|
1522
|
-
i++;
|
|
1523
|
-
skipEscapeChars = true;
|
|
1524
|
-
}
|
|
1525
|
-
if (isQuote(text[i])) {
|
|
1526
|
-
const isEndQuote = isDoubleQuote(text[i]) ? isDoubleQuote : isSingleQuote(text[i]) ? isSingleQuote : isSingleQuoteLike(text[i]) ? isSingleQuoteLike : isDoubleQuoteLike;
|
|
1527
|
-
const iBefore = i;
|
|
1528
|
-
const oBefore = output.length;
|
|
1529
|
-
let str = '"';
|
|
1530
|
-
i++;
|
|
1531
|
-
while (true) {
|
|
1532
|
-
if (i >= text.length) {
|
|
1533
|
-
const iPrev = prevNonWhitespaceIndex(i - 1);
|
|
1534
|
-
if (!stopAtDelimiter && isDelimiter(text.charAt(iPrev))) {
|
|
1535
|
-
i = iBefore;
|
|
1536
|
-
output = output.substring(0, oBefore);
|
|
1537
|
-
return parseString(true);
|
|
1538
|
-
}
|
|
1539
|
-
str = insertBeforeLastWhitespace(str, '"');
|
|
1540
|
-
output += str;
|
|
1541
|
-
return true;
|
|
1542
|
-
}
|
|
1543
|
-
if (i === stopAtIndex) {
|
|
1544
|
-
str = insertBeforeLastWhitespace(str, '"');
|
|
1545
|
-
output += str;
|
|
1546
|
-
return true;
|
|
1547
|
-
}
|
|
1548
|
-
if (isEndQuote(text[i])) {
|
|
1549
|
-
const iQuote = i;
|
|
1550
|
-
const oQuote = str.length;
|
|
1551
|
-
str += '"';
|
|
1552
|
-
i++;
|
|
1553
|
-
output += str;
|
|
1554
|
-
parseWhitespaceAndSkipComments(false);
|
|
1555
|
-
if (stopAtDelimiter || i >= text.length || isDelimiter(text[i]) || isQuote(text[i]) || isDigit(text[i])) {
|
|
1556
|
-
parseConcatenatedString();
|
|
1557
|
-
return true;
|
|
1558
|
-
}
|
|
1559
|
-
const iPrevChar = prevNonWhitespaceIndex(iQuote - 1);
|
|
1560
|
-
const prevChar = text.charAt(iPrevChar);
|
|
1561
|
-
if (prevChar === ",") {
|
|
1562
|
-
i = iBefore;
|
|
1563
|
-
output = output.substring(0, oBefore);
|
|
1564
|
-
return parseString(false, iPrevChar);
|
|
1565
|
-
}
|
|
1566
|
-
if (isDelimiter(prevChar)) {
|
|
1567
|
-
i = iBefore;
|
|
1568
|
-
output = output.substring(0, oBefore);
|
|
1569
|
-
return parseString(true);
|
|
1570
|
-
}
|
|
1571
|
-
output = output.substring(0, oBefore);
|
|
1572
|
-
i = iQuote + 1;
|
|
1573
|
-
str = `${str.substring(0, oQuote)}\\${str.substring(oQuote)}`;
|
|
1574
|
-
} else if (stopAtDelimiter && isUnquotedStringDelimiter(text[i])) {
|
|
1575
|
-
if (text[i - 1] === ":" && regexUrlStart.test(text.substring(iBefore + 1, i + 2))) {
|
|
1576
|
-
while (i < text.length && regexUrlChar.test(text[i])) {
|
|
1577
|
-
str += text[i];
|
|
1578
|
-
i++;
|
|
1579
|
-
}
|
|
1580
|
-
}
|
|
1581
|
-
str = insertBeforeLastWhitespace(str, '"');
|
|
1582
|
-
output += str;
|
|
1583
|
-
parseConcatenatedString();
|
|
1584
|
-
return true;
|
|
1585
|
-
} else if (text[i] === "\\") {
|
|
1586
|
-
const char = text.charAt(i + 1);
|
|
1587
|
-
const escapeChar = escapeCharacters[char];
|
|
1588
|
-
if (escapeChar !== void 0) {
|
|
1589
|
-
str += text.slice(i, i + 2);
|
|
1590
|
-
i += 2;
|
|
1591
|
-
} else if (char === "u") {
|
|
1592
|
-
let j = 2;
|
|
1593
|
-
while (j < 6 && isHex(text[i + j])) {
|
|
1594
|
-
j++;
|
|
1595
|
-
}
|
|
1596
|
-
if (j === 6) {
|
|
1597
|
-
str += text.slice(i, i + 6);
|
|
1598
|
-
i += 6;
|
|
1599
|
-
} else if (i + j >= text.length) {
|
|
1600
|
-
i = text.length;
|
|
1601
|
-
} else {
|
|
1602
|
-
throwInvalidUnicodeCharacter();
|
|
1603
|
-
}
|
|
1604
|
-
} else {
|
|
1605
|
-
str += char;
|
|
1606
|
-
i += 2;
|
|
1607
|
-
}
|
|
1608
|
-
} else {
|
|
1609
|
-
const char = text.charAt(i);
|
|
1610
|
-
if (char === '"' && text[i - 1] !== "\\") {
|
|
1611
|
-
str += `\\${char}`;
|
|
1612
|
-
i++;
|
|
1613
|
-
} else if (isControlCharacter(char)) {
|
|
1614
|
-
str += controlCharacters[char];
|
|
1615
|
-
i++;
|
|
1616
|
-
} else {
|
|
1617
|
-
if (!isValidStringCharacter(char)) {
|
|
1618
|
-
throwInvalidCharacter(char);
|
|
1619
|
-
}
|
|
1620
|
-
str += char;
|
|
1621
|
-
i++;
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
if (skipEscapeChars) {
|
|
1625
|
-
skipEscapeCharacter();
|
|
1626
|
-
}
|
|
1627
|
-
}
|
|
1628
|
-
}
|
|
1629
|
-
return false;
|
|
1630
|
-
}
|
|
1631
|
-
__name(parseString, "parseString");
|
|
1632
|
-
function parseConcatenatedString() {
|
|
1633
|
-
let processed2 = false;
|
|
1634
|
-
parseWhitespaceAndSkipComments();
|
|
1635
|
-
while (text[i] === "+") {
|
|
1636
|
-
processed2 = true;
|
|
1637
|
-
i++;
|
|
1638
|
-
parseWhitespaceAndSkipComments();
|
|
1639
|
-
output = stripLastOccurrence(output, '"', true);
|
|
1640
|
-
const start = output.length;
|
|
1641
|
-
const parsedStr = parseString();
|
|
1642
|
-
if (parsedStr) {
|
|
1643
|
-
output = removeAtIndex(output, start, 1);
|
|
1644
|
-
} else {
|
|
1645
|
-
output = insertBeforeLastWhitespace(output, '"');
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
return processed2;
|
|
1649
|
-
}
|
|
1650
|
-
__name(parseConcatenatedString, "parseConcatenatedString");
|
|
1651
|
-
function parseNumber() {
|
|
1652
|
-
const start = i;
|
|
1653
|
-
if (text[i] === "-") {
|
|
1654
|
-
i++;
|
|
1655
|
-
if (atEndOfNumber()) {
|
|
1656
|
-
repairNumberEndingWithNumericSymbol(start);
|
|
1657
|
-
return true;
|
|
1658
|
-
}
|
|
1659
|
-
if (!isDigit(text[i])) {
|
|
1660
|
-
i = start;
|
|
1661
|
-
return false;
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1664
|
-
while (isDigit(text[i])) {
|
|
1665
|
-
i++;
|
|
1666
|
-
}
|
|
1667
|
-
if (text[i] === ".") {
|
|
1668
|
-
i++;
|
|
1669
|
-
if (atEndOfNumber()) {
|
|
1670
|
-
repairNumberEndingWithNumericSymbol(start);
|
|
1671
|
-
return true;
|
|
1672
|
-
}
|
|
1673
|
-
if (!isDigit(text[i])) {
|
|
1674
|
-
i = start;
|
|
1675
|
-
return false;
|
|
1676
|
-
}
|
|
1677
|
-
while (isDigit(text[i])) {
|
|
1678
|
-
i++;
|
|
1679
|
-
}
|
|
1680
|
-
}
|
|
1681
|
-
if (text[i] === "e" || text[i] === "E") {
|
|
1682
|
-
i++;
|
|
1683
|
-
if (text[i] === "-" || text[i] === "+") {
|
|
1684
|
-
i++;
|
|
1685
|
-
}
|
|
1686
|
-
if (atEndOfNumber()) {
|
|
1687
|
-
repairNumberEndingWithNumericSymbol(start);
|
|
1688
|
-
return true;
|
|
1689
|
-
}
|
|
1690
|
-
if (!isDigit(text[i])) {
|
|
1691
|
-
i = start;
|
|
1692
|
-
return false;
|
|
1693
|
-
}
|
|
1694
|
-
while (isDigit(text[i])) {
|
|
1695
|
-
i++;
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
if (!atEndOfNumber()) {
|
|
1699
|
-
i = start;
|
|
1700
|
-
return false;
|
|
1701
|
-
}
|
|
1702
|
-
if (i > start) {
|
|
1703
|
-
const num = text.slice(start, i);
|
|
1704
|
-
const hasInvalidLeadingZero = /^0\d/.test(num);
|
|
1705
|
-
output += hasInvalidLeadingZero ? `"${num}"` : num;
|
|
1706
|
-
return true;
|
|
1707
|
-
}
|
|
1708
|
-
return false;
|
|
1709
|
-
}
|
|
1710
|
-
__name(parseNumber, "parseNumber");
|
|
1711
|
-
function parseKeywords() {
|
|
1712
|
-
return parseKeyword("true", "true") || parseKeyword("false", "false") || parseKeyword("null", "null") || // repair Python keywords True, False, None
|
|
1713
|
-
parseKeyword("True", "true") || parseKeyword("False", "false") || parseKeyword("None", "null");
|
|
1714
|
-
}
|
|
1715
|
-
__name(parseKeywords, "parseKeywords");
|
|
1716
|
-
function parseKeyword(name, value) {
|
|
1717
|
-
if (text.slice(i, i + name.length) === name) {
|
|
1718
|
-
output += value;
|
|
1719
|
-
i += name.length;
|
|
1720
|
-
return true;
|
|
1721
|
-
}
|
|
1722
|
-
return false;
|
|
1723
|
-
}
|
|
1724
|
-
__name(parseKeyword, "parseKeyword");
|
|
1725
|
-
function parseUnquotedString(isKey) {
|
|
1726
|
-
const start = i;
|
|
1727
|
-
if (isFunctionNameCharStart(text[i])) {
|
|
1728
|
-
while (i < text.length && isFunctionNameChar(text[i])) {
|
|
1729
|
-
i++;
|
|
1730
|
-
}
|
|
1731
|
-
let j = i;
|
|
1732
|
-
while (isWhitespace(text, j)) {
|
|
1733
|
-
j++;
|
|
1734
|
-
}
|
|
1735
|
-
if (text[j] === "(") {
|
|
1736
|
-
i = j + 1;
|
|
1737
|
-
parseValue();
|
|
1738
|
-
if (text[i] === ")") {
|
|
1739
|
-
i++;
|
|
1740
|
-
if (text[i] === ";") {
|
|
1741
|
-
i++;
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
-
return true;
|
|
1745
|
-
}
|
|
1746
|
-
}
|
|
1747
|
-
while (i < text.length && !isUnquotedStringDelimiter(text[i]) && !isQuote(text[i]) && (!isKey || text[i] !== ":")) {
|
|
1748
|
-
i++;
|
|
1749
|
-
}
|
|
1750
|
-
if (text[i - 1] === ":" && regexUrlStart.test(text.substring(start, i + 2))) {
|
|
1751
|
-
while (i < text.length && regexUrlChar.test(text[i])) {
|
|
1752
|
-
i++;
|
|
1753
|
-
}
|
|
1754
|
-
}
|
|
1755
|
-
if (i > start) {
|
|
1756
|
-
while (isWhitespace(text, i - 1) && i > 0) {
|
|
1757
|
-
i--;
|
|
1758
|
-
}
|
|
1759
|
-
const symbol = text.slice(start, i);
|
|
1760
|
-
output += symbol === "undefined" ? "null" : JSON.stringify(symbol);
|
|
1761
|
-
if (text[i] === '"') {
|
|
1762
|
-
i++;
|
|
1763
|
-
}
|
|
1764
|
-
return true;
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
__name(parseUnquotedString, "parseUnquotedString");
|
|
1768
|
-
function parseRegex() {
|
|
1769
|
-
if (text[i] === "/") {
|
|
1770
|
-
const start = i;
|
|
1771
|
-
i++;
|
|
1772
|
-
while (i < text.length && (text[i] !== "/" || text[i - 1] === "\\")) {
|
|
1773
|
-
i++;
|
|
1774
|
-
}
|
|
1775
|
-
i++;
|
|
1776
|
-
output += `"${text.substring(start, i)}"`;
|
|
1777
|
-
return true;
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
__name(parseRegex, "parseRegex");
|
|
1781
|
-
function prevNonWhitespaceIndex(start) {
|
|
1782
|
-
let prev = start;
|
|
1783
|
-
while (prev > 0 && isWhitespace(text, prev)) {
|
|
1784
|
-
prev--;
|
|
1785
|
-
}
|
|
1786
|
-
return prev;
|
|
1787
|
-
}
|
|
1788
|
-
__name(prevNonWhitespaceIndex, "prevNonWhitespaceIndex");
|
|
1789
|
-
function atEndOfNumber() {
|
|
1790
|
-
return i >= text.length || isDelimiter(text[i]) || isWhitespace(text, i);
|
|
1791
|
-
}
|
|
1792
|
-
__name(atEndOfNumber, "atEndOfNumber");
|
|
1793
|
-
function repairNumberEndingWithNumericSymbol(start) {
|
|
1794
|
-
output += `${text.slice(start, i)}0`;
|
|
1795
|
-
}
|
|
1796
|
-
__name(repairNumberEndingWithNumericSymbol, "repairNumberEndingWithNumericSymbol");
|
|
1797
|
-
function throwInvalidCharacter(char) {
|
|
1798
|
-
throw new JSONRepairError(`Invalid character ${JSON.stringify(char)}`, i);
|
|
1799
|
-
}
|
|
1800
|
-
__name(throwInvalidCharacter, "throwInvalidCharacter");
|
|
1801
|
-
function throwUnexpectedCharacter() {
|
|
1802
|
-
throw new JSONRepairError(`Unexpected character ${JSON.stringify(text[i])}`, i);
|
|
1803
|
-
}
|
|
1804
|
-
__name(throwUnexpectedCharacter, "throwUnexpectedCharacter");
|
|
1805
|
-
function throwUnexpectedEnd() {
|
|
1806
|
-
throw new JSONRepairError("Unexpected end of json string", text.length);
|
|
1807
|
-
}
|
|
1808
|
-
__name(throwUnexpectedEnd, "throwUnexpectedEnd");
|
|
1809
|
-
function throwObjectKeyExpected() {
|
|
1810
|
-
throw new JSONRepairError("Object key expected", i);
|
|
1811
|
-
}
|
|
1812
|
-
__name(throwObjectKeyExpected, "throwObjectKeyExpected");
|
|
1813
|
-
function throwColonExpected() {
|
|
1814
|
-
throw new JSONRepairError("Colon expected", i);
|
|
1815
|
-
}
|
|
1816
|
-
__name(throwColonExpected, "throwColonExpected");
|
|
1817
|
-
function throwInvalidUnicodeCharacter() {
|
|
1818
|
-
const chars = text.slice(i, i + 6);
|
|
1819
|
-
throw new JSONRepairError(`Invalid unicode character "${chars}"`, i);
|
|
1820
|
-
}
|
|
1821
|
-
__name(throwInvalidUnicodeCharacter, "throwInvalidUnicodeCharacter");
|
|
1822
|
-
}
|
|
1823
|
-
__name(jsonrepair, "jsonrepair");
|
|
1824
|
-
function atEndOfBlockComment(text, i) {
|
|
1825
|
-
return text[i] === "*" && text[i + 1] === "/";
|
|
1826
|
-
}
|
|
1827
|
-
__name(atEndOfBlockComment, "atEndOfBlockComment");
|
|
1828
|
-
|
|
1829
|
-
// packages/core/src/utils/safeJsonParse.ts
|
|
1830
|
-
var debugLogger2 = createDebugLogger("JSON_PARSE");
|
|
1831
|
-
function safeJsonParse(jsonString, fallbackValue = {}) {
|
|
1832
|
-
if (!jsonString || typeof jsonString !== "string") {
|
|
1833
|
-
return fallbackValue;
|
|
1834
|
-
}
|
|
1835
|
-
try {
|
|
1836
|
-
return JSON.parse(jsonString);
|
|
1837
|
-
} catch (error) {
|
|
1838
|
-
try {
|
|
1839
|
-
const repairedJson = jsonrepair(jsonString);
|
|
1840
|
-
return JSON.parse(repairedJson);
|
|
1841
|
-
} catch (repairError) {
|
|
1842
|
-
debugLogger2.error("Failed to parse JSON even with jsonrepair:", {
|
|
1843
|
-
originalError: error,
|
|
1844
|
-
repairError,
|
|
1845
|
-
jsonString
|
|
1846
|
-
});
|
|
1847
|
-
return fallbackValue;
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
1850
|
-
}
|
|
1851
|
-
__name(safeJsonParse, "safeJsonParse");
|
|
1852
|
-
|
|
1853
|
-
// packages/core/src/utils/schemaConverter.ts
|
|
1854
|
-
init_esbuild_shims();
|
|
1855
|
-
function convertSchema(schema, mode = "auto") {
|
|
1856
|
-
if (mode === "openapi_30") {
|
|
1857
|
-
return toOpenAPI30(schema);
|
|
1858
|
-
}
|
|
1859
|
-
return schema;
|
|
1860
|
-
}
|
|
1861
|
-
__name(convertSchema, "convertSchema");
|
|
1862
|
-
function toOpenAPI30(schema) {
|
|
1863
|
-
const convert = /* @__PURE__ */ __name((obj) => {
|
|
1864
|
-
if (typeof obj !== "object" || obj === null) {
|
|
1865
|
-
return obj;
|
|
1866
|
-
}
|
|
1867
|
-
if (Array.isArray(obj)) {
|
|
1868
|
-
return obj.map(convert);
|
|
1869
|
-
}
|
|
1870
|
-
const source = obj;
|
|
1871
|
-
const target = {};
|
|
1872
|
-
if (Array.isArray(source["type"])) {
|
|
1873
|
-
const types = source["type"];
|
|
1874
|
-
if (types.length === 2 && types.includes("null")) {
|
|
1875
|
-
target["type"] = types.find((t) => t !== "null");
|
|
1876
|
-
target["nullable"] = true;
|
|
1877
|
-
} else {
|
|
1878
|
-
target["type"] = types.find((t) => t !== "null") ?? types[0];
|
|
1879
|
-
if (types.includes("null")) {
|
|
1880
|
-
target["nullable"] = true;
|
|
1881
|
-
}
|
|
1882
|
-
}
|
|
1883
|
-
} else if (source["type"] !== void 0) {
|
|
1884
|
-
target["type"] = source["type"];
|
|
1885
|
-
}
|
|
1886
|
-
if (source["const"] !== void 0) {
|
|
1887
|
-
target["enum"] = [source["const"]];
|
|
1888
|
-
delete target["const"];
|
|
1889
|
-
}
|
|
1890
|
-
if (typeof source["exclusiveMinimum"] === "number") {
|
|
1891
|
-
target["minimum"] = source["exclusiveMinimum"];
|
|
1892
|
-
target["exclusiveMinimum"] = true;
|
|
1893
|
-
}
|
|
1894
|
-
if (typeof source["exclusiveMaximum"] === "number") {
|
|
1895
|
-
target["maximum"] = source["exclusiveMaximum"];
|
|
1896
|
-
target["exclusiveMaximum"] = true;
|
|
1897
|
-
}
|
|
1898
|
-
if (Array.isArray(source["items"])) {
|
|
1899
|
-
delete target["items"];
|
|
1900
|
-
} else if (typeof source["items"] === "object" && source["items"] !== null) {
|
|
1901
|
-
target["items"] = convert(source["items"]);
|
|
1902
|
-
}
|
|
1903
|
-
if (Array.isArray(source["enum"])) {
|
|
1904
|
-
target["enum"] = source["enum"].map(String);
|
|
1905
|
-
}
|
|
1906
|
-
for (const [key, value] of Object.entries(source)) {
|
|
1907
|
-
if (key === "type" || key === "const" || key === "exclusiveMinimum" || key === "exclusiveMaximum" || key === "items" || key === "enum" || key === "$schema" || key === "$id" || key === "default" || // Optional: Gemini sometimes complains about defaults conflicting with types
|
|
1908
|
-
key === "dependencies" || key === "patternProperties") {
|
|
1909
|
-
continue;
|
|
1910
|
-
}
|
|
1911
|
-
target[key] = convert(value);
|
|
1912
|
-
}
|
|
1913
|
-
return target;
|
|
1914
|
-
}, "convert");
|
|
1915
|
-
return convert(schema);
|
|
1916
|
-
}
|
|
1917
|
-
__name(toOpenAPI30, "toOpenAPI30");
|
|
1918
|
-
function relaxSchemaForFunctionCalling(schema) {
|
|
1919
|
-
const relax = /* @__PURE__ */ __name((obj) => {
|
|
1920
|
-
if (typeof obj !== "object" || obj === null) {
|
|
1921
|
-
return obj;
|
|
1922
|
-
}
|
|
1923
|
-
if (Array.isArray(obj)) {
|
|
1924
|
-
return obj.map(relax);
|
|
1925
|
-
}
|
|
1926
|
-
const source = obj;
|
|
1927
|
-
const target = {};
|
|
1928
|
-
const properties = source["properties"];
|
|
1929
|
-
const required = Array.isArray(source["required"]) ? source["required"].filter(
|
|
1930
|
-
(r) => typeof r === "string"
|
|
1931
|
-
) : [];
|
|
1932
|
-
const hasOptionalProperties = typeof properties === "object" && properties !== null && !Array.isArray(properties) && Object.keys(properties).some((key) => !required.includes(key));
|
|
1933
|
-
for (const [key, value] of Object.entries(source)) {
|
|
1934
|
-
if (key === "$schema" || key === "$id") {
|
|
1935
|
-
continue;
|
|
1936
|
-
}
|
|
1937
|
-
if (key === "additionalProperties" && value === false && hasOptionalProperties) {
|
|
1938
|
-
continue;
|
|
1939
|
-
}
|
|
1940
|
-
if ((key === "properties" || key === "$defs" || key === "definitions") && typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
1941
|
-
const map = {};
|
|
1942
|
-
for (const [mapKey, mapValue] of Object.entries(
|
|
1943
|
-
value
|
|
1944
|
-
)) {
|
|
1945
|
-
map[mapKey] = relax(mapValue);
|
|
1946
|
-
}
|
|
1947
|
-
target[key] = map;
|
|
1948
|
-
continue;
|
|
1949
|
-
}
|
|
1950
|
-
target[key] = relax(value);
|
|
1951
|
-
}
|
|
1952
|
-
return target;
|
|
1953
|
-
}, "relax");
|
|
1954
|
-
return relax(schema);
|
|
1955
|
-
}
|
|
1956
|
-
__name(relaxSchemaForFunctionCalling, "relaxSchemaForFunctionCalling");
|
|
1957
|
-
|
|
1958
|
-
export {
|
|
1959
|
-
DEFAULT_TOKEN_LIMIT,
|
|
1960
|
-
DEFAULT_OUTPUT_TOKEN_LIMIT,
|
|
1961
|
-
ESCALATED_MAX_TOKENS,
|
|
1962
|
-
OUTPUT_TOKEN_CEILING,
|
|
1963
|
-
MIN_CLAMPED_OUTPUT_TOKENS,
|
|
1964
|
-
outputClampMargin,
|
|
1965
|
-
clampOutputTokensToWindow,
|
|
1966
|
-
parsePositiveIntegerEnvValue,
|
|
1967
|
-
normalize,
|
|
1968
|
-
hasExplicitOutputLimit,
|
|
1969
|
-
knownTokenLimit,
|
|
1970
|
-
tokenLimit,
|
|
1971
|
-
defaultOutputCeiling,
|
|
1972
|
-
reconcileMaxTokens,
|
|
1973
|
-
TOKEN_ESTIMATE_UNITS_PER_TOKEN,
|
|
1974
|
-
estimateTextTokens,
|
|
1975
|
-
estimateTextTokenUnits,
|
|
1976
|
-
TextTokenizer,
|
|
1977
|
-
normalizeToolNameForProvider,
|
|
1978
|
-
sanitizeToolNameForProvider,
|
|
1979
|
-
normalizeMcpToolName,
|
|
1980
|
-
generateLegacyMcpToolName,
|
|
1981
|
-
safeJsonParse,
|
|
1982
|
-
convertSchema,
|
|
1983
|
-
relaxSchemaForFunctionCalling,
|
|
1984
|
-
setToolCallPreparations,
|
|
1985
|
-
getToolCallPreparations,
|
|
1986
|
-
isRuntimeDiagnosticsEnabled,
|
|
1987
|
-
RuntimeDiagnosticsCollector,
|
|
1988
|
-
runtimeDiagnostics,
|
|
1989
|
-
summarizeOpenAIWireRequest,
|
|
1990
|
-
summarizeAnthropicWireRequest,
|
|
1991
|
-
loadUndici,
|
|
1992
|
-
preloadRuntimeFetchModule,
|
|
1993
|
-
isTlsVerificationDisabled,
|
|
1994
|
-
detectRuntime,
|
|
1995
|
-
buildRuntimeFetchOptions,
|
|
1996
|
-
getOrCreateSharedDispatcher,
|
|
1997
|
-
redactProxyCredentials,
|
|
1998
|
-
redactProxyError
|
|
1999
|
-
};
|
|
2000
|
-
/**
|
|
2001
|
-
* @license
|
|
2002
|
-
* Copyright 2025 Qwen
|
|
2003
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
2004
|
-
*/
|
|
2005
|
-
/**
|
|
2006
|
-
* @license
|
|
2007
|
-
* Copyright 2025 Google LLC
|
|
2008
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
2009
|
-
*/
|
|
2010
|
-
/**
|
|
2011
|
-
* @license
|
|
2012
|
-
* Copyright 2026 Qwen
|
|
2013
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
2014
|
-
*/
|
|
2015
|
-
/**
|
|
2016
|
-
* @license
|
|
2017
|
-
* Copyright 2025 Qwen Team
|
|
2018
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
2019
|
-
*/
|