@qwen-code/qwen-code 0.20.0 → 0.20.1-nightly.20260724.7d17c44a3
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 +1 -1
- package/bundled/qc-helper/docs/features/auto-mode.md +19 -16
- package/bundled/qc-helper/docs/features/commands.md +54 -0
- package/bundled/qc-helper/docs/features/sub-agents.md +16 -7
- package/bundled/qc-helper/docs/integration-github-action.md +1 -1
- package/bundled/qc-helper/docs/qwen-serve.md +2 -1
- package/bundled/review/DESIGN.md +2 -2
- package/bundled/review/SKILL.md +7 -5
- package/chunks/MaxSizedBox-LGRTXB47.js +84 -0
- package/chunks/{StandaloneSessionPicker-CEGO2AZX.js → StandaloneSessionPicker-H3TBU3C3.js} +68 -56
- package/chunks/{acp-startup-profiler-N3RHHXJ3.js → acp-startup-profiler-RV3IV562.js} +2 -2
- package/chunks/{acpAgent-YUR43TLG.js → acpAgent-5D7P4BB5.js} +2061 -556
- package/chunks/agent-W7UAHCCI.js +80 -0
- package/chunks/agent-headless-KTBMPRSC.js +74 -0
- package/chunks/{anthropicContentGenerator-HVKLXOOU.js → anthropicContentGenerator-ZLQ3X2HI.js} +112 -45
- package/chunks/{artifact-tool-WBCAMD3O.js → artifact-tool-OKMWONT6.js} +3 -3
- package/chunks/{askUserQuestion-6DZC4UV5.js → askUserQuestion-V6FUS23G.js} +3 -3
- package/chunks/bridge-FFC4C6VD.js +89 -0
- package/chunks/{build-SSCNEHZZ.js → build-RV63TIRH.js} +2 -3
- package/chunks/{ca-2SL2BXTK.js → ca-GKRQZ7AM.js} +612 -201
- package/chunks/{channel-worker-group-53CMOPFT.js → channel-worker-group-MA3WXWYX.js} +7 -6
- package/chunks/{channel-worker-manager-UTXILKC2.js → channel-worker-manager-TIYYYBCT.js} +189 -29
- package/chunks/{channel-worker-supervisor-ZGO2W2MD.js → channel-worker-supervisor-CXRCDA4Y.js} +6 -5
- package/chunks/{chunk-TYQMGACW.js → chunk-22C7BQ6D.js} +508 -10967
- package/chunks/{chunk-4EP2PYYL.js → chunk-2G6QIHYL.js} +5 -5
- package/chunks/{chunk-H2XVO6NE.js → chunk-2MIN6GRR.js} +1 -1
- package/chunks/chunk-2RFKHEXL.js +74 -0
- package/chunks/{chunk-7SXZC7ID.js → chunk-2WTVWAKT.js} +7 -6
- package/chunks/{chunk-TIH2ZTOC.js → chunk-32A4PI3E.js} +2 -2
- package/chunks/chunk-36HSVBBU.js +469 -0
- package/chunks/{chunk-IR46U7RB.js → chunk-3FB2Y2OE.js} +3 -3
- package/chunks/{chunk-QR6U5QPP.js → chunk-3SJ43L4W.js} +4 -0
- package/chunks/chunk-3Z43GZUQ.js +32 -0
- package/chunks/chunk-43T5WDQ7.js +127 -0
- package/chunks/chunk-46UV252V.js +128 -0
- package/chunks/{chunk-JD3MKVKL.js → chunk-4K56OJFJ.js} +1 -1
- package/chunks/{chunk-KTUQMDEP.js → chunk-4K7VDKAD.js} +1 -1
- package/chunks/{chunk-QKYTTBYW.js → chunk-4LVZNIDO.js} +1 -1
- package/chunks/{chunk-OWCALFEG.js → chunk-54R2CV2G.js} +1 -1
- package/chunks/{chunk-ZEOZL37W.js → chunk-57FIIFJN.js} +1 -1
- package/chunks/chunk-5BS3KLRP.js +6194 -0
- package/chunks/{chunk-NEEB7UEN.js → chunk-6GMVPFB2.js} +153 -72
- package/chunks/{chunk-GMGDLUC7.js → chunk-6IL7KRLE.js} +1 -1
- package/chunks/chunk-6PVPNMXU.js +29 -0
- package/chunks/chunk-6QHAUJUE.js +293 -0
- package/chunks/chunk-6VK3IRTX.js +10017 -0
- package/chunks/{chunk-BDBMYST4.js → chunk-6X4GWOPW.js} +1 -1
- package/chunks/{chunk-AYCDXHZB.js → chunk-7Z6JQEL6.js} +1 -1
- package/chunks/{chunk-FSL5W5TI.js → chunk-AFFGGOF6.js} +4 -4
- package/chunks/chunk-AMDSOFFV.js +10860 -0
- package/chunks/chunk-AXUW635Q.js +934 -0
- package/chunks/{chunk-A5LYNIW7.js → chunk-BJBUDCM3.js} +8 -8
- package/chunks/chunk-BK2UNYWD.js +29 -0
- package/chunks/{chunk-6RLROE6G.js → chunk-BLFVGB7D.js} +30 -4
- package/chunks/chunk-BPJSQIJX.js +100 -0
- package/chunks/{chunk-FLSVD6BS.js → chunk-BRTR7S7O.js} +3 -3
- package/chunks/{chunk-KG3XV6FH.js → chunk-BSNWBC33.js} +32 -2
- package/chunks/chunk-BULDBTYC.js +153 -0
- package/chunks/{chunk-PBWEWI4N.js → chunk-BW5Z5NOG.js} +83 -74
- package/chunks/{chunk-EIAK6Q2B.js → chunk-C3VHAXP2.js} +20 -3
- package/chunks/{chunk-6AFUCL3D.js → chunk-CEZB3XFD.js} +1 -1
- package/chunks/chunk-CHMENNJV.js +1832 -0
- package/chunks/{chunk-TMQ6XQCX.js → chunk-CK3IEEHR.js} +416 -291
- package/chunks/{chunk-OYZWQNWG.js → chunk-CK6UABV2.js} +2 -2
- package/chunks/{chunk-VZQUV7VK.js → chunk-CKTMY3EP.js} +1 -1
- package/chunks/{chunk-VDWBQ5AW.js → chunk-CUPAVLRY.js} +5 -2
- package/chunks/{chunk-I2PYAYFM.js → chunk-CXUFILV3.js} +3 -3
- package/chunks/chunk-DP3IHZGG.js +1498 -0
- package/chunks/{chunk-BMWMT5Y2.js → chunk-DP5GT2MW.js} +7 -375
- package/chunks/{chunk-D22SX43D.js → chunk-DWNZ6PVQ.js} +1 -1
- package/chunks/{chunk-5SCI6E3E.js → chunk-E4IMU4Y5.js} +1 -1
- package/chunks/{chunk-DP5GXXNZ.js → chunk-EL2IQ2S5.js} +5 -1
- package/chunks/{chunk-EZVDJFZ7.js → chunk-ERLGR7GI.js} +1 -1
- package/chunks/{chunk-IVPSS6EL.js → chunk-F5MBYZSU.js} +4 -4
- package/chunks/{chunk-AQIEINAY.js → chunk-F6IYL66A.js} +28 -1766
- package/chunks/{chunk-FEOZBUMT.js → chunk-FODK6UMO.js} +0 -27
- package/chunks/{chunk-PGEPSDJI.js → chunk-FWNZ7CVN.js} +24 -20
- package/chunks/{chunk-5JBR5XIK.js → chunk-G7EFBBVF.js} +220 -141
- package/chunks/chunk-GLNBDYUX.js +38 -0
- package/chunks/{chunk-ANPINBOF.js → chunk-H4YKEV2X.js} +5 -5
- package/chunks/{chunk-TDKQP3M6.js → chunk-HIJQF5B5.js} +1 -1
- package/chunks/{chunk-FQD7GFSV.js → chunk-HJJDKFL5.js} +3 -3
- package/chunks/{chunk-4N3KMAIL.js → chunk-HPWHDJID.js} +152 -35
- package/chunks/{chunk-KQNM4EO7.js → chunk-HQCSRJ3P.js} +138 -6
- package/chunks/chunk-HTR4WV6U.js +327 -0
- package/chunks/{chunk-YWEW33JY.js → chunk-HVO55LUD.js} +7 -7
- package/chunks/{chunk-MJ6S23WZ.js → chunk-HZEWYOVI.js} +5 -5
- package/chunks/chunk-IFG6TYJ2.js +16577 -0
- package/chunks/{chunk-B3KGZCQN.js → chunk-IJTOWOD7.js} +322 -202
- package/chunks/{chunk-RS7MT2QG.js → chunk-IPUUTYMV.js} +2 -4
- package/chunks/{chunk-4ILMYHEI.js → chunk-IRDZJSCL.js} +3 -3
- package/chunks/{chunk-XU457J4V.js → chunk-IRH27ZC2.js} +2 -2
- package/chunks/{chunk-33XUAINQ.js → chunk-J5UKQEFG.js} +69 -9
- package/chunks/{chunk-G45X5TRN.js → chunk-JCW2R7WC.js} +1 -72
- package/chunks/{chunk-S2XVRHDN.js → chunk-JDFBBGRD.js} +1 -1
- package/chunks/{chunk-4XNLIGVA.js → chunk-JKCALGYN.js} +1023 -383
- package/chunks/{chunk-TJTKSVIV.js → chunk-JLU636DO.js} +5 -1
- package/chunks/{chunk-VEXFOTEO.js → chunk-JYUSL2V4.js} +3 -3
- package/chunks/{chunk-S2PD3EZD.js → chunk-KJEMJWNH.js} +1 -1
- package/chunks/{chunk-E2UVIFI2.js → chunk-KRXPRVGL.js} +0 -1
- package/chunks/{chunk-CZF3E5GF.js → chunk-LA5H3LM5.js} +1 -1
- package/chunks/{chunk-NDMQLV4Y.js → chunk-LBAO2XRA.js} +4 -4
- package/chunks/{chunk-7RMOXZTC.js → chunk-LDPP5VTZ.js} +4 -4
- package/chunks/{chunk-KDC6GNQR.js → chunk-LEEWLFHW.js} +4 -4
- package/chunks/{chunk-KX6UK4VJ.js → chunk-LI4I37W4.js} +22152 -18007
- package/chunks/{chunk-OOCI5VVU.js → chunk-LIZRAKPB.js} +1 -1
- package/chunks/{chunk-AJSJ5TTU.js → chunk-LP2E4MQG.js} +1 -1
- package/chunks/chunk-LS77BEZP.js +405 -0
- package/chunks/{chunk-BRRF37CO.js → chunk-LYTBLSSW.js} +5 -5
- package/chunks/{chunk-DBE4QFZS.js → chunk-MB7ENXPR.js} +39 -37
- package/chunks/{chunk-GKY2OJ7R.js → chunk-MOHAWVLH.js} +4 -4
- package/chunks/chunk-NABLFI57.js +82 -0
- package/chunks/chunk-NBQDBANR.js +411 -0
- package/chunks/{chunk-EAUYY7SS.js → chunk-NOAAFNTJ.js} +43 -10
- package/chunks/chunk-NXS53EA7.js +1462 -0
- package/chunks/{chunk-C27BYUX6.js → chunk-OQB4EXO4.js} +14 -11
- package/chunks/{chunk-NHDKSOEY.js → chunk-P3QQPMQA.js} +5 -5
- package/chunks/{chunk-OP4MOGXF.js → chunk-P5RRUHL7.js} +23 -1
- package/chunks/{chunk-KOR3XKCA.js → chunk-PBII2NFX.js} +12 -6
- package/chunks/{chunk-O3OCNYY5.js → chunk-PDYB7HG2.js} +2 -2
- package/chunks/{chunk-2HOVDT7W.js → chunk-PFSUKTZH.js} +1 -1
- package/chunks/chunk-PKL3HGNZ.js +2299 -0
- package/chunks/{chunk-5DTTYNB7.js → chunk-PQNHRFJC.js} +16 -3
- package/chunks/{chunk-OLMETXLX.js → chunk-PXHK5ONM.js} +41 -9
- package/chunks/{chunk-PF4CHQOJ.js → chunk-Q6GU6TKM.js} +11 -10
- package/chunks/{chunk-4ODB7WIB.js → chunk-QAFKR7WR.js} +1 -1
- package/chunks/{chunk-PBATSWUQ.js → chunk-QBUDF33N.js} +1 -1
- package/chunks/{chunk-BVLROR2T.js → chunk-QLJUC7TG.js} +1 -1
- package/chunks/{chunk-UEY4AYUL.js → chunk-QNLNLENL.js} +2 -2
- package/chunks/{chunk-333CXMNJ.js → chunk-QXZTZJLX.js} +5 -5
- package/chunks/chunk-R6D2CTQR.js +289 -0
- package/chunks/{chunk-7PZ2ATFZ.js → chunk-R6SKHK3T.js} +54 -29
- package/chunks/{chunk-OONJNQ42.js → chunk-RGG6M2WF.js} +4 -4
- package/chunks/{chunk-RFIAR4YL.js → chunk-RV4C2ZFG.js} +1 -1
- package/chunks/{chunk-O3Z73NBP.js → chunk-RW2NEXYJ.js} +15 -11
- package/chunks/{chunk-HZPN55E5.js → chunk-SJEDL7DI.js} +1 -1
- package/chunks/{chunk-AKX4WPPP.js → chunk-SWBJRDYC.js} +866 -183
- package/chunks/{chunk-NBMIC7DR.js → chunk-SX4PK3FC.js} +145 -5
- package/chunks/chunk-T3452DP5.js +246 -0
- package/chunks/{chunk-TB6UDU4T.js → chunk-THJNPLI4.js} +16 -16
- package/chunks/{chunk-T4TZQJ7W.js → chunk-TWPJO254.js} +5 -16
- package/chunks/chunk-U7ZFW55U.js +2098 -0
- package/chunks/{chunk-JNWZQ27S.js → chunk-UCOJC6EB.js} +72 -23
- package/chunks/{chunk-W7H223ZZ.js → chunk-UGYMA4EI.js} +1 -1
- package/chunks/{chunk-X6YQWCIJ.js → chunk-UH3WSE5L.js} +13 -1
- package/chunks/{chunk-2LL7TXB4.js → chunk-UH7242DI.js} +3 -3
- package/chunks/{chunk-CB2HFGRV.js → chunk-UJV643E2.js} +31 -6
- package/chunks/chunk-UO7DCGEV.js +121 -0
- package/chunks/{chunk-Y2ENGUD6.js → chunk-UPF7PTBI.js} +79 -2
- package/chunks/chunk-UW5EOVUN.js +249 -0
- package/chunks/{chunk-SJMV7ZBK.js → chunk-VLVO52KC.js} +8 -8
- package/chunks/{chunk-R3VWUU2E.js → chunk-VYPFXUCB.js} +1 -1
- package/chunks/{chunk-S2W2LVDU.js → chunk-WHFK6G6U.js} +8 -9
- package/chunks/chunk-WI3KCKZ5.js +391 -0
- package/chunks/{chunk-NGFEPAE6.js → chunk-WLEFWSSC.js} +8 -6
- package/chunks/{chunk-XVVH63JG.js → chunk-WUJXJ34P.js} +3 -3
- package/chunks/{chunk-MAQQGNQ5.js → chunk-WYLPWQHJ.js} +56 -717
- package/chunks/{chunk-D2VIDMVM.js → chunk-X6N25LXS.js} +2 -2
- package/chunks/chunk-XAWJ2526.js +1049 -0
- package/chunks/{chunk-CV63PP6U.js → chunk-YCIM6O3I.js} +1 -1
- package/chunks/{chunk-OEO2ERWK.js → chunk-Z44CVEUF.js} +54 -33
- package/chunks/{chunk-TKLLK6XQ.js → chunk-ZT4POVWC.js} +11 -11
- package/chunks/{chunk-NIJEXGV6.js → chunk-ZXYUQXY5.js} +148 -10
- package/chunks/{computer-use-NIWQNUZF.js → computer-use-UJ5T34TE.js} +50 -37
- package/chunks/{config-utils-AHQ6YZ66.js → config-utils-XQRXHAN3.js} +3 -3
- package/chunks/contextCommand-CSCB4E5M.js +79 -0
- package/chunks/{create-sub-session-MGNX52P3.js → create-sub-session-55F3GOLK.js} +46 -33
- package/chunks/{create-sub-session-P26FE5GG.js → create-sub-session-JPCSYZAJ.js} +3 -3
- package/chunks/{cron-create-JWFHBDRQ.js → cron-create-CUMELMPL.js} +6 -6
- package/chunks/{cron-delete-GDX4E26G.js → cron-delete-QZFV6U3P.js} +5 -5
- package/chunks/{cron-list-USMAIWPT.js → cron-list-IDKO7ZO2.js} +5 -5
- package/chunks/{daemon-RG2MAI6T.js → daemon-7LP7R6IU.js} +500 -133
- package/chunks/daemon-status-provider-6YNZ3UAE.js +88 -0
- package/chunks/{de-I7ZIYXZC.js → de-4IBXM7CN.js} +5 -1
- package/chunks/{dist-WGTQO7F2.js → dist-376652EZ.js} +114 -28
- package/chunks/{dist-53PZYC5B.js → dist-3YCTE6HD.js} +2 -2
- package/chunks/{dist-2BHAYBKP.js → dist-D7Z3HOO7.js} +14 -2
- package/chunks/{dist-FUTEXY6A.js → dist-MEGJFGAI.js} +40 -9
- package/chunks/{dist-2MIU4UUH.js → dist-NQ436QEX.js} +1 -1
- package/chunks/{dist-AU7NQQRP.js → dist-NQNTOIEN.js} +26 -2
- package/chunks/earlyInputCapture-HPUVJ2KH.js +81 -0
- package/chunks/{edit-3QV3JZJL.js → edit-7CMAN3F4.js} +50 -39
- package/chunks/{en-XE34GKAA.js → en-SALLIJS7.js} +6 -1
- package/chunks/{enter-worktree-4GMMF7EG.js → enter-worktree-3PH4YTY2.js} +49 -36
- package/chunks/{enterPlanMode-L5UWBAUC.js → enterPlanMode-MSXLSWLI.js} +55 -37
- package/chunks/{environment-3OV7UQOT.js → environment-KS36ZHBE.js} +48 -35
- package/chunks/errors-LCPFS62A.js +87 -0
- package/chunks/{exit-worktree-DDP57JLV.js → exit-worktree-ARA4C3CK.js} +49 -36
- package/chunks/{exitPlanMode-CJBLGPIP.js → exitPlanMode-GCDIQPB7.js} +49 -36
- package/chunks/{fast-path-M6RP2ING.js → fast-path-IDHBVIT6.js} +3 -2
- package/chunks/{fr-X7KDVZIY.js → fr-WVHEBDDB.js} +5 -1
- package/chunks/{gemini-H4PHBJTL.js → gemini-2AFQJMX5.js} +141 -105
- package/chunks/{geminiContentGenerator-VURJYPWP.js → geminiContentGenerator-UDIH3YI6.js} +9 -8
- package/chunks/{getMachineId-bsd-EXV7SWPA.js → getMachineId-bsd-QFVLPUPT.js} +1 -1
- package/chunks/{getMachineId-darwin-IUOMFXU3.js → getMachineId-darwin-DGMQQE2E.js} +1 -1
- package/chunks/{getMachineId-linux-K7XJYFHL.js → getMachineId-linux-R4Z6CSWC.js} +1 -1
- package/chunks/{getMachineId-unsupported-EA5FDRJ6.js → getMachineId-unsupported-Z3SBVBUV.js} +1 -1
- package/chunks/{getMachineId-win-KBA6RAI5.js → getMachineId-win-SCK5UFDT.js} +1 -1
- package/chunks/{glob-2KUSRAVQ.js → glob-HCL7HZ67.js} +49 -36
- package/chunks/{grep-B5RXVESV.js → grep-CJLBSCTV.js} +49 -36
- package/chunks/handleAutoUpdate-Q572P3FL.js +80 -0
- package/chunks/i18n-OBB4R7SR.js +96 -0
- package/chunks/initializer-LXEY6V3C.js +85 -0
- package/chunks/installationInfo-XUAOVMEE.js +79 -0
- package/chunks/{ja-2ICT3KXF.js → ja-KY4ROZTE.js} +5 -1
- package/chunks/{keychain-token-storage-DWRJMNH3.js → keychain-token-storage-6ACJDYIB.js} +3 -3
- package/chunks/{kittyProtocolDetector-HCNNKJTI.js → kittyProtocolDetector-MBRTDRBK.js} +5 -3
- package/chunks/list-WAXY7QOU.js +88 -0
- package/chunks/list-agents-AH3P5NB7.js +80 -0
- package/chunks/loadedSettingsAdapter-OZFNBRHE.js +82 -0
- package/chunks/loggingContentGenerator-7WDTTE6G.js +1068 -0
- package/chunks/{loop-wakeup-5GLTUBHA.js → loop-wakeup-IHRW6TNB.js} +7 -7
- package/chunks/{ls-FHBY3Y7I.js → ls-ZAXZ2G2W.js} +5 -5
- package/chunks/{lsp-B6VMEW6Y.js → lsp-R4ZG3UGQ.js} +3 -3
- package/chunks/managed-npm-update-N42DO5QW.js +339 -0
- package/chunks/mcp-6SOORKTY.js +82 -0
- package/chunks/{monitor-GLJZDNPS.js → monitor-4PSVNVU4.js} +51 -37
- package/chunks/node-UUDY34IG.js +305 -0
- package/chunks/nonInteractiveCli-FBR5S7IZ.js +140 -0
- package/chunks/{notebook-edit-AVCIWS4F.js → notebook-edit-QK26632S.js} +50 -39
- package/chunks/{openaiContentGenerator-B7W24G3D.js → openaiContentGenerator-IXJS6C2U.js} +33 -20
- package/chunks/pidfile-UCFCJOAP.js +85 -0
- package/chunks/{processUtils-XZPY2PBB.js → processUtils-YL2LXON2.js} +2 -2
- package/chunks/{pt-JJ4XPIBP.js → pt-OK455PLH.js} +5 -1
- package/chunks/{qwenContentGenerator-6GUTWJIC.js → qwenContentGenerator-H6WZPJKC.js} +56 -36
- package/chunks/{qwenOAuth2-GASEEWGU.js → qwenOAuth2-HTROHKXO.js} +10 -23
- package/chunks/read-file-FOYTMUNL.js +31 -0
- package/chunks/{read-mcp-resource-AKCL7I43.js → read-mcp-resource-65BWNF3F.js} +3 -3
- package/chunks/{record-artifact-PEUB7727.js → record-artifact-2RLSOP6U.js} +3 -3
- package/chunks/resumeHistoryUtils-ZNHTWBXS.js +90 -0
- package/chunks/ripGrep-K4K4QLNJ.js +72 -0
- package/chunks/{ru-STR4KTW7.js → ru-7SPDGMGD.js} +5 -1
- package/chunks/{run-qwen-serve-OZGR3FQA.js → run-qwen-serve-XI4MCAFV.js} +343 -88
- package/chunks/runtime-4CTBU5WX.js +115 -0
- package/chunks/{scheduler-Z7QLMUWA.js → scheduler-TTEITHBF.js} +46 -33
- package/chunks/sdk-exporters-grpc-N3OLDF63.js +23214 -0
- package/chunks/sdk-exporters-http-AOHAEOMC.js +563 -0
- package/chunks/sdk-impl-TLQOC7P4.js +9193 -0
- package/chunks/{send-message-3RHE7HSM.js → send-message-GEY4CNPS.js} +47 -8
- package/chunks/serve-W7UKJTQT.js +88 -0
- package/chunks/{server-SO64U3X5.js → server-JD5PIE7A.js} +3069 -517
- package/chunks/{session-2KL2WQAH.js → session-R4BDHLYR.js} +112 -177
- package/chunks/{settings-KITVOUSV.js → settings-BXZHA6TZ.js} +50 -37
- package/chunks/shell-XYMFCGN5.js +82 -0
- package/chunks/{skill-SOQHY455.js → skill-YKXYEPOF.js} +25 -20
- package/chunks/spawnChannel-IO4HQLFS.js +81 -0
- package/chunks/{src-43LM7JLB.js → src-LKKTJ4NG.js} +382 -235
- package/chunks/standalone-update-76JG7DVN.js +91 -0
- package/chunks/{startInteractiveUI-3RGTGEX5.js → startInteractiveUI-BXWQUXAS.js} +1314 -958
- package/chunks/{syntheticOutput-FG5PQKIR.js → syntheticOutput-2WNMXEU5.js} +4 -4
- package/chunks/task-create-R5H74Y76.js +25 -0
- package/chunks/{task-list-QWSY4ZIU.js → task-list-WXAFDSRY.js} +7 -7
- package/chunks/{task-stop-GWC6UWAL.js → task-stop-CHFZP23W.js} +4 -4
- package/chunks/{task-update-NCTAB73Q.js → task-update-Z44A4GAR.js} +11 -9
- package/chunks/{team-create-FXN3PEBP.js → team-create-5Y3MCAIM.js} +49 -36
- package/chunks/{team-delete-KK37HTOG.js → team-delete-YDCMRSI4.js} +7 -7
- package/chunks/{team-plan-approval-GEIZ356Q.js → team-plan-approval-HYJJZ76T.js} +49 -36
- package/chunks/theme-manager-3YF2SUZL.js +76 -0
- package/chunks/{todoWrite-ERCAMLFS.js → todoWrite-ED2IVZJL.js} +5 -5
- package/chunks/{tool-search-XKK7DNOK.js → tool-search-3ZO2XMEP.js} +21 -17
- package/chunks/total-session-admission-NDF7EVG7.js +83 -0
- package/chunks/trustedFolders-Q7RALK4T.js +92 -0
- package/chunks/{chunk-6EFTQYW7.js → undici-3FJYTMOF.js} +24 -399
- package/chunks/{chunk-L573Z2QZ.js → undici-PYHBDDPN.js} +1 -5
- package/chunks/{update-relaunch-FMVZK6XF.js → update-relaunch-BTW5XGVT.js} +17 -17
- package/chunks/updateCheck-MXIU6DWQ.js +91 -0
- package/chunks/useAutoAcceptIndicator-BJXHJW77.js +92 -0
- package/chunks/{validateNonInterActiveAuth-PRVEB6GG.js → validateNonInterActiveAuth-FLEPF3QQ.js} +90 -76
- package/chunks/{version-AZMG6KWL.js → version-75VRONIL.js} +1 -1
- package/chunks/{web-fetch-EPGJ5OQQ.js → web-fetch-5X27LYHB.js} +101 -41
- package/chunks/web-search-IDMTBJUP.js +718 -0
- package/chunks/{workflow-UTNVPW22.js → workflow-JOD2OPFQ.js} +54 -40
- package/chunks/workspace-providers-status-WDLBDLPG.js +85 -0
- package/chunks/{workspace-registration-store-F3ZX3YHT.js → workspace-registration-store-26Z6J6P5.js} +9 -3
- package/chunks/workspace-registry-IABDATX3.js +87 -0
- package/chunks/workspace-service-BI4KDYPD.js +97 -0
- package/chunks/workspace-skills-status-OVB4LPHA.js +84 -0
- package/chunks/write-file-276AJ7KE.js +72 -0
- package/chunks/{zh-6ANG2HTL.js → zh-Q54GA5SV.js} +6 -1
- package/chunks/{zh-TW-4RR3YHNN.js → zh-TW-VOBNFOPU.js} +6 -1
- package/cli-entry.js +164 -12
- package/cli.js +19 -12
- package/locales/ca.js +773 -203
- package/locales/de.js +8 -2
- package/locales/en.js +9 -2
- package/locales/fr.js +8 -2
- package/locales/ja.js +8 -2
- package/locales/pt.js +8 -2
- package/locales/ru.js +8 -2
- package/locales/zh-TW.js +9 -2
- package/locales/zh.js +9 -2
- package/package.json +3 -3
- package/web-shell/assets/{arc-Buk1besA.js → arc-CMb7lr2P.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-B1aUKYDC.js → architectureDiagram-3BPJPVTR-D6KQ5Kwm.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-CRTdg3Zx.js → blockDiagram-GPEHLZMM-Ce7YYSf8.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-DFdRMp5g.js → c4Diagram-AAUBKEIU-DaStHfor.js} +1 -1
- package/web-shell/assets/channel-Dg4f-Kry.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-4rYQdkEI.js → chunk-2J33WTMH-CPaqadg9.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-Coi-pQJy.js → chunk-4BX2VUAB-Veh9ZGKg.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-BtBjz02t.js → chunk-55IACEB6-BPTX5n4q.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-CGYOWorl.js → chunk-727SXJPM-CtXsE_ca.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-CH5AKhqx.js → chunk-AQP2D5EJ-D8DDCJ8h.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-Cd50-w85.js → chunk-FMBD7UC4-cjMDGzHz.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-C2wF3KCK.js → chunk-ND2GUHAM-BaZ1hNhV.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-pCeRTaWi.js → chunk-QZHKN3VN-C7w-9w5-.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-CT7Fo2aW.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CT7Fo2aW.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-B-_fAB6D.js → cose-bilkent-S5V4N54A-DqvBEEIe.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-ChSPNHpL.js → dagre-BM42HDAG-RkPyoMAk.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-BX7cFOF3.js → diagram-2AECGRRQ-D9b6nNyg.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-BQUTW92n.js → diagram-5GNKFQAL-CiiNKUIy.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-BkYPh3e4.js → diagram-KO2AKTUF-CP1qizXd.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-Cl6jsNyx.js → diagram-LMA3HP47-BGe30TWx.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-DRWoHz8n.js → diagram-OG6HWLK6-CvoEPARH.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-CGvFcZco.js → erDiagram-TEJ5UH35-DWfLzVkV.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-vms6oVdv.js → flowDiagram-I6XJVG4X-D-dTQmo6.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-ukT_sfmi.js → ganttDiagram-6RSMTGT7-CYPHKaGY.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-Bn2ZE2Ut.js → gitGraphDiagram-PVQCEYII-DA7_aQYD.js} +1 -1
- package/web-shell/assets/index-B0i-TOYM.css +5 -0
- package/web-shell/assets/index-CgCHD46L.js +1225 -0
- package/web-shell/assets/{index-wFXp7W68.js → index-DqHNAB8C.js} +1 -1
- package/web-shell/assets/{infoDiagram-5YYISTIA-DHJdSi7x.js → infoDiagram-5YYISTIA-B87ljDPa.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-DOvd2Wph.js → ishikawaDiagram-YF4QCWOH-CYSpyjaN.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-CH_urMCT.js → journeyDiagram-JHISSGLW-DAL6Js6f.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-FKiBdgbH.js → kanban-definition-UN3LZRKU-_zufKGJv.js} +1 -1
- package/web-shell/assets/{linear-0ZVQFVKf.js → linear-DidhMgku.js} +1 -1
- package/web-shell/assets/{mermaid.core-DJ05ZZIK.js → mermaid.core-DAkX3h3a.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-BPuUhkUm.js → mindmap-definition-RKZ34NQL-DbZxUBEH.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-yLFKcXyG.js → pieDiagram-4H26LBE5-Du9uoqrf.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-irWqc1pE.js → quadrantDiagram-W4KKPZXB-DwjELuKm.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-B_4uMoIV.js → requirementDiagram-4Y6WPE33-BAqfVtBL.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-ciA4GPwk.js → sankeyDiagram-5OEKKPKP--hm2VpmK.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CRdZvy0U.js → sequenceDiagram-3UESZ5HK-R5MUQaIt.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-DaYIkCCn.js → stateDiagram-AJRCARHV-VsX032xQ.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-uPWLcSfy.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-oBUKv6iH.js → timeline-definition-PNZ67QCA-BqjVRXzg.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-CGW9Sdmb.js → vennDiagram-CIIHVFJN-i2tkvlkg.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-CvwKJOCm.js → wardley-L42UT6IY-Ch8G49EM.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-Ipc260sN.js → wardleyDiagram-YWT4CUSO-bYpWeQNy.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-D6-CM7pK.js → xychartDiagram-2RQKCTM6-C9NhuBqB.js} +1 -1
- package/web-shell/index.html +17 -13
- package/chunks/MaxSizedBox-B5YGZSYE.js +0 -72
- package/chunks/agent-H4JIDL7S.js +0 -67
- package/chunks/agent-headless-TTBEREQV.js +0 -61
- package/chunks/bridge-VL7ITBU5.js +0 -75
- package/chunks/chunk-542SK7KV.js +0 -8293
- package/chunks/chunk-CPCVCKKF.js +0 -358
- package/chunks/chunk-SEKHYHMS.js +0 -45
- package/chunks/chunk-W7FJ3N32.js +0 -49
- package/chunks/chunk-ZFKNWQGQ.js +0 -74639
- package/chunks/contextCommand-L2COEUHS.js +0 -66
- package/chunks/daemon-status-provider-NL4IAG7B.js +0 -74
- package/chunks/earlyInputCapture-L6I2A22T.js +0 -68
- package/chunks/errors-LEOF5QG4.js +0 -74
- package/chunks/handleAutoUpdate-QQVIWXKT.js +0 -67
- package/chunks/i18n-N6OBDORT.js +0 -83
- package/chunks/initializer-6WCFNDLL.js +0 -72
- package/chunks/installationInfo-6J3WPXNS.js +0 -64
- package/chunks/list-HOWQSWP6.js +0 -75
- package/chunks/loadedSettingsAdapter-AO4YBRXZ.js +0 -69
- package/chunks/mcp-QH7QNXOH.js +0 -69
- package/chunks/nonInteractiveCli-TI7EMPXD.js +0 -126
- package/chunks/pidfile-UEHAT6DH.js +0 -72
- package/chunks/read-file-SQJONF6A.js +0 -29
- package/chunks/resumeHistoryUtils-PFQ2A23X.js +0 -78
- package/chunks/ripGrep-QCK22GDU.js +0 -59
- package/chunks/runtime-SNVAP6EH.js +0 -100
- package/chunks/serve-BT7KS6SC.js +0 -75
- package/chunks/shell-BITUVH2R.js +0 -69
- package/chunks/spawnChannel-2BU3AULL.js +0 -68
- package/chunks/standalone-update-YG5JUYCM.js +0 -78
- package/chunks/task-create-HX32YXO7.js +0 -23
- package/chunks/theme-manager-IAETOI25.js +0 -63
- package/chunks/total-session-admission-BJLDHKJN.js +0 -69
- package/chunks/trustedFolders-5XCVNEUU.js +0 -79
- package/chunks/updateCheck-YZZB7YBU.js +0 -70
- package/chunks/useAutoAcceptIndicator-ZSQX4I2H.js +0 -80
- package/chunks/workspace-providers-status-EADV364W.js +0 -72
- package/chunks/workspace-registry-W6VMFYZU.js +0 -73
- package/chunks/workspace-service-F3KIN2UN.js +0 -84
- package/chunks/workspace-skills-status-YVICUR5Y.js +0 -71
- package/chunks/write-file-CVGF2OKV.js +0 -596
- package/web-shell/assets/channel-04R0vLbG.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-Bw9SOwAV.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Bw9SOwAV.js +0 -1
- package/web-shell/assets/index-DgkKrjw3.js +0 -1187
- package/web-shell/assets/index-Rv6mOAN9.css +0 -5
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DWBoO4UY.js +0 -1
|
@@ -0,0 +1,1068 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import {
|
|
4
|
+
OpenAILogger
|
|
5
|
+
} from "./chunk-R6D2CTQR.js";
|
|
6
|
+
import "./chunk-AXUW635Q.js";
|
|
7
|
+
import {
|
|
8
|
+
OpenAIContentConverter,
|
|
9
|
+
openaiRequestCaptureContext
|
|
10
|
+
} from "./chunk-NXS53EA7.js";
|
|
11
|
+
import "./chunk-BPJSQIJX.js";
|
|
12
|
+
import {
|
|
13
|
+
retryContext
|
|
14
|
+
} from "./chunk-P3QQPMQA.js";
|
|
15
|
+
import "./chunk-6QHAUJUE.js";
|
|
16
|
+
import {
|
|
17
|
+
getGenAiUsageProvenance
|
|
18
|
+
} from "./chunk-WYLPWQHJ.js";
|
|
19
|
+
import {
|
|
20
|
+
runtimeDiagnostics
|
|
21
|
+
} from "./chunk-LS77BEZP.js";
|
|
22
|
+
import {
|
|
23
|
+
ApiErrorEvent,
|
|
24
|
+
ApiRequestEvent,
|
|
25
|
+
ApiResponseEvent,
|
|
26
|
+
isInternalPromptId,
|
|
27
|
+
logApiError,
|
|
28
|
+
logApiRequest,
|
|
29
|
+
logApiResponse,
|
|
30
|
+
subagentNameContext
|
|
31
|
+
} from "./chunk-IFG6TYJ2.js";
|
|
32
|
+
import "./chunk-VGC4I5JJ.js";
|
|
33
|
+
import "./chunk-4K56OJFJ.js";
|
|
34
|
+
import "./chunk-36HSVBBU.js";
|
|
35
|
+
import "./chunk-46UV252V.js";
|
|
36
|
+
import "./chunk-A4UCTEB5.js";
|
|
37
|
+
import "./chunk-XWRJCPHC.js";
|
|
38
|
+
import "./chunk-UW5EOVUN.js";
|
|
39
|
+
import "./chunk-NBQDBANR.js";
|
|
40
|
+
import "./chunk-QNLNLENL.js";
|
|
41
|
+
import "./chunk-6X4GWOPW.js";
|
|
42
|
+
import {
|
|
43
|
+
API_CALL_ABORTED_SPAN_STATUS_MESSAGE,
|
|
44
|
+
API_CALL_FAILED_SPAN_STATUS_MESSAGE,
|
|
45
|
+
addModelOutputAttributes,
|
|
46
|
+
addSystemPromptAttributes,
|
|
47
|
+
addToolSchemaAttributes,
|
|
48
|
+
areSensitiveSpanAttributesEnabled,
|
|
49
|
+
endLLMRequestSpan,
|
|
50
|
+
startLLMRequestSpan
|
|
51
|
+
} from "./chunk-PKL3HGNZ.js";
|
|
52
|
+
import "./chunk-HTR4WV6U.js";
|
|
53
|
+
import "./chunk-BULDBTYC.js";
|
|
54
|
+
import "./chunk-U7ZFW55U.js";
|
|
55
|
+
import "./chunk-ERLGR7GI.js";
|
|
56
|
+
import "./chunk-P5RRUHL7.js";
|
|
57
|
+
import {
|
|
58
|
+
createDebugLogger,
|
|
59
|
+
getErrorMessage,
|
|
60
|
+
getErrorStatus,
|
|
61
|
+
getErrorType
|
|
62
|
+
} from "./chunk-OQB4EXO4.js";
|
|
63
|
+
import "./chunk-75DOP5OR.js";
|
|
64
|
+
import "./chunk-DMTGGOSA.js";
|
|
65
|
+
import "./chunk-YQ3U5MUC.js";
|
|
66
|
+
import {
|
|
67
|
+
GenerateContentResponse
|
|
68
|
+
} from "./chunk-22C7BQ6D.js";
|
|
69
|
+
import "./chunk-TYAMGABM.js";
|
|
70
|
+
import "./chunk-FCMNKVXT.js";
|
|
71
|
+
import "./chunk-AMDSOFFV.js";
|
|
72
|
+
import {
|
|
73
|
+
context,
|
|
74
|
+
init_esm,
|
|
75
|
+
trace
|
|
76
|
+
} from "./chunk-THJNPLI4.js";
|
|
77
|
+
import {
|
|
78
|
+
init_esbuild_shims
|
|
79
|
+
} from "./chunk-5O2XNYP6.js";
|
|
80
|
+
import {
|
|
81
|
+
__name
|
|
82
|
+
} from "./chunk-J2S4EL5Y.js";
|
|
83
|
+
|
|
84
|
+
// packages/core/src/core/loggingContentGenerator/index.ts
|
|
85
|
+
init_esbuild_shims();
|
|
86
|
+
|
|
87
|
+
// packages/core/src/core/loggingContentGenerator/loggingContentGenerator.ts
|
|
88
|
+
init_esbuild_shims();
|
|
89
|
+
init_esm();
|
|
90
|
+
|
|
91
|
+
// packages/core/src/core/loggingContentGenerator/streamContentDetection.ts
|
|
92
|
+
init_esbuild_shims();
|
|
93
|
+
function hasUserVisibleContent(chunk) {
|
|
94
|
+
const parts = chunk.candidates?.[0]?.content?.parts;
|
|
95
|
+
if (!parts || parts.length === 0) return false;
|
|
96
|
+
return parts.some(isUserVisiblePart);
|
|
97
|
+
}
|
|
98
|
+
__name(hasUserVisibleContent, "hasUserVisibleContent");
|
|
99
|
+
function isUserVisiblePart(part) {
|
|
100
|
+
if (part === null || typeof part !== "object") return false;
|
|
101
|
+
const p = part;
|
|
102
|
+
if (typeof p.text === "string" && p.text.length > 0) return true;
|
|
103
|
+
if (p.functionCall !== void 0) return true;
|
|
104
|
+
if (p.inlineData !== void 0) return true;
|
|
105
|
+
if (p.executableCode !== void 0) return true;
|
|
106
|
+
if (p.thought === true) return true;
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
__name(isUserVisiblePart, "isUserVisiblePart");
|
|
110
|
+
|
|
111
|
+
// packages/core/src/telemetry/gen-ai-provider.ts
|
|
112
|
+
init_esbuild_shims();
|
|
113
|
+
var PROVIDER_BY_ENV_KEY = {
|
|
114
|
+
ANTHROPIC_API_KEY: "anthropic",
|
|
115
|
+
BAILIAN_CODING_PLAN_API_KEY: "dashscope",
|
|
116
|
+
BAILIAN_TOKEN_PLAN_API_KEY: "dashscope",
|
|
117
|
+
DASHSCOPE_API_KEY: "dashscope",
|
|
118
|
+
DEEPSEEK_API_KEY: "deepseek",
|
|
119
|
+
IDEALAB_API_KEY: "dashscope",
|
|
120
|
+
MINIMAX_API_KEY: "minimax",
|
|
121
|
+
MIMO_API_KEY: "mimo",
|
|
122
|
+
MISTRAL_API_KEY: "mistral_ai",
|
|
123
|
+
MODELSCOPE_API_KEY: "modelscope",
|
|
124
|
+
OPENAI_API_KEY: "openai",
|
|
125
|
+
OPENROUTER_API_KEY: "openrouter",
|
|
126
|
+
REQUESTY_API_KEY: "requesty",
|
|
127
|
+
XAI_API_KEY: "x_ai",
|
|
128
|
+
XIAOMI_MIMO_API_KEY: "mimo",
|
|
129
|
+
ZAI_API_KEY: "z_ai"
|
|
130
|
+
};
|
|
131
|
+
function isHostOrSubdomain(hostname, domain) {
|
|
132
|
+
return hostname === domain || hostname.endsWith(`.${domain}`);
|
|
133
|
+
}
|
|
134
|
+
__name(isHostOrSubdomain, "isHostOrSubdomain");
|
|
135
|
+
function providerFromHostname(hostname) {
|
|
136
|
+
if (isHostOrSubdomain(hostname, "dashscope.aliyuncs.com") || isHostOrSubdomain(hostname, "dashscope-intl.aliyuncs.com") || isHostOrSubdomain(hostname, "dashscope-us.aliyuncs.com") || hostname.startsWith("token-plan.") && isHostOrSubdomain(hostname, "maas.aliyuncs.com") || hostname.endsWith(".alibaba-inc.com") || hostname.endsWith(".aliyun-inc.com")) {
|
|
137
|
+
return "dashscope";
|
|
138
|
+
}
|
|
139
|
+
if (isHostOrSubdomain(hostname, "openai.azure.com") || isHostOrSubdomain(hostname, "services.ai.azure.com")) {
|
|
140
|
+
return "azure.ai.openai";
|
|
141
|
+
}
|
|
142
|
+
if (isHostOrSubdomain(hostname, "deepseek.com")) return "deepseek";
|
|
143
|
+
if (isHostOrSubdomain(hostname, "x.ai")) return "x_ai";
|
|
144
|
+
if (isHostOrSubdomain(hostname, "mistral.ai")) return "mistral_ai";
|
|
145
|
+
if (isHostOrSubdomain(hostname, "minimax.io") || isHostOrSubdomain(hostname, "minimaxi.com")) {
|
|
146
|
+
return "minimax";
|
|
147
|
+
}
|
|
148
|
+
if (isHostOrSubdomain(hostname, "z.ai") || isHostOrSubdomain(hostname, "bigmodel.cn")) {
|
|
149
|
+
return "z_ai";
|
|
150
|
+
}
|
|
151
|
+
if (isHostOrSubdomain(hostname, "modelscope.cn")) return "modelscope";
|
|
152
|
+
if (isHostOrSubdomain(hostname, "xiaomimimo.com")) return "mimo";
|
|
153
|
+
if (isHostOrSubdomain(hostname, "openrouter.ai")) return "openrouter";
|
|
154
|
+
if (isHostOrSubdomain(hostname, "requesty.ai")) return "requesty";
|
|
155
|
+
if (isHostOrSubdomain(hostname, "anthropic.com")) return "anthropic";
|
|
156
|
+
if (isHostOrSubdomain(hostname, "openai.com")) return "openai";
|
|
157
|
+
return void 0;
|
|
158
|
+
}
|
|
159
|
+
__name(providerFromHostname, "providerFromHostname");
|
|
160
|
+
function parsedUrl(value) {
|
|
161
|
+
if (!value) return void 0;
|
|
162
|
+
try {
|
|
163
|
+
return new URL(value);
|
|
164
|
+
} catch {
|
|
165
|
+
return void 0;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
__name(parsedUrl, "parsedUrl");
|
|
169
|
+
function normalizedEndpoint(value) {
|
|
170
|
+
const url = parsedUrl(value);
|
|
171
|
+
if (!url) return void 0;
|
|
172
|
+
const pathname = url.pathname.replace(/\/+$/, "") || "/";
|
|
173
|
+
return `${url.protocol}//${url.host}${pathname}${url.search}`;
|
|
174
|
+
}
|
|
175
|
+
__name(normalizedEndpoint, "normalizedEndpoint");
|
|
176
|
+
function resolveGenAiProviderName(config, dashscopeProxyBaseUrl) {
|
|
177
|
+
if (config.authType === "qwen-oauth") return "dashscope";
|
|
178
|
+
const baseUrl = normalizedEndpoint(config.baseUrl);
|
|
179
|
+
const proxyUrl = normalizedEndpoint(dashscopeProxyBaseUrl);
|
|
180
|
+
if (baseUrl && proxyUrl && baseUrl === proxyUrl) return "dashscope";
|
|
181
|
+
const hostname = parsedUrl(config.baseUrl)?.hostname.toLowerCase();
|
|
182
|
+
if (hostname) {
|
|
183
|
+
const provider = providerFromHostname(hostname);
|
|
184
|
+
if (provider) return provider;
|
|
185
|
+
}
|
|
186
|
+
const envProvider = config.apiKeyEnvKey ? PROVIDER_BY_ENV_KEY[config.apiKeyEnvKey.toUpperCase()] : void 0;
|
|
187
|
+
if (envProvider) return envProvider;
|
|
188
|
+
switch (config.authType) {
|
|
189
|
+
case "anthropic":
|
|
190
|
+
return "anthropic";
|
|
191
|
+
case "gemini":
|
|
192
|
+
return "gcp.gemini";
|
|
193
|
+
case "vertex-ai":
|
|
194
|
+
return "gcp.vertex_ai";
|
|
195
|
+
default:
|
|
196
|
+
return "openai";
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
__name(resolveGenAiProviderName, "resolveGenAiProviderName");
|
|
200
|
+
function resolveGenAiOperationName(authType) {
|
|
201
|
+
return authType === "gemini" || authType === "vertex-ai" ? "generate_content" : "chat";
|
|
202
|
+
}
|
|
203
|
+
__name(resolveGenAiOperationName, "resolveGenAiOperationName");
|
|
204
|
+
function resolveGenAiOutputType(authType, config) {
|
|
205
|
+
if (authType !== "gemini" && authType !== "vertex-ai") return void 0;
|
|
206
|
+
const mimeType = config?.responseMimeType?.split(";", 1)[0]?.trim().toLowerCase();
|
|
207
|
+
if (mimeType) {
|
|
208
|
+
if (mimeType === "application/json" || mimeType.endsWith("+json")) {
|
|
209
|
+
return "json";
|
|
210
|
+
}
|
|
211
|
+
if (mimeType.startsWith("text/")) return "text";
|
|
212
|
+
if (mimeType.startsWith("image/")) return "image";
|
|
213
|
+
if (mimeType.startsWith("audio/")) return "speech";
|
|
214
|
+
}
|
|
215
|
+
const modalities = config?.responseModalities;
|
|
216
|
+
if (modalities?.length !== 1) return void 0;
|
|
217
|
+
switch (String(modalities[0]).toUpperCase()) {
|
|
218
|
+
case "TEXT":
|
|
219
|
+
return "text";
|
|
220
|
+
case "IMAGE":
|
|
221
|
+
return "image";
|
|
222
|
+
case "AUDIO":
|
|
223
|
+
return "speech";
|
|
224
|
+
default:
|
|
225
|
+
return void 0;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
__name(resolveGenAiOutputType, "resolveGenAiOutputType");
|
|
229
|
+
|
|
230
|
+
// packages/core/src/core/loggingContentGenerator/loggingContentGenerator.ts
|
|
231
|
+
function snapshotRetryMetadata() {
|
|
232
|
+
const ctx = retryContext.getStore();
|
|
233
|
+
return {
|
|
234
|
+
attempt: ctx?.attempt ?? 1,
|
|
235
|
+
requestSetupMs: ctx?.requestSetupMs,
|
|
236
|
+
retryTotalDelayMs: ctx?.retryTotalDelayMs
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
__name(snapshotRetryMetadata, "snapshotRetryMetadata");
|
|
240
|
+
function usageSpanMetadata(usage) {
|
|
241
|
+
const provenance = getGenAiUsageProvenance(usage);
|
|
242
|
+
return {
|
|
243
|
+
inputTokens: usage?.promptTokenCount,
|
|
244
|
+
outputTokens: usage?.candidatesTokenCount,
|
|
245
|
+
cachedInputTokens: usage?.cachedContentTokenCount,
|
|
246
|
+
cachedInputTokensReported: provenance?.cachedInputTokensReported ?? usage?.cachedContentTokenCount !== void 0,
|
|
247
|
+
cacheCreationInputTokens: provenance?.cacheCreationInputTokens
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
__name(usageSpanMetadata, "usageSpanMetadata");
|
|
251
|
+
function orderedFinishReasons(response) {
|
|
252
|
+
const reasons = (response.candidates ?? []).map((candidate, position) => ({
|
|
253
|
+
index: candidate.index ?? position,
|
|
254
|
+
reason: candidate.finishReason ? String(candidate.finishReason) : void 0
|
|
255
|
+
})).filter(
|
|
256
|
+
(entry) => entry.reason !== void 0
|
|
257
|
+
).sort((left, right) => left.index - right.index).map((entry) => entry.reason);
|
|
258
|
+
return reasons.length > 0 ? reasons : void 0;
|
|
259
|
+
}
|
|
260
|
+
__name(orderedFinishReasons, "orderedFinishReasons");
|
|
261
|
+
var debugLogger = createDebugLogger("LOGGING_CONTENT_GENERATOR");
|
|
262
|
+
var MAX_RESPONSE_TEXT_LENGTH = 4096;
|
|
263
|
+
var RESPONSE_TEXT_TRUNCATION_SUFFIX = "...[truncated]";
|
|
264
|
+
var LoggingContentGenerator = class {
|
|
265
|
+
constructor(wrapped, config, generatorConfig) {
|
|
266
|
+
this.wrapped = wrapped;
|
|
267
|
+
this.config = config;
|
|
268
|
+
this.modalities = generatorConfig.modalities;
|
|
269
|
+
this.splitToolMedia = generatorConfig.splitToolMedia;
|
|
270
|
+
this.toolResultContentFormat = generatorConfig.toolResultContentFormat;
|
|
271
|
+
this.generatorAuthType = generatorConfig.authType;
|
|
272
|
+
this.genAiProviderName = resolveGenAiProviderName(
|
|
273
|
+
generatorConfig,
|
|
274
|
+
process.env["DASHSCOPE_PROXY_BASE_URL"]
|
|
275
|
+
);
|
|
276
|
+
this.genAiOperationName = resolveGenAiOperationName(
|
|
277
|
+
generatorConfig.authType
|
|
278
|
+
);
|
|
279
|
+
if (generatorConfig.enableOpenAILogging) {
|
|
280
|
+
this.openaiLogger = new OpenAILogger(
|
|
281
|
+
generatorConfig.openAILoggingDir,
|
|
282
|
+
config.getWorkingDir()
|
|
283
|
+
);
|
|
284
|
+
this.schemaCompliance = generatorConfig.schemaCompliance;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
static {
|
|
288
|
+
__name(this, "LoggingContentGenerator");
|
|
289
|
+
}
|
|
290
|
+
openaiLogger;
|
|
291
|
+
schemaCompliance;
|
|
292
|
+
modalities;
|
|
293
|
+
splitToolMedia;
|
|
294
|
+
toolResultContentFormat;
|
|
295
|
+
generatorAuthType;
|
|
296
|
+
genAiProviderName;
|
|
297
|
+
genAiOperationName;
|
|
298
|
+
getWrapped() {
|
|
299
|
+
return this.wrapped;
|
|
300
|
+
}
|
|
301
|
+
logApiRequest(contents, model, promptId) {
|
|
302
|
+
const requestText = JSON.stringify(contents);
|
|
303
|
+
logApiRequest(
|
|
304
|
+
this.config,
|
|
305
|
+
new ApiRequestEvent(
|
|
306
|
+
model,
|
|
307
|
+
promptId,
|
|
308
|
+
requestText,
|
|
309
|
+
subagentNameContext.getStore()
|
|
310
|
+
)
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
_logApiResponse(responseId, durationMs, model, prompt_id, usageMetadata, responseText) {
|
|
314
|
+
logApiResponse(
|
|
315
|
+
this.config,
|
|
316
|
+
new ApiResponseEvent(
|
|
317
|
+
responseId,
|
|
318
|
+
model,
|
|
319
|
+
durationMs,
|
|
320
|
+
prompt_id,
|
|
321
|
+
this.generatorAuthType,
|
|
322
|
+
usageMetadata,
|
|
323
|
+
responseText,
|
|
324
|
+
subagentNameContext.getStore()
|
|
325
|
+
)
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
_logApiError(responseId, durationMs, error, model, prompt_id) {
|
|
329
|
+
const errorMessage = getErrorMessage(error);
|
|
330
|
+
const errorType = getErrorType(error);
|
|
331
|
+
const errorResponseId = error?.requestID || error?.request_id || responseId;
|
|
332
|
+
const errorStatus = getErrorStatus(error);
|
|
333
|
+
logApiError(
|
|
334
|
+
this.config,
|
|
335
|
+
new ApiErrorEvent({
|
|
336
|
+
responseId: errorResponseId,
|
|
337
|
+
model,
|
|
338
|
+
durationMs,
|
|
339
|
+
promptId: prompt_id,
|
|
340
|
+
authType: this.generatorAuthType,
|
|
341
|
+
errorMessage,
|
|
342
|
+
errorType,
|
|
343
|
+
statusCode: errorStatus,
|
|
344
|
+
subagentName: subagentNameContext.getStore()
|
|
345
|
+
})
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
safelyLogApiError(responseId, durationMs, error, model, prompt_id) {
|
|
349
|
+
try {
|
|
350
|
+
this._logApiError(responseId, durationMs, error, model, prompt_id);
|
|
351
|
+
} catch (loggingError) {
|
|
352
|
+
debugLogger.warn("Failed to log API error:", loggingError);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
safelyLogApiResponse(responseId, durationMs, model, prompt_id, usageMetadata, responseText) {
|
|
356
|
+
try {
|
|
357
|
+
this._logApiResponse(
|
|
358
|
+
responseId,
|
|
359
|
+
durationMs,
|
|
360
|
+
model,
|
|
361
|
+
prompt_id,
|
|
362
|
+
usageMetadata,
|
|
363
|
+
responseText
|
|
364
|
+
);
|
|
365
|
+
} catch (loggingError) {
|
|
366
|
+
debugLogger.warn("Failed to log API response:", loggingError);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
async generateContent(req, userPromptId) {
|
|
370
|
+
const retrySnapshot = snapshotRetryMetadata();
|
|
371
|
+
const llmSpan = startLLMRequestSpan(req.model, userPromptId, {
|
|
372
|
+
operationName: this.genAiOperationName,
|
|
373
|
+
providerName: this.genAiProviderName,
|
|
374
|
+
outputType: resolveGenAiOutputType(this.generatorAuthType, req.config)
|
|
375
|
+
});
|
|
376
|
+
try {
|
|
377
|
+
llmSpan.setAttribute("llm_request.stream", false);
|
|
378
|
+
} catch {
|
|
379
|
+
}
|
|
380
|
+
const spanContext = trace.setSpan(context.active(), llmSpan);
|
|
381
|
+
const startTime = Date.now();
|
|
382
|
+
const isInternal = isInternalPromptId(userPromptId);
|
|
383
|
+
const session = this.startCaptureSession();
|
|
384
|
+
try {
|
|
385
|
+
runtimeDiagnostics.recordGenerateContentRequest(req, {
|
|
386
|
+
stream: false,
|
|
387
|
+
source: "generateContent"
|
|
388
|
+
});
|
|
389
|
+
if (!isInternal) {
|
|
390
|
+
addSystemPromptAttributes(
|
|
391
|
+
this.config,
|
|
392
|
+
llmSpan,
|
|
393
|
+
req.config?.systemInstruction
|
|
394
|
+
);
|
|
395
|
+
addToolSchemaAttributes(
|
|
396
|
+
this.config,
|
|
397
|
+
llmSpan,
|
|
398
|
+
req.config?.tools
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
const response = await context.with(spanContext, async () => {
|
|
402
|
+
if (!isInternal) {
|
|
403
|
+
this.logApiRequest(
|
|
404
|
+
this.toContents(req.contents),
|
|
405
|
+
req.model,
|
|
406
|
+
userPromptId
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
const result = await session.wrap(
|
|
410
|
+
() => this.wrapped.generateContent(req, userPromptId)
|
|
411
|
+
);
|
|
412
|
+
const durationMs = Date.now() - startTime;
|
|
413
|
+
const shouldCollectSensitiveSpanAttributes = !isInternal && this.shouldCollectSensitiveSpanAttributes();
|
|
414
|
+
const modelOutput = shouldCollectSensitiveSpanAttributes ? this.extractResponseTextForSensitiveSpan(
|
|
415
|
+
result,
|
|
416
|
+
this.config.getTelemetrySensitiveSpanAttributeMaxLength()
|
|
417
|
+
) : void 0;
|
|
418
|
+
const responseText = isInternal ? void 0 : this.extractResponseText(result, MAX_RESPONSE_TEXT_LENGTH);
|
|
419
|
+
if (shouldCollectSensitiveSpanAttributes) {
|
|
420
|
+
this.safelyAddModelOutputAttributes(llmSpan, modelOutput);
|
|
421
|
+
}
|
|
422
|
+
this.safelyLogApiResponse(
|
|
423
|
+
result.responseId ?? "",
|
|
424
|
+
durationMs,
|
|
425
|
+
result.modelVersion || req.model,
|
|
426
|
+
userPromptId,
|
|
427
|
+
result.usageMetadata,
|
|
428
|
+
responseText
|
|
429
|
+
);
|
|
430
|
+
try {
|
|
431
|
+
await this.safelyLogOpenAIInteraction(
|
|
432
|
+
await session.resolve(req),
|
|
433
|
+
result,
|
|
434
|
+
void 0,
|
|
435
|
+
userPromptId
|
|
436
|
+
);
|
|
437
|
+
} catch (loggingError) {
|
|
438
|
+
debugLogger.warn("Failed to log OpenAI interaction:", loggingError);
|
|
439
|
+
}
|
|
440
|
+
return result;
|
|
441
|
+
});
|
|
442
|
+
endLLMRequestSpan(llmSpan, {
|
|
443
|
+
success: true,
|
|
444
|
+
...usageSpanMetadata(response.usageMetadata),
|
|
445
|
+
durationMs: Date.now() - startTime,
|
|
446
|
+
responseId: response.responseId || void 0,
|
|
447
|
+
responseModel: response.modelVersion || void 0,
|
|
448
|
+
finishReasons: orderedFinishReasons(response),
|
|
449
|
+
thoughtsTokenCount: response.usageMetadata?.thoughtsTokenCount,
|
|
450
|
+
subagentName: subagentNameContext.getStore() || void 0,
|
|
451
|
+
...retrySnapshot,
|
|
452
|
+
config: this.config
|
|
453
|
+
});
|
|
454
|
+
return response;
|
|
455
|
+
} catch (error) {
|
|
456
|
+
const durationMs = Date.now() - startTime;
|
|
457
|
+
const aborted = req.config?.abortSignal?.aborted ?? false;
|
|
458
|
+
endLLMRequestSpan(llmSpan, {
|
|
459
|
+
success: false,
|
|
460
|
+
durationMs,
|
|
461
|
+
error: aborted ? API_CALL_ABORTED_SPAN_STATUS_MESSAGE : API_CALL_FAILED_SPAN_STATUS_MESSAGE,
|
|
462
|
+
errorType: getErrorType(error),
|
|
463
|
+
errorStatusCode: getErrorStatus(error),
|
|
464
|
+
subagentName: subagentNameContext.getStore() || void 0,
|
|
465
|
+
...retrySnapshot,
|
|
466
|
+
config: this.config
|
|
467
|
+
});
|
|
468
|
+
await context.with(spanContext, async () => {
|
|
469
|
+
this.safelyLogApiError("", durationMs, error, req.model, userPromptId);
|
|
470
|
+
try {
|
|
471
|
+
await this.safelyLogOpenAIInteraction(
|
|
472
|
+
await session.resolve(req),
|
|
473
|
+
void 0,
|
|
474
|
+
error,
|
|
475
|
+
userPromptId
|
|
476
|
+
);
|
|
477
|
+
} catch (loggingError) {
|
|
478
|
+
debugLogger.warn("Failed to log OpenAI interaction:", loggingError);
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
throw error;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
async generateContentStream(req, userPromptId) {
|
|
485
|
+
const retrySnapshot = snapshotRetryMetadata();
|
|
486
|
+
const llmSpan = startLLMRequestSpan(req.model, userPromptId, {
|
|
487
|
+
operationName: this.genAiOperationName,
|
|
488
|
+
providerName: this.genAiProviderName,
|
|
489
|
+
outputType: resolveGenAiOutputType(this.generatorAuthType, req.config)
|
|
490
|
+
});
|
|
491
|
+
try {
|
|
492
|
+
llmSpan.setAttribute("llm_request.stream", true);
|
|
493
|
+
} catch {
|
|
494
|
+
}
|
|
495
|
+
const spanContext = trace.setSpan(context.active(), llmSpan);
|
|
496
|
+
const startTime = Date.now();
|
|
497
|
+
const isInternal = isInternalPromptId(userPromptId);
|
|
498
|
+
const session = this.startCaptureSession();
|
|
499
|
+
let stream;
|
|
500
|
+
try {
|
|
501
|
+
runtimeDiagnostics.recordGenerateContentRequest(req, {
|
|
502
|
+
stream: true,
|
|
503
|
+
source: "generateContentStream"
|
|
504
|
+
});
|
|
505
|
+
if (!isInternal) {
|
|
506
|
+
addSystemPromptAttributes(
|
|
507
|
+
this.config,
|
|
508
|
+
llmSpan,
|
|
509
|
+
req.config?.systemInstruction
|
|
510
|
+
);
|
|
511
|
+
addToolSchemaAttributes(
|
|
512
|
+
this.config,
|
|
513
|
+
llmSpan,
|
|
514
|
+
req.config?.tools
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
stream = await context.with(spanContext, async () => {
|
|
518
|
+
if (!isInternal) {
|
|
519
|
+
this.logApiRequest(
|
|
520
|
+
this.toContents(req.contents),
|
|
521
|
+
req.model,
|
|
522
|
+
userPromptId
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
return session.wrap(
|
|
526
|
+
() => this.wrapped.generateContentStream(req, userPromptId)
|
|
527
|
+
);
|
|
528
|
+
});
|
|
529
|
+
} catch (error) {
|
|
530
|
+
const durationMs = Date.now() - startTime;
|
|
531
|
+
context.with(
|
|
532
|
+
spanContext,
|
|
533
|
+
() => this.safelyLogApiError("", durationMs, error, req.model, userPromptId)
|
|
534
|
+
);
|
|
535
|
+
const aborted = req.config?.abortSignal?.aborted ?? false;
|
|
536
|
+
endLLMRequestSpan(llmSpan, {
|
|
537
|
+
success: false,
|
|
538
|
+
durationMs,
|
|
539
|
+
error: aborted ? API_CALL_ABORTED_SPAN_STATUS_MESSAGE : API_CALL_FAILED_SPAN_STATUS_MESSAGE,
|
|
540
|
+
errorType: getErrorType(error),
|
|
541
|
+
errorStatusCode: getErrorStatus(error),
|
|
542
|
+
subagentName: subagentNameContext.getStore() || void 0,
|
|
543
|
+
...retrySnapshot,
|
|
544
|
+
config: this.config
|
|
545
|
+
});
|
|
546
|
+
try {
|
|
547
|
+
await this.safelyLogOpenAIInteraction(
|
|
548
|
+
await session.resolve(req),
|
|
549
|
+
void 0,
|
|
550
|
+
error,
|
|
551
|
+
userPromptId
|
|
552
|
+
);
|
|
553
|
+
} catch (loggingError) {
|
|
554
|
+
debugLogger.warn("Failed to log OpenAI interaction:", loggingError);
|
|
555
|
+
}
|
|
556
|
+
throw error;
|
|
557
|
+
}
|
|
558
|
+
let resolvedRequest;
|
|
559
|
+
if (this.openaiLogger) {
|
|
560
|
+
try {
|
|
561
|
+
resolvedRequest = await session.resolve(req);
|
|
562
|
+
} catch (loggingError) {
|
|
563
|
+
debugLogger.warn("Failed to resolve OpenAI request:", loggingError);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
return context.with(
|
|
567
|
+
spanContext,
|
|
568
|
+
() => this.loggingStreamWrapper(
|
|
569
|
+
stream,
|
|
570
|
+
startTime,
|
|
571
|
+
userPromptId,
|
|
572
|
+
req.model,
|
|
573
|
+
resolvedRequest,
|
|
574
|
+
llmSpan,
|
|
575
|
+
spanContext,
|
|
576
|
+
req.config?.abortSignal,
|
|
577
|
+
retrySnapshot
|
|
578
|
+
)
|
|
579
|
+
);
|
|
580
|
+
}
|
|
581
|
+
startCaptureSession() {
|
|
582
|
+
let captured;
|
|
583
|
+
const skipCapture = !this.openaiLogger;
|
|
584
|
+
return {
|
|
585
|
+
wrap: /* @__PURE__ */ __name((fn) => skipCapture ? fn() : openaiRequestCaptureContext.run((built) => {
|
|
586
|
+
captured = built;
|
|
587
|
+
}, fn), "wrap"),
|
|
588
|
+
resolve: /* @__PURE__ */ __name(async (req) => this.openaiLogger ? captured ?? await this.buildOpenAIRequestForLogging(req) : void 0, "resolve")
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
async *loggingStreamWrapper(stream, startTime, userPromptId, model, openaiRequest, span, spanContext, abortSignal, retrySnapshot) {
|
|
592
|
+
const isInternal = isInternalPromptId(userPromptId);
|
|
593
|
+
const shouldCollectResponses = !isInternal || !!this.openaiLogger;
|
|
594
|
+
const responses = [];
|
|
595
|
+
let lastResponseForLogging;
|
|
596
|
+
let firstResponseId = "";
|
|
597
|
+
let firstModelVersion = "";
|
|
598
|
+
let lastUsageMetadata;
|
|
599
|
+
let errorOccurred = false;
|
|
600
|
+
const finishReasons = /* @__PURE__ */ new Map();
|
|
601
|
+
let lastError;
|
|
602
|
+
const subagentName = subagentNameContext.getStore();
|
|
603
|
+
let ttftMs;
|
|
604
|
+
let spanEndedByTimeout = false;
|
|
605
|
+
const runInSpan = /* @__PURE__ */ __name((fn) => spanContext ? context.with(spanContext, fn) : fn(), "runInSpan");
|
|
606
|
+
const STREAM_IDLE_TIMEOUT_MS = 5 * 6e4;
|
|
607
|
+
let spanEndTimeout;
|
|
608
|
+
const resetSpanTimeout = span ? () => {
|
|
609
|
+
if (spanEndedByTimeout) return;
|
|
610
|
+
if (spanEndTimeout !== void 0) clearTimeout(spanEndTimeout);
|
|
611
|
+
spanEndTimeout = setTimeout(() => {
|
|
612
|
+
try {
|
|
613
|
+
span.setAttribute("stream.timed_out", true);
|
|
614
|
+
} catch {
|
|
615
|
+
}
|
|
616
|
+
endLLMRequestSpan(span, {
|
|
617
|
+
success: false,
|
|
618
|
+
...usageSpanMetadata(lastUsageMetadata),
|
|
619
|
+
durationMs: Date.now() - startTime,
|
|
620
|
+
error: "Stream span timed out (idle)",
|
|
621
|
+
responseId: firstResponseId || void 0,
|
|
622
|
+
responseModel: firstModelVersion || void 0,
|
|
623
|
+
finishReasons: finishReasons.size > 0 ? [...finishReasons.entries()].sort(([left], [right]) => left - right).map(([, reason]) => reason) : void 0,
|
|
624
|
+
subagentName: subagentName || void 0,
|
|
625
|
+
...retrySnapshot,
|
|
626
|
+
config: this.config
|
|
627
|
+
});
|
|
628
|
+
spanEndedByTimeout = true;
|
|
629
|
+
}, STREAM_IDLE_TIMEOUT_MS);
|
|
630
|
+
spanEndTimeout.unref();
|
|
631
|
+
} : void 0;
|
|
632
|
+
resetSpanTimeout?.();
|
|
633
|
+
try {
|
|
634
|
+
for await (const response of stream) {
|
|
635
|
+
if (!firstResponseId && response.responseId) {
|
|
636
|
+
firstResponseId = response.responseId;
|
|
637
|
+
}
|
|
638
|
+
if (!firstModelVersion && response.modelVersion) {
|
|
639
|
+
firstModelVersion = response.modelVersion;
|
|
640
|
+
}
|
|
641
|
+
const candidate = response.candidates?.[0];
|
|
642
|
+
if (shouldCollectResponses) {
|
|
643
|
+
lastResponseForLogging = response;
|
|
644
|
+
if ((candidate?.content?.parts?.length ?? 0) > 0 || candidate?.finishReason) {
|
|
645
|
+
responses.push(response);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
if (response.usageMetadata) {
|
|
649
|
+
lastUsageMetadata = response.usageMetadata;
|
|
650
|
+
}
|
|
651
|
+
for (const [position, responseCandidate] of (response.candidates ?? []).entries()) {
|
|
652
|
+
if (responseCandidate.finishReason) {
|
|
653
|
+
finishReasons.set(
|
|
654
|
+
responseCandidate.index ?? position,
|
|
655
|
+
String(responseCandidate.finishReason)
|
|
656
|
+
);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
if (ttftMs === void 0 && hasUserVisibleContent(response)) {
|
|
660
|
+
ttftMs = Date.now() - startTime;
|
|
661
|
+
}
|
|
662
|
+
resetSpanTimeout?.();
|
|
663
|
+
yield response;
|
|
664
|
+
}
|
|
665
|
+
if (spanEndTimeout !== void 0) {
|
|
666
|
+
clearTimeout(spanEndTimeout);
|
|
667
|
+
spanEndTimeout = void 0;
|
|
668
|
+
}
|
|
669
|
+
const durationMs = Date.now() - startTime;
|
|
670
|
+
if (lastResponseForLogging && responses.at(-1) !== lastResponseForLogging) {
|
|
671
|
+
responses.push(lastResponseForLogging);
|
|
672
|
+
}
|
|
673
|
+
const consolidatedResponse = shouldCollectResponses ? this.consolidateGeminiResponsesForLogging(responses) : void 0;
|
|
674
|
+
if (consolidatedResponse) {
|
|
675
|
+
consolidatedResponse.usageMetadata = lastUsageMetadata;
|
|
676
|
+
}
|
|
677
|
+
const shouldCollectSensitiveSpanAttributes = !isInternal && span !== void 0 && this.shouldCollectSensitiveSpanAttributes();
|
|
678
|
+
const streamModelOutput = shouldCollectSensitiveSpanAttributes ? this.extractResponseTextForSensitiveSpan(
|
|
679
|
+
consolidatedResponse,
|
|
680
|
+
this.config.getTelemetrySensitiveSpanAttributeMaxLength()
|
|
681
|
+
) : void 0;
|
|
682
|
+
const streamResponseText = isInternal ? void 0 : this.extractResponseText(
|
|
683
|
+
consolidatedResponse,
|
|
684
|
+
MAX_RESPONSE_TEXT_LENGTH
|
|
685
|
+
);
|
|
686
|
+
if (!spanEndedByTimeout) {
|
|
687
|
+
runInSpan(
|
|
688
|
+
() => this.safelyLogApiResponse(
|
|
689
|
+
firstResponseId,
|
|
690
|
+
durationMs,
|
|
691
|
+
firstModelVersion || model,
|
|
692
|
+
userPromptId,
|
|
693
|
+
lastUsageMetadata,
|
|
694
|
+
streamResponseText
|
|
695
|
+
)
|
|
696
|
+
);
|
|
697
|
+
if (shouldCollectSensitiveSpanAttributes && span) {
|
|
698
|
+
this.safelyAddModelOutputAttributes(span, streamModelOutput);
|
|
699
|
+
}
|
|
700
|
+
await runInSpan(
|
|
701
|
+
() => this.safelyLogOpenAIInteraction(
|
|
702
|
+
openaiRequest,
|
|
703
|
+
consolidatedResponse,
|
|
704
|
+
void 0,
|
|
705
|
+
userPromptId
|
|
706
|
+
)
|
|
707
|
+
);
|
|
708
|
+
}
|
|
709
|
+
} catch (error) {
|
|
710
|
+
errorOccurred = true;
|
|
711
|
+
lastError = error;
|
|
712
|
+
if (!spanEndedByTimeout) {
|
|
713
|
+
const durationMs = Date.now() - startTime;
|
|
714
|
+
runInSpan(
|
|
715
|
+
() => this.safelyLogApiError(
|
|
716
|
+
firstResponseId,
|
|
717
|
+
durationMs,
|
|
718
|
+
error,
|
|
719
|
+
firstModelVersion || model,
|
|
720
|
+
userPromptId
|
|
721
|
+
)
|
|
722
|
+
);
|
|
723
|
+
await runInSpan(
|
|
724
|
+
() => this.safelyLogOpenAIInteraction(
|
|
725
|
+
openaiRequest,
|
|
726
|
+
void 0,
|
|
727
|
+
error,
|
|
728
|
+
userPromptId
|
|
729
|
+
)
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
throw error;
|
|
733
|
+
} finally {
|
|
734
|
+
if (spanEndTimeout !== void 0) {
|
|
735
|
+
clearTimeout(spanEndTimeout);
|
|
736
|
+
}
|
|
737
|
+
if (span && !spanEndedByTimeout) {
|
|
738
|
+
const aborted = abortSignal?.aborted ?? false;
|
|
739
|
+
endLLMRequestSpan(span, {
|
|
740
|
+
success: !errorOccurred,
|
|
741
|
+
...usageSpanMetadata(lastUsageMetadata),
|
|
742
|
+
ttftMs,
|
|
743
|
+
durationMs: Date.now() - startTime,
|
|
744
|
+
error: errorOccurred ? aborted ? API_CALL_ABORTED_SPAN_STATUS_MESSAGE : API_CALL_FAILED_SPAN_STATUS_MESSAGE : void 0,
|
|
745
|
+
responseId: firstResponseId || void 0,
|
|
746
|
+
responseModel: firstModelVersion || void 0,
|
|
747
|
+
finishReasons: finishReasons.size > 0 ? [...finishReasons.entries()].sort(([left], [right]) => left - right).map(([, reason]) => reason) : void 0,
|
|
748
|
+
thoughtsTokenCount: lastUsageMetadata?.thoughtsTokenCount,
|
|
749
|
+
subagentName: subagentName || void 0,
|
|
750
|
+
errorType: lastError ? getErrorType(lastError) : void 0,
|
|
751
|
+
errorStatusCode: lastError ? getErrorStatus(lastError) : void 0,
|
|
752
|
+
...retrySnapshot,
|
|
753
|
+
config: this.config
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
async buildOpenAIRequestForLogging(request) {
|
|
759
|
+
if (!this.openaiLogger) {
|
|
760
|
+
return void 0;
|
|
761
|
+
}
|
|
762
|
+
const requestContext = this.createLoggingRequestContext(request.model);
|
|
763
|
+
const messages = OpenAIContentConverter.convertGeminiRequestToOpenAI(
|
|
764
|
+
request,
|
|
765
|
+
requestContext,
|
|
766
|
+
{
|
|
767
|
+
cleanOrphanToolCalls: false
|
|
768
|
+
}
|
|
769
|
+
);
|
|
770
|
+
const openaiRequest = {
|
|
771
|
+
model: request.model,
|
|
772
|
+
messages
|
|
773
|
+
};
|
|
774
|
+
if (request.config?.tools) {
|
|
775
|
+
openaiRequest.tools = await OpenAIContentConverter.convertGeminiToolsToOpenAI(
|
|
776
|
+
request.config.tools,
|
|
777
|
+
this.schemaCompliance ?? "auto"
|
|
778
|
+
);
|
|
779
|
+
}
|
|
780
|
+
if (request.config?.temperature !== void 0) {
|
|
781
|
+
openaiRequest.temperature = request.config.temperature;
|
|
782
|
+
}
|
|
783
|
+
if (request.config?.topP !== void 0) {
|
|
784
|
+
openaiRequest.top_p = request.config.topP;
|
|
785
|
+
}
|
|
786
|
+
if (request.config?.maxOutputTokens !== void 0) {
|
|
787
|
+
openaiRequest.max_tokens = request.config.maxOutputTokens;
|
|
788
|
+
}
|
|
789
|
+
if (request.config?.presencePenalty !== void 0) {
|
|
790
|
+
openaiRequest.presence_penalty = request.config.presencePenalty;
|
|
791
|
+
}
|
|
792
|
+
if (request.config?.frequencyPenalty !== void 0) {
|
|
793
|
+
openaiRequest.frequency_penalty = request.config.frequencyPenalty;
|
|
794
|
+
}
|
|
795
|
+
return openaiRequest;
|
|
796
|
+
}
|
|
797
|
+
createLoggingRequestContext(model) {
|
|
798
|
+
return {
|
|
799
|
+
model,
|
|
800
|
+
modalities: this.modalities ?? {},
|
|
801
|
+
// Mirror the pipeline default (see pipeline.ts createRequestContext) so the
|
|
802
|
+
// --openai-logging fallback reconstruction reflects the same split as the
|
|
803
|
+
// request actually sent. Opt out via generationConfig.splitToolMedia = false.
|
|
804
|
+
splitToolMedia: this.splitToolMedia ?? true,
|
|
805
|
+
toolResultContentFormat: this.toolResultContentFormat ?? "parts",
|
|
806
|
+
startTime: 0
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
async logOpenAIInteraction(openaiRequest, response, error, promptId) {
|
|
810
|
+
if (!this.openaiLogger || !openaiRequest) {
|
|
811
|
+
return;
|
|
812
|
+
}
|
|
813
|
+
const openaiResponse = response ? this.convertGeminiResponseToOpenAIForLogging(response, openaiRequest) : void 0;
|
|
814
|
+
await this.openaiLogger.logInteraction(
|
|
815
|
+
openaiRequest,
|
|
816
|
+
openaiResponse,
|
|
817
|
+
error instanceof Error ? error : error ? new Error(String(error)) : void 0,
|
|
818
|
+
promptId
|
|
819
|
+
);
|
|
820
|
+
}
|
|
821
|
+
async safelyLogOpenAIInteraction(openaiRequest, response, error, promptId) {
|
|
822
|
+
try {
|
|
823
|
+
await this.logOpenAIInteraction(openaiRequest, response, error, promptId);
|
|
824
|
+
} catch (loggingError) {
|
|
825
|
+
debugLogger.warn("Failed to log OpenAI interaction:", loggingError);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
convertGeminiResponseToOpenAIForLogging(response, openaiRequest) {
|
|
829
|
+
return OpenAIContentConverter.convertGeminiResponseToOpenAI(
|
|
830
|
+
response,
|
|
831
|
+
this.createLoggingRequestContext(openaiRequest.model)
|
|
832
|
+
);
|
|
833
|
+
}
|
|
834
|
+
consolidateGeminiResponsesForLogging(responses) {
|
|
835
|
+
if (responses.length === 0) {
|
|
836
|
+
return void 0;
|
|
837
|
+
}
|
|
838
|
+
const consolidated = new GenerateContentResponse();
|
|
839
|
+
const combinedParts = [];
|
|
840
|
+
const functionCallIndex = /* @__PURE__ */ new Map();
|
|
841
|
+
let finishReason;
|
|
842
|
+
let usageMetadata;
|
|
843
|
+
for (const response of responses) {
|
|
844
|
+
if (response.usageMetadata) {
|
|
845
|
+
usageMetadata = response.usageMetadata;
|
|
846
|
+
}
|
|
847
|
+
const candidate = response.candidates?.[0];
|
|
848
|
+
if (candidate?.finishReason) {
|
|
849
|
+
finishReason = candidate.finishReason;
|
|
850
|
+
}
|
|
851
|
+
const parts = candidate?.content?.parts ?? [];
|
|
852
|
+
for (const part of parts) {
|
|
853
|
+
if (typeof part === "string") {
|
|
854
|
+
combinedParts.push({ text: part });
|
|
855
|
+
continue;
|
|
856
|
+
}
|
|
857
|
+
if ("text" in part) {
|
|
858
|
+
if (part.text) {
|
|
859
|
+
combinedParts.push({
|
|
860
|
+
text: part.text,
|
|
861
|
+
...part.thought ? { thought: true } : {},
|
|
862
|
+
...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {}
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
continue;
|
|
866
|
+
}
|
|
867
|
+
if ("functionCall" in part && part.functionCall) {
|
|
868
|
+
const callKey = part.functionCall.id || part.functionCall.name || "tool_call";
|
|
869
|
+
const existingIndex = functionCallIndex.get(callKey);
|
|
870
|
+
const functionPart = { functionCall: part.functionCall };
|
|
871
|
+
if (existingIndex !== void 0) {
|
|
872
|
+
combinedParts[existingIndex] = functionPart;
|
|
873
|
+
} else {
|
|
874
|
+
functionCallIndex.set(callKey, combinedParts.length);
|
|
875
|
+
combinedParts.push(functionPart);
|
|
876
|
+
}
|
|
877
|
+
continue;
|
|
878
|
+
}
|
|
879
|
+
if ("functionResponse" in part && part.functionResponse) {
|
|
880
|
+
combinedParts.push({ functionResponse: part.functionResponse });
|
|
881
|
+
continue;
|
|
882
|
+
}
|
|
883
|
+
combinedParts.push(part);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
const lastResponse = responses[responses.length - 1];
|
|
887
|
+
const lastCandidate = lastResponse.candidates?.[0];
|
|
888
|
+
consolidated.responseId = lastResponse.responseId;
|
|
889
|
+
consolidated.createTime = lastResponse.createTime;
|
|
890
|
+
consolidated.modelVersion = lastResponse.modelVersion;
|
|
891
|
+
consolidated.promptFeedback = lastResponse.promptFeedback;
|
|
892
|
+
consolidated.usageMetadata = usageMetadata;
|
|
893
|
+
consolidated.candidates = [
|
|
894
|
+
{
|
|
895
|
+
content: {
|
|
896
|
+
role: lastCandidate?.content?.role || "model",
|
|
897
|
+
parts: combinedParts
|
|
898
|
+
},
|
|
899
|
+
...finishReason ? { finishReason } : {},
|
|
900
|
+
index: 0,
|
|
901
|
+
safetyRatings: lastCandidate?.safetyRatings || []
|
|
902
|
+
}
|
|
903
|
+
];
|
|
904
|
+
return consolidated;
|
|
905
|
+
}
|
|
906
|
+
extractResponseText(response, maxLength) {
|
|
907
|
+
let text = "";
|
|
908
|
+
let truncated = false;
|
|
909
|
+
const maxPrefixLength = Math.max(
|
|
910
|
+
0,
|
|
911
|
+
maxLength - RESPONSE_TEXT_TRUNCATION_SUFFIX.length
|
|
912
|
+
);
|
|
913
|
+
const hasText = this.forEachVisibleResponseText(response, (partText) => {
|
|
914
|
+
if (truncated) {
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
const remaining = maxPrefixLength - text.length;
|
|
918
|
+
if (partText.length <= remaining) {
|
|
919
|
+
text += partText;
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
922
|
+
text += partText.slice(0, Math.max(0, remaining));
|
|
923
|
+
truncated = true;
|
|
924
|
+
});
|
|
925
|
+
if (!hasText) {
|
|
926
|
+
return void 0;
|
|
927
|
+
}
|
|
928
|
+
return truncated ? `${text}${RESPONSE_TEXT_TRUNCATION_SUFFIX}` : text;
|
|
929
|
+
}
|
|
930
|
+
extractResponseTextForSensitiveSpan(response, maxLength) {
|
|
931
|
+
let text = "";
|
|
932
|
+
let originalLength = 0;
|
|
933
|
+
const hasText = this.forEachVisibleResponseText(response, (partText) => {
|
|
934
|
+
originalLength += partText.length;
|
|
935
|
+
const remaining = maxLength - text.length;
|
|
936
|
+
if (remaining > 0) {
|
|
937
|
+
text += partText.slice(0, remaining);
|
|
938
|
+
}
|
|
939
|
+
});
|
|
940
|
+
if (!hasText) {
|
|
941
|
+
return void 0;
|
|
942
|
+
}
|
|
943
|
+
return { text, originalLength };
|
|
944
|
+
}
|
|
945
|
+
forEachVisibleResponseText(response, onText) {
|
|
946
|
+
const parts = response?.candidates?.[0]?.content?.parts;
|
|
947
|
+
if (!parts?.length) {
|
|
948
|
+
return false;
|
|
949
|
+
}
|
|
950
|
+
let hasText = false;
|
|
951
|
+
for (const part of parts) {
|
|
952
|
+
const text = this.getVisibleResponsePartText(part);
|
|
953
|
+
if (text === void 0) {
|
|
954
|
+
continue;
|
|
955
|
+
}
|
|
956
|
+
hasText = true;
|
|
957
|
+
onText(text);
|
|
958
|
+
}
|
|
959
|
+
return hasText;
|
|
960
|
+
}
|
|
961
|
+
getVisibleResponsePartText(part) {
|
|
962
|
+
if (typeof part === "string") {
|
|
963
|
+
return part;
|
|
964
|
+
}
|
|
965
|
+
if ("text" in part && typeof part.text === "string" && !("thought" in part && part.thought)) {
|
|
966
|
+
return part.text;
|
|
967
|
+
}
|
|
968
|
+
return void 0;
|
|
969
|
+
}
|
|
970
|
+
safelyAddModelOutputAttributes(span, modelOutput) {
|
|
971
|
+
try {
|
|
972
|
+
addModelOutputAttributes(
|
|
973
|
+
this.config,
|
|
974
|
+
span,
|
|
975
|
+
modelOutput?.text,
|
|
976
|
+
modelOutput?.originalLength
|
|
977
|
+
);
|
|
978
|
+
} catch (error) {
|
|
979
|
+
debugLogger.warn("Failed to add model output span attributes:", error);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
shouldCollectSensitiveSpanAttributes() {
|
|
983
|
+
return areSensitiveSpanAttributesEnabled(this.config);
|
|
984
|
+
}
|
|
985
|
+
async countTokens(req) {
|
|
986
|
+
return this.wrapped.countTokens(req);
|
|
987
|
+
}
|
|
988
|
+
async embedContent(req) {
|
|
989
|
+
return this.wrapped.embedContent(req);
|
|
990
|
+
}
|
|
991
|
+
useSummarizedThinking() {
|
|
992
|
+
return this.wrapped.useSummarizedThinking();
|
|
993
|
+
}
|
|
994
|
+
toContents(contents) {
|
|
995
|
+
if (Array.isArray(contents)) {
|
|
996
|
+
return contents.map((c) => this.toContent(c));
|
|
997
|
+
}
|
|
998
|
+
return [this.toContent(contents)];
|
|
999
|
+
}
|
|
1000
|
+
toContent(content) {
|
|
1001
|
+
if (Array.isArray(content)) {
|
|
1002
|
+
return {
|
|
1003
|
+
role: "user",
|
|
1004
|
+
parts: this.toParts(content)
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
if (typeof content === "string") {
|
|
1008
|
+
return {
|
|
1009
|
+
role: "user",
|
|
1010
|
+
parts: [{ text: content }]
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
if ("parts" in content) {
|
|
1014
|
+
return {
|
|
1015
|
+
...content,
|
|
1016
|
+
parts: content.parts ? this.toParts(content.parts.filter((p) => p != null)) : []
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
return {
|
|
1020
|
+
role: "user",
|
|
1021
|
+
parts: [this.toPart(content)]
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
toParts(parts) {
|
|
1025
|
+
return parts.map((p) => this.toPart(p));
|
|
1026
|
+
}
|
|
1027
|
+
toPart(part) {
|
|
1028
|
+
if (typeof part === "string") {
|
|
1029
|
+
return { text: part };
|
|
1030
|
+
}
|
|
1031
|
+
if ("thought" in part && part.thought) {
|
|
1032
|
+
const thoughtText = `[Thought: ${part.thought}]`;
|
|
1033
|
+
const newPart = { ...part };
|
|
1034
|
+
delete newPart["thought"];
|
|
1035
|
+
const hasApiContent = "functionCall" in newPart || "functionResponse" in newPart || "inlineData" in newPart || "fileData" in newPart;
|
|
1036
|
+
if (hasApiContent) {
|
|
1037
|
+
return newPart;
|
|
1038
|
+
}
|
|
1039
|
+
const text = newPart.text;
|
|
1040
|
+
const existingText = text ? String(text) : "";
|
|
1041
|
+
const combinedText = existingText ? `${existingText}
|
|
1042
|
+
${thoughtText}` : thoughtText;
|
|
1043
|
+
return {
|
|
1044
|
+
...newPart,
|
|
1045
|
+
text: combinedText
|
|
1046
|
+
};
|
|
1047
|
+
}
|
|
1048
|
+
return part;
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
export {
|
|
1052
|
+
LoggingContentGenerator
|
|
1053
|
+
};
|
|
1054
|
+
/**
|
|
1055
|
+
* @license
|
|
1056
|
+
* Copyright 2026 Qwen Team
|
|
1057
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
1058
|
+
*/
|
|
1059
|
+
/**
|
|
1060
|
+
* @license
|
|
1061
|
+
* Copyright 2025 Google LLC
|
|
1062
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
1063
|
+
*/
|
|
1064
|
+
/**
|
|
1065
|
+
* @license
|
|
1066
|
+
* Copyright 2025 Qwen
|
|
1067
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
1068
|
+
*/
|