nolo-cli 0.228.0-alpha.2 → 0.228.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -5
- package/{_executeModel-VYCHHZVT.js → _executeModel-AKCTHGMP.js} +89 -83
- package/{accountResolver-QETKNC7T.js → accountResolver-NGICIMEE.js} +1 -1
- package/{action-GDZDXPMB.js → action-C6IQAKN4.js} +8 -5
- package/{addContentAction-7RO4AMRI.js → addContentAction-53364YDW.js} +13 -12
- package/{addDialogAgentAction-EVYBGTXB.js → addDialogAgentAction-U5DD5EN5.js} +16 -15
- package/{agentDeleteCommand-QWQKT54A.js → agentDeleteCommand-2E5FAGUO.js} +128 -115
- package/{agentEmailCommands-EISMBIRE.js → agentEmailCommands-UGZZAH7E.js} +128 -111
- package/{agentListCommands-4WLG32IW.js → agentListCommands-JCTW3J2K.js} +398 -179
- package/{agentMachineCommands-DC6NKWTU.js → agentMachineCommands-QPG5ZXF4.js} +58 -47
- package/{agentProviderCommands-STI3DQ6A.js → agentProviderCommands-QLTABYR7.js} +2 -2
- package/{agentPullCommand-KHV4EELF.js → agentPullCommand-2EYJ5ENC.js} +1 -1
- package/agentRecordCommands-4NTVR6MZ.js +194 -0
- package/agentRunCommand-VHF34PYC.js +232 -0
- package/{agentRunControl-MBG4U6SL.js → agentRunControl-QYTXUQGY.js} +14 -9
- package/{agentRuntimeLocal-HOXKWCYO.js → agentRuntimeLocal-U54AKHXH.js} +58 -43
- package/{agentSlice-UG76KEBH.js → agentSlice-4JGDEXWK.js} +14 -13
- package/{appDeleteCommands-WWCC6WA5.js → appDeleteCommands-XBE5QJ6P.js} +58 -47
- package/{appDeployCommands-AU4IUN33.js → appDeployCommands-QIYLXXGA.js} +58 -47
- package/{appDeployStatusCommands-STUW7WXL.js → appDeployStatusCommands-JXS6ZQZZ.js} +58 -47
- package/{appGetCommands-BGTLIQ4K.js → appGetCommands-SZS7SJPK.js} +58 -47
- package/{appListCommands-CUCPRUXW.js → appListCommands-B3GBJSNV.js} +58 -47
- package/{authCommand-OZ2KTP4Z.js → authCommand-V6EOMZX6.js} +25 -19
- package/{authCommands-55OGQGCR.js → authCommands-T5FODCEG.js} +12 -6
- package/{builtinSkillRegistry-BAE2LDXF.js → builtinSkillRegistry-ZQC3IIO2.js} +8 -7
- package/{chromeCommands-G5UDKVSV.js → chromeCommands-O4IIKTBD.js} +384 -7
- package/{chromeOpsCommands-WAA45NCS.js → chromeOpsCommands-OFX7ZGKP.js} +3 -3
- package/{chunk-DBUR22G5.js → chunk-223KZUJ6.js} +19 -15
- package/{chunk-3U44JB3O.js → chunk-2C5VN7NH.js} +1 -1
- package/{chunk-PWTNI4N7.js → chunk-2E4BYAUE.js} +22 -0
- package/{chunk-L32W3PRP.js → chunk-2FZVXOFX.js} +234 -18
- package/{chunk-HBRDSQ3M.js → chunk-2JHGUL5K.js} +3 -2
- package/chunk-2SXN7LAY.js +15 -0
- package/chunk-3A5NNQCN.js +64 -0
- package/chunk-3F2FRLIO.js +372 -0
- package/{chunk-DEA37IUY.js → chunk-46FETNLF.js} +2 -2
- package/{chunk-ZEVQHCLM.js → chunk-4GYVS4PM.js} +8 -6
- package/{chunk-CBUZ6DKA.js → chunk-4YPH5KRA.js} +1 -1
- package/chunk-4ZCTKB27.js +31 -0
- package/chunk-53W5BXLN.js +340 -0
- package/{chunk-7FEP5USX.js → chunk-5AYP5QBB.js} +5 -5
- package/{chunk-XAG3FWBE.js → chunk-5ISNPTQH.js} +5 -5
- package/{chunk-EVGU5P4U.js → chunk-5P3PPQVP.js} +1 -1
- package/{chunk-XSW4EXQV.js → chunk-6BMTKYAO.js} +55 -18
- package/chunk-6PAHSSD2.js +33401 -0
- package/{chunk-ZOHO6MOF.js → chunk-6RSNVJGO.js} +2 -99
- package/{chunk-7JGMNKKG.js → chunk-6SOWMEAY.js} +30 -9
- package/{chunk-RG2DGNL6.js → chunk-6VEO7Z3Y.js} +3 -3
- package/{chunk-PDCV7P5W.js → chunk-6XIE5ZGI.js} +1 -1
- package/{chunk-DGYCDA6W.js → chunk-7BIJFGKS.js} +36 -17
- package/{chunk-WFDNADFX.js → chunk-7OVOZRZF.js} +8 -8
- package/{chunk-WCFFRBL5.js → chunk-7PON4LBY.js} +45 -27
- package/{chunk-QRGDJA4B.js → chunk-7WHCIA5V.js} +33 -7
- package/{chunk-CMMI3DAT.js → chunk-ADYWV732.js} +59 -30
- package/{chunk-QYB23WUH.js → chunk-AIFQKNPP.js} +1 -1
- package/{chunk-HGDKT2D6.js → chunk-BPB3T5EU.js} +174 -1
- package/{chunk-DUUDXSLX.js → chunk-BZLGPM5B.js} +28 -4
- package/{chunk-ATEKLSLR.js → chunk-BZMDWGQQ.js} +14 -9
- package/chunk-C5A54QS7.js +108 -0
- package/{chunk-S6K5F3KP.js → chunk-CEKRIR22.js} +1 -1
- package/{chunk-42OKN2LI.js → chunk-D634SL2Y.js} +9 -107
- package/{chunk-DLXMMTGM.js → chunk-DHRPLRIR.js} +1283 -786
- package/{chunk-LKA64WH4.js → chunk-DMPZMYH4.js} +37 -1
- package/{chunk-OBIC6EG7.js → chunk-DNNPARJK.js} +9 -5
- package/{chunk-X3E6EHJW.js → chunk-E3LSO6EI.js} +292 -207
- package/{chunk-OQHIVPG4.js → chunk-E6A5NHDH.js} +4 -1
- package/chunk-EHFBP6IK.js +791 -0
- package/chunk-EJQE5HB7.js +21 -0
- package/{chunk-VQ5N5GSV.js → chunk-EL5NRJHI.js} +4 -4
- package/chunk-EUGTFFO6.js +42 -0
- package/{chunk-7BCG67EI.js → chunk-EVHTYVD2.js} +1199 -442
- package/{chunk-6XRPBZRS.js → chunk-EYLGAEB4.js} +0 -134
- package/{chunk-262R3XNN.js → chunk-FEIVARWR.js} +377 -112
- package/{chunk-3VZLEKV2.js → chunk-FLBJ7IJI.js} +14 -14
- package/{chunk-EEOOBRA7.js → chunk-FXEPZKNJ.js} +13 -6
- package/{chunk-XTJKU3Z4.js → chunk-FYAMUU55.js} +677 -140
- package/{chunk-M3OZRQNH.js → chunk-FZANZZ63.js} +1 -1
- package/chunk-GAHJLSDO.js +107 -0
- package/{chunk-WWTSEBDF.js → chunk-GIXWVN2W.js} +1 -1
- package/{chunk-4N6G2CKP.js → chunk-HDKMVYNJ.js} +47 -1
- package/chunk-HEVRQGGH.js +106 -0
- package/{chunk-BIWI5M4E.js → chunk-HFHJPHFK.js} +1 -1
- package/{chunk-R6Z5S5GA.js → chunk-HPDLPEUG.js} +60 -17
- package/{chunk-YKY4OVOX.js → chunk-HQUGB2HM.js} +17 -170
- package/chunk-IIRJ4P4I.js +24 -0
- package/chunk-IVK2KT3H.js +209 -0
- package/{chunk-ALAES342.js → chunk-IYLUK67R.js} +9 -5
- package/{chunk-N5Z2V73W.js → chunk-J55F3IEZ.js} +1 -1
- package/{chunk-S6FDXXZV.js → chunk-J7JRCOIW.js} +2 -2
- package/{chunk-OWKNSIXL.js → chunk-JAKRY74O.js} +470 -83
- package/{chunk-VS276URX.js → chunk-JCQ3WCQ3.js} +4 -2
- package/chunk-JLZJL3WC.js +988 -0
- package/{chunk-OBSEKCVK.js → chunk-JPXACKSW.js} +219 -52
- package/{chunk-OTKSESZR.js → chunk-KDBDOXOM.js} +138 -54
- package/{chunk-VP3BINY7.js → chunk-KDDHQMSH.js} +31 -1
- package/{chunk-RBPUNSG5.js → chunk-KG27JIG4.js} +18 -108
- package/{chunk-4WVJLODK.js → chunk-KHYSFS3W.js} +88 -7
- package/{chunk-TCZ2VJZQ.js → chunk-KKIQAVDR.js} +9 -9
- package/{chunk-4JVNURX4.js → chunk-KQHEGELM.js} +68 -16
- package/chunk-KXOPLLFP.js +190 -0
- package/{chunk-HS7MLR74.js → chunk-KZ4A7EIV.js} +3 -5
- package/{chunk-HYLRQDEE.js → chunk-LLUBUHNT.js} +6 -6
- package/{chunk-QJTZ76CP.js → chunk-LS5KAVFQ.js} +1 -0
- package/{chunk-RTHFJZ6M.js → chunk-LVZVSLKO.js} +29 -9
- package/{chunk-TI2EPRHE.js → chunk-MNFUKRRU.js} +3 -3
- package/chunk-MVOZ22RZ.js +26 -0
- package/{chunk-CNMY2XM6.js → chunk-O3A2CHAL.js} +6 -6
- package/{chunk-TSPMLCWI.js → chunk-OB4FBZXJ.js} +5 -5
- package/{chunk-LYD6C7OU.js → chunk-OJSJJKHF.js} +6 -6
- package/{chunk-M4SFKP5L.js → chunk-OKAXQFON.js} +3 -3
- package/{chunk-CD3RU7XL.js → chunk-OKH74FML.js} +121 -14
- package/{chunk-U2HBB7RS.js → chunk-OOV5JN25.js} +130 -30
- package/{chunk-ZH3KXFHS.js → chunk-OOVOAG4Q.js} +1 -1
- package/chunk-OQFOE4SJ.js +405 -0
- package/{chunk-M3JEW6N6.js → chunk-OYUMJMC5.js} +15 -0
- package/chunk-P27E22MA.js +203 -0
- package/{chunk-SRCCSTIM.js → chunk-P4R5KXU7.js} +4 -4
- package/{chunk-FJ23FZXF.js → chunk-PHREU2KZ.js} +5 -3
- package/{chunk-HSSBDZLD.js → chunk-PIVTQRX6.js} +43 -13
- package/{chunk-XFXFPUO7.js → chunk-PJL7OJRC.js} +13 -39
- package/{chunk-RRDRQOEC.js → chunk-PNLDLUMO.js} +276 -303
- package/{chunk-4I2MXV5Q.js → chunk-PVFYPUIM.js} +2 -0
- package/{chunk-HHFGE2WF.js → chunk-QGFLVQ6E.js} +5 -5
- package/{chunk-EGHP7KOY.js → chunk-QONAOHVW.js} +38 -29
- package/chunk-R3FZHW4Q.js +103 -0
- package/{chunk-ZYKJBRZ3.js → chunk-R3MV2GII.js} +1 -47
- package/chunk-R72QWIFO.js +50 -0
- package/{chunk-5FUN7EG4.js → chunk-RD3QLZQV.js} +83 -47
- package/{chunk-ILHQ2AXT.js → chunk-RIWKZT7E.js} +36 -8
- package/{chunk-OOJNQK6V.js → chunk-S25VJYXV.js} +8 -2
- package/{chunk-45CAVC35.js → chunk-S7H4KTMB.js} +2568 -337
- package/{chunk-OJ45MEEI.js → chunk-SA356NGW.js} +1 -1
- package/{chunk-F6Z6ZCUV.js → chunk-SCAC3NM5.js} +3 -3
- package/{chunk-YVFH2MFB.js → chunk-SLUN7W6S.js} +7 -7
- package/chunk-SQL7YNED.js +650 -0
- package/chunk-SR4FE5VD.js +9 -0
- package/{chunk-HF7BLF3F.js → chunk-SSOR2EDT.js} +107 -104
- package/chunk-TRRXYFTR.js +46 -0
- package/{chunk-3QIYD3VM.js → chunk-TUOHSUK5.js} +20068 -18402
- package/chunk-TYJCIA2O.js +835 -0
- package/{chunk-S2NTVGA2.js → chunk-U35UUM5K.js} +2 -1
- package/{chunk-GAYNXB6T.js → chunk-U3BUWDUP.js} +1031 -2155
- package/{chunk-BP5ZJ6B4.js → chunk-U6QNVOR5.js} +1 -1
- package/{chunk-UAIHKQIA.js → chunk-U6RD332P.js} +18 -2
- package/chunk-UAF5VQCE.js +77 -0
- package/{chunk-TQEKUOTI.js → chunk-UFGUJ2IH.js} +12 -12
- package/{chunk-VMJVAJ6W.js → chunk-UP7KBWLE.js} +109 -33
- package/{chunk-2X7WFDT6.js → chunk-UUCYUN6Y.js} +1 -1
- package/{chunk-5YMA6DDZ.js → chunk-UZKBVQUX.js} +1 -1
- package/chunk-V5TI7HJH.js +133 -0
- package/{chunk-WFGNWWJI.js → chunk-VH7UO6E5.js} +252 -114
- package/{chunk-MNEZUL5S.js → chunk-VJFDG3ZG.js} +63 -94
- package/{chunk-G7IUT2V3.js → chunk-WC3J5SL2.js} +635 -350
- package/{chunk-HXB4VDGK.js → chunk-WD5547ZF.js} +33 -30
- package/chunk-WDWZPASX.js +29 -0
- package/{chunk-4ZGPHFLE.js → chunk-WS36XPJD.js} +2 -2
- package/{chunk-6QHKRARD.js → chunk-WSLL7VV4.js} +29 -5
- package/chunk-XRGBJHZX.js +136 -0
- package/{chunk-MZG5CETE.js → chunk-Y2KWJTOZ.js} +4 -4
- package/{dialogUsageCommand-W2WCSGKF.js → chunk-Y2TCTNUD.js} +27 -20
- package/chunk-YJPK35HB.js +175 -0
- package/{chunk-6OVNSQHN.js → chunk-YLAHYLDQ.js} +5 -0
- package/{chunk-547ENH5T.js → chunk-YN23INFZ.js} +4 -4
- package/{chunk-4QYJPWHH.js → chunk-YXK3GJF5.js} +232 -10
- package/{chunk-MJI3UAXN.js → chunk-Z2OWAYMI.js} +77 -51
- package/{chunk-7Z6EW7AH.js → chunk-ZTHAJU3O.js} +106 -14
- package/{chunk-YFLVRVYK.js → chunk-ZYPXOQS2.js} +1 -1
- package/{cliAgentConfigHelpers-BTRHMPW2.js → cliAgentConfigHelpers-BXHQ3PXP.js} +9 -9
- package/{cliAuthorityBrokerClient-XHH7MH2P.js → cliAuthorityBrokerClient-TFNXJLXL.js} +1 -1
- package/cliAuthorityBrokerProcess-5ZFBTHLB.js +22 -0
- package/cliLocalAgentRecordReader-47PXMHPH.js +104 -0
- package/{commandRegistry-FVYPE2IN.js → commandRegistry-CTMPAQH2.js} +111 -162
- package/{contentThunks-GNFPG32S.js → contentThunks-CAHIIZO5.js} +38 -36
- package/{cooldownCommands-YB5H5BBK.js → cooldownCommands-WDOI5VD7.js} +3 -3
- package/{createAgentAutomationAction-PB4QIFQ4.js → createAgentAutomationAction-M25XZSPD.js} +38 -36
- package/{createDialogAction-EVTOPY7A.js → createDialogAction-4SN7FKI7.js} +39 -37
- package/{createPageAction-2UYF2IDZ.js → createPageAction-N7QPDN3M.js} +43 -41
- package/{db-M7FU2GNK.js → db-VR74ADGC.js} +7 -2
- package/{dbSlice-XRUZOGSU.js → dbSlice-RWPSVHBC.js} +12 -11
- package/{deleteFile-6URDHYRB.js → deleteFile-ECU6FU5C.js} +15 -7
- package/{dialogCommands-6SZD4TYP.js → dialogCommands-BBHWCKDP.js} +69 -53
- package/dialogMessageRecord-OAV77LT7.js +7 -0
- package/{dialogNotifyCommand-SHGPCU22.js → dialogNotifyCommand-IASQGEMW.js} +11 -11
- package/{dialogSlice-5EQ2A6LY.js → dialogSlice-JI3J22RV.js} +39 -37
- package/dialogTraceCommand-EW2KK6A4.js +961 -0
- package/dialogUsageCommand-WJ3U6KZU.js +27 -0
- package/{docCreateCommands-25E6PGN3.js → docCreateCommands-QSX3X5U4.js} +57 -46
- package/{docDeleteCommands-F7ZVGEHW.js → docDeleteCommands-63JBG2HQ.js} +59 -48
- package/{docReadCommands-JY2E5XEN.js → docReadCommands-CQFKRQUI.js} +57 -46
- package/{docStore-OKKIKLT3.js → docStore-XLBKGGNM.js} +14 -13
- package/{docUpdateCommands-OZ4CUSIQ.js → docUpdateCommands-534LUK25.js} +57 -46
- package/ebookDownloaderAgentCommand-DYSKF5ZY.js +677 -0
- package/fetchMessages-TQEUZD7H.js +1 -1
- package/{getPricing-LF5C4XSI.js → getPricing-5BLZRPTM.js} +4 -4
- package/{handleSendMessageAction-LNT7SZND.js → handleSendMessageAction-Q2VMEVOR.js} +127 -81
- package/{hostCredentialCreate-XUU2CSHI.js → hostCredentialCreate-C57T7YPE.js} +127 -109
- package/index.js +23 -11
- package/{localDialogRead-CCOCVGAP.js → localDialogRead-BJJT3TF5.js} +1 -1
- package/{localRuntimeAdapter-IBSTMSX7.js → localRuntimeAdapter-OALZPFZU.js} +134 -115
- package/localRuntimeAuthority-UF2DAQ3F.js +28 -0
- package/{localRuntimeDb-N7KHDXS2.js → localRuntimeDb-ZJFGNHML.js} +1 -1
- package/{machineCommands-HSQHDHOT.js → machineCommands-N6IVWRZT.js} +262 -325
- package/machineWsRunDispatch-PDWYB33B.js +209 -0
- package/markdownToSlate-PXYAIBVL.js +8 -0
- package/mcpLocalAuthorizeCommand-KYI4EGF5.js +110 -0
- package/{memberThunks-7Y3OYSJQ.js → memberThunks-43B7UYC5.js} +21 -16
- package/{models-H5NNZRLH.js → models-ZX2BYIMB.js} +2 -2
- package/{overlay-BBQZXGYI.js → overlay-JA3SPVUS.js} +5 -3
- package/package.json +2 -1
- package/{projectArchive-FQO654Z3.js → projectArchive-TJNW5DLM.js} +46 -44
- package/{providerPresetApply-WHAMP2D5.js → providerPresetApply-NTJUINI6.js} +36 -17
- package/{providerRegistry-ZI2KORJ7.js → providerRegistry-W45SLUV6.js} +6 -6
- package/{read-TYMBGEXO.js → read-KG6INYUT.js} +13 -7
- package/{readDocTool-SKQVHBLO.js → readDocTool-N3GA52JR.js} +1 -1
- package/{readlineWorkspace-7U272DSA.js → readlineWorkspace-PJZJVGA5.js} +7486 -4492
- package/rememberExplicit-CPAPONSI.js +15 -0
- package/{removeDialogAgentAction-F5QE2O2B.js → removeDialogAgentAction-EEVSOQOJ.js} +18 -17
- package/{runAgentClientLoop-AF4JQIJ7.js → runAgentClientLoop-3VC5TCDW.js} +107 -76
- package/{runtimeDoctorCommands-RRKPBGVO.js → runtimeDoctorCommands-V3M3JTUV.js} +14 -11
- package/{secretCommands-KZWBZIYS.js → secretCommands-KVVZS7A6.js} +3 -3
- package/{setDialogExtraReferencesAction-72L27ERM.js → setDialogExtraReferencesAction-DNO5POHA.js} +15 -14
- package/{setPrimaryDialogAgentAction-GJJDUSGJ.js → setPrimaryDialogAgentAction-QABBEO4C.js} +18 -17
- package/{settingThunks-ZRGWVGZD.js → settingThunks-DVKG4X4S.js} +181 -66
- package/{skillDiscovery-BHHPCUHZ.js → skillDiscovery-ZMJH36AK.js} +4 -3
- package/{spaceCommands-5VNWMDBE.js → spaceCommands-AGGZXPY3.js} +235 -87
- package/{streamAgentChatTurn-YSPEFY4K.js → streamAgentChatTurn-4GTLL2OF.js} +242 -169
- package/{switchDialogAgentAction-IIJBPND3.js → switchDialogAgentAction-KYWJSGOO.js} +16 -15
- package/{tableCommands-FTAOCBTX.js → tableCommands-EFA754RE.js} +7 -4
- package/{toolApiClient-OGQEBQVX.js → toolApiClient-N5PYW2R3.js} +8 -6
- package/{tools-M35PTIFB.js → tools-5AGPOPLW.js} +69 -65
- package/{tuiRestart-2IL37YIB.js → tuiRestart-77E7PL4R.js} +11 -10
- package/{tuiSummaryLlmCaller-W2QN4VAC.js → tuiSummaryLlmCaller-HROLGN4F.js} +16 -15
- package/{updateCommands-CPATDG6J.js → updateCommands-GJGRS6JK.js} +3 -3
- package/{updateDialogTitleAction-IMIRJRQQ.js → updateDialogTitleAction-5OSEDGRK.js} +40 -38
- package/{usageCommand-2BF74MKF.js → usageCommand-WI6SQOPB.js} +2 -2
- package/{usageRebuildCommand-UHB55BQM.js → usageRebuildCommand-WQRLLZAT.js} +3 -3
- package/webapi-QVV65DQF.js +2487 -0
- package/{windowsSelfUpdate-ZFD6J5HF.js → windowsSelfUpdate-C7LGVWYX.js} +2 -2
- package/workContext-Y3ADAPZU.js +14 -0
- package/workContextAccess-VU5I4LKZ.js +11 -0
- package/workContextWriteNotice-YCSSMHN4.js +7 -0
- package/{workloadLifecycle-HFJIN5IZ.js → workloadLifecycle-P2SJVV3S.js} +2 -2
- package/agentRecordCommands-IZYUVHME.js +0 -177
- package/agentRunCommand-QM7ETUTX.js +0 -209
- package/chunk-2YGBI2XB.js +0 -30
- package/chunk-5ZMIIR23.js +0 -265
- package/chunk-5ZUOVCKT.js +0 -32
- package/chunk-62HXNQVV.js +0 -134
- package/chunk-FJSNBZXR.js +0 -142
- package/chunk-FPBJM2BW.js +0 -689
- package/chunk-JQZRSXS5.js +0 -90
- package/chunk-P2ZLUIW2.js +0 -795
- package/chunk-PPJYZRSQ.js +0 -160
- package/chunk-TUSTONB3.js +0 -81
- package/chunk-ZXF6D3I6.js +0 -359
- package/cliLocalAgentRecordReader-H3HYQRRR.js +0 -91
- package/lib-OT5OTXRU.js +0 -21046
- package/localRuntimeAuthority-IBJAT62G.js +0 -16
- package/machineWsRunDispatch-L6H7J66T.js +0 -192
- package/{chunk-W6RFEDN4.js → chunk-AETZ7AD6.js} +3 -3
|
@@ -1,28 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getLocalProviderSecret
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KZ4A7EIV.js";
|
|
4
4
|
import {
|
|
5
5
|
performServerProxyFetchWithRetry
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QONAOHVW.js";
|
|
7
7
|
import {
|
|
8
8
|
fetchServerSyncedCredential
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7PON4LBY.js";
|
|
10
|
+
import {
|
|
11
|
+
selectCurrentServer
|
|
12
|
+
} from "./chunk-BZMDWGQQ.js";
|
|
13
|
+
import {
|
|
14
|
+
resolveUserAuthorityServer
|
|
15
|
+
} from "./chunk-HPDLPEUG.js";
|
|
16
|
+
import {
|
|
17
|
+
googleSessionRequestToken,
|
|
18
|
+
googleSessionServer,
|
|
19
|
+
isGoogleAuthoritySession
|
|
20
|
+
} from "./chunk-HDKMVYNJ.js";
|
|
21
|
+
import {
|
|
22
|
+
getSessionSnapshotForState
|
|
23
|
+
} from "./chunk-PXYBUFDB.js";
|
|
10
24
|
import {
|
|
11
|
-
CREDENTIAL_HYGIENE_RULE,
|
|
12
|
-
DELETE_SAFETY_RED_LINE,
|
|
13
|
-
DISPATCH_BACKEND_POLICY,
|
|
14
|
-
DISPATCH_CANDIDATE_POLICY,
|
|
15
|
-
PARALLEL_DISPATCH_DEFAULT_RULE,
|
|
16
|
-
PLATFORM_RISK_CONTROL_RULE,
|
|
17
|
-
VERIFY_BEFORE_CONCLUDING_RULE,
|
|
18
|
-
buildConsultationModeBlock,
|
|
19
25
|
buildIdentityBlock,
|
|
26
|
+
buildPlatformStaticContextLayers,
|
|
20
27
|
buildResponseGuidelines,
|
|
21
28
|
buildRuntimeGuidanceBlocks,
|
|
22
29
|
compileContextLayers,
|
|
23
30
|
detectDispatchIntentFromMessages,
|
|
24
31
|
resolveToolGuidedSections
|
|
25
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-TYJCIA2O.js";
|
|
26
33
|
import {
|
|
27
34
|
convertMessagesToResponsesInput,
|
|
28
35
|
getUsageRequestOptions,
|
|
@@ -31,35 +38,46 @@ import {
|
|
|
31
38
|
resolveReasoningReplayOptions,
|
|
32
39
|
shouldStripReasoningContentForOutbound,
|
|
33
40
|
stablePromptCacheKey
|
|
34
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-FXEPZKNJ.js";
|
|
35
42
|
import {
|
|
36
43
|
resolveAgentCallPlan,
|
|
37
44
|
resolveClientWire
|
|
38
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-DNNPARJK.js";
|
|
46
|
+
import {
|
|
47
|
+
isGpt62DeveloperPrefixModel,
|
|
48
|
+
usesCodexDeveloperPrefix
|
|
49
|
+
} from "./chunk-7WHCIA5V.js";
|
|
39
50
|
import {
|
|
40
51
|
createFileCredentialBroker
|
|
41
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-E6A5NHDH.js";
|
|
53
|
+
import {
|
|
54
|
+
MEMORY_USE_GUIDANCE,
|
|
55
|
+
buildUserResponseLanguageContext
|
|
56
|
+
} from "./chunk-UAF5VQCE.js";
|
|
57
|
+
import {
|
|
58
|
+
wrapHistoricalSummaryWithReplayGuard
|
|
59
|
+
} from "./chunk-2SXN7LAY.js";
|
|
42
60
|
import {
|
|
43
|
-
WORKTREE_ISOLATION_PRELUDE,
|
|
44
61
|
buildSkillGuidancePromptBlock
|
|
45
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-WC3J5SL2.js";
|
|
46
63
|
import {
|
|
47
64
|
canonicalizeToolNames
|
|
48
|
-
} from "./chunk-
|
|
49
|
-
import {
|
|
50
|
-
MEMORY_USE_GUIDANCE,
|
|
51
|
-
buildUserResponseLanguageContext,
|
|
52
|
-
wrapHistoricalSummaryWithReplayGuard
|
|
53
|
-
} from "./chunk-JQZRSXS5.js";
|
|
65
|
+
} from "./chunk-YLAHYLDQ.js";
|
|
54
66
|
import {
|
|
55
|
-
API_ENDPOINTS
|
|
67
|
+
API_ENDPOINTS,
|
|
68
|
+
normalizeKnownServerOrigin
|
|
56
69
|
} from "./chunk-LCBAMY2M.js";
|
|
57
|
-
import {
|
|
58
|
-
buildProviderAuthHeaders
|
|
59
|
-
} from "./chunk-RTHFJZ6M.js";
|
|
60
70
|
import {
|
|
61
71
|
toErrorMessage
|
|
62
72
|
} from "./chunk-HNMXYYJR.js";
|
|
73
|
+
import {
|
|
74
|
+
buildProviderAuthHeaders,
|
|
75
|
+
isAgentCredentialShared,
|
|
76
|
+
resolveOutboundProxyApiKey
|
|
77
|
+
} from "./chunk-LVZVSLKO.js";
|
|
78
|
+
import {
|
|
79
|
+
OPENAI_RESPONSES_ENDPOINT
|
|
80
|
+
} from "./chunk-2JHGUL5K.js";
|
|
63
81
|
import {
|
|
64
82
|
asTrimmedString
|
|
65
83
|
} from "./chunk-3EUW3WEO.js";
|
|
@@ -67,7 +85,7 @@ import {
|
|
|
67
85
|
clampReasoningEffort,
|
|
68
86
|
getModelConfig,
|
|
69
87
|
isModelSupportReasoningEffort
|
|
70
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-OKH74FML.js";
|
|
71
89
|
import {
|
|
72
90
|
isRecord
|
|
73
91
|
} from "./chunk-KUG52IAP.js";
|
|
@@ -75,14 +93,19 @@ import {
|
|
|
75
93
|
asOptionalTrimmedString
|
|
76
94
|
} from "./chunk-G3SUCT4W.js";
|
|
77
95
|
import {
|
|
96
|
+
isLoopbackHostname,
|
|
78
97
|
isLoopbackUrl
|
|
79
98
|
} from "./chunk-4SN6J65J.js";
|
|
80
99
|
import {
|
|
81
100
|
isDeepInfraKimiModel,
|
|
82
101
|
isFireworksKimiModel,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
102
|
+
resolveFireworksKimiModel,
|
|
103
|
+
resolvePlatformHostedRouting,
|
|
104
|
+
usesMimoThinkingWire
|
|
105
|
+
} from "./chunk-JPXACKSW.js";
|
|
106
|
+
import {
|
|
107
|
+
asTrimmedLowercaseString
|
|
108
|
+
} from "./chunk-QSJ3HFEF.js";
|
|
86
109
|
|
|
87
110
|
// packages/agent-runtime/responsesConversationState.ts
|
|
88
111
|
function supportsResponsesConversationState(agent) {
|
|
@@ -239,7 +262,12 @@ ${mainPrompt}` : "";
|
|
|
239
262
|
const agentTools = canonicalizeToolNames(agentConfig.tools ?? []);
|
|
240
263
|
const hasAskTool = agentTools.includes("ask_user");
|
|
241
264
|
const toolSections = resolveToolGuidedSections(agentTools, {
|
|
242
|
-
dispatchIntent: options.dispatchIntent === true
|
|
265
|
+
dispatchIntent: options.dispatchIntent === true,
|
|
266
|
+
// 安全透传:两者缺省均为 undefined,resolveToolGuidedSections 不追加任何文本,
|
|
267
|
+
// 因此未接线调用方拿到的 prompt 与既往逐字相同。
|
|
268
|
+
callerModel: options.callerModel,
|
|
269
|
+
callerIsPoolTop: options.callerIsPoolTop,
|
|
270
|
+
externalAgentCount: options.externalAgentCount
|
|
243
271
|
});
|
|
244
272
|
const {
|
|
245
273
|
startupProtocol,
|
|
@@ -247,8 +275,7 @@ ${mainPrompt}` : "";
|
|
|
247
275
|
emailRegistrationWorkflow
|
|
248
276
|
} = buildRuntimeGuidanceBlocks(agentTools);
|
|
249
277
|
const clarifyingSection = !mainPrompt || hasAskTool ? CLARIFICATION_MODE_INSTRUCTIONS : "";
|
|
250
|
-
const userGlobalPromptSection =
|
|
251
|
-
${contexts.userGlobalPrompt.trim()} ` : "";
|
|
278
|
+
const userGlobalPromptSection = "";
|
|
252
279
|
const effectiveViewport = viewport ?? contexts.viewport;
|
|
253
280
|
const isMobile = effectiveViewport !== void 0 ? effectiveViewport.width < mobileBreakpoint : typeof contexts.isMobile === "boolean" ? contexts.isMobile : isBrowser && typeof window !== "undefined" ? window.innerWidth < mobileBreakpoint : false;
|
|
254
281
|
const responseGuidelinesSection = buildResponseGuidelines(isMobile);
|
|
@@ -267,65 +294,8 @@ ${contexts.userGlobalPrompt.trim()} ` : "";
|
|
|
267
294
|
const dialogSummarySection = contexts.dialogSummary?.trim() ? `--- \u5386\u53F2\u5BF9\u8BDD\u6458\u8981 ---
|
|
268
295
|
${wrapHistoricalSummaryWithReplayGuard(contexts.dialogSummary)}` : "";
|
|
269
296
|
return compileContextLayers([
|
|
270
|
-
//
|
|
271
|
-
|
|
272
|
-
{
|
|
273
|
-
id: "delete-safety-red-line",
|
|
274
|
-
owner: "platform",
|
|
275
|
-
cacheScope: "static",
|
|
276
|
-
content: DELETE_SAFETY_RED_LINE
|
|
277
|
-
},
|
|
278
|
-
// 凭据纪律:与红线同为无条件系统层块,四条装配线同源。
|
|
279
|
-
{
|
|
280
|
-
id: "credential-hygiene",
|
|
281
|
-
owner: "platform",
|
|
282
|
-
cacheScope: "static",
|
|
283
|
-
content: CREDENTIAL_HYGIENE_RULE
|
|
284
|
-
},
|
|
285
|
-
// 先验证再下结论:一切动作的前提,紧随凭据纪律、先于并行/派发/发布规则。
|
|
286
|
-
{
|
|
287
|
-
id: "verify-before-concluding",
|
|
288
|
-
owner: "platform",
|
|
289
|
-
cacheScope: "static",
|
|
290
|
-
content: VERIFY_BEFORE_CONCLUDING_RULE
|
|
291
|
-
},
|
|
292
|
-
// 并行是默认:系统层固定块,紧随红线(同为无条件前缀,不随工具/轮次变化)。
|
|
293
|
-
{
|
|
294
|
-
id: "parallel-dispatch-default",
|
|
295
|
-
owner: "platform",
|
|
296
|
-
cacheScope: "static",
|
|
297
|
-
content: PARALLEL_DISPATCH_DEFAULT_RULE
|
|
298
|
-
},
|
|
299
|
-
// 派发落点:并行派发纪律的下一层(派到哪个执行后端),紧随并行块。
|
|
300
|
-
{
|
|
301
|
-
id: "dispatch-backend-policy",
|
|
302
|
-
owner: "platform",
|
|
303
|
-
cacheScope: "static",
|
|
304
|
-
content: DISPATCH_BACKEND_POLICY
|
|
305
|
-
},
|
|
306
|
-
// 派发选人:可用性重扫与速度口径(与后端块同级,紧随其后)。
|
|
307
|
-
{
|
|
308
|
-
id: "dispatch-candidate-policy",
|
|
309
|
-
owner: "platform",
|
|
310
|
-
cacheScope: "static",
|
|
311
|
-
content: DISPATCH_CANDIDATE_POLICY
|
|
312
|
-
},
|
|
313
|
-
// 平台风控纪律:无条件静态前缀,紧随并行派发块。
|
|
314
|
-
{
|
|
315
|
-
id: "platform-risk-control",
|
|
316
|
-
owner: "platform",
|
|
317
|
-
cacheScope: "static",
|
|
318
|
-
content: PLATFORM_RISK_CONTROL_RULE
|
|
319
|
-
},
|
|
320
|
-
{ id: "consultation-mode", owner: "platform", cacheScope: "static", content: buildConsultationModeBlock() },
|
|
321
|
-
// Git 任务隔离:仓库改动前置,系统层固定块(原 worktree-isolation skill 上移,
|
|
322
|
-
// 不受 skill 配置 disabled 影响)。排在既有平台块之后,不扰动其顺序契约。
|
|
323
|
-
{
|
|
324
|
-
id: "worktree-isolation-prelude",
|
|
325
|
-
owner: "platform",
|
|
326
|
-
cacheScope: "static",
|
|
327
|
-
content: WORKTREE_ISOLATION_PRELUDE
|
|
328
|
-
},
|
|
297
|
+
// 顶部固定平台层(唯一真源见 agent-runtime/platformStaticPromptLayers.ts)。
|
|
298
|
+
...buildPlatformStaticContextLayers(),
|
|
329
299
|
{ id: "identity", owner: "platform", cacheScope: "session", content: identitySection },
|
|
330
300
|
{ id: "user-response-language", owner: "platform", cacheScope: "session", content: buildUserResponseLanguageContext({ language: safeLanguage }) },
|
|
331
301
|
{ id: "startup-protocol", owner: "platform", cacheScope: "static", content: startupProtocol },
|
|
@@ -336,6 +306,7 @@ ${wrapHistoricalSummaryWithReplayGuard(contexts.dialogSummary)}` : "";
|
|
|
336
306
|
{ id: "agent-orchestration", owner: "platform", cacheScope: "session", content: toolSections.agentOrchestration },
|
|
337
307
|
{ id: "agent-collaboration", owner: "platform", cacheScope: "session", content: toolSections.agentCollaboration },
|
|
338
308
|
{ id: "web-access", owner: "platform", cacheScope: "session", content: toolSections.webAccess },
|
|
309
|
+
{ id: "platform-risk-control", owner: "platform", cacheScope: "session", content: toolSections.platformRiskControl },
|
|
339
310
|
{ id: "menu-usage", owner: "platform", cacheScope: "session", content: toolSections.menuUsage },
|
|
340
311
|
{ id: "show-interaction", owner: "platform", cacheScope: "session", content: toolSections.showInteraction },
|
|
341
312
|
{ id: "clarification-mode", owner: "platform", cacheScope: "session", content: clarifyingSection },
|
|
@@ -384,12 +355,18 @@ var applyClaudeCache = (stableContent, dynamicContent) => {
|
|
|
384
355
|
}
|
|
385
356
|
return parts.length > 0 ? parts : stableContent;
|
|
386
357
|
};
|
|
387
|
-
var prependPromptMessage = (messages, agentConfig, resolvedModel, language, contexts, prependSystemPrompt = true) => {
|
|
358
|
+
var prependPromptMessage = (messages, agentConfig, resolvedModel, language, contexts, prependSystemPrompt = true, preservePromptBoundary = false, preservePromptProvenance = preservePromptBoundary) => {
|
|
388
359
|
if (!prependSystemPrompt) return messages;
|
|
389
360
|
if (!contexts && !agentConfig.prompt) return messages;
|
|
390
361
|
const dispatchIntent = detectDispatchIntentFromMessages(messages);
|
|
391
362
|
if (isClaudeModel(resolvedModel)) {
|
|
392
|
-
const compiled = buildSystemPromptContext({
|
|
363
|
+
const compiled = buildSystemPromptContext({
|
|
364
|
+
agentConfig,
|
|
365
|
+
language,
|
|
366
|
+
contexts,
|
|
367
|
+
dispatchIntent,
|
|
368
|
+
callerModel: agentConfig?.model
|
|
369
|
+
});
|
|
393
370
|
if (!compiled.content.trim()) return messages;
|
|
394
371
|
const content = applyClaudeCache(
|
|
395
372
|
compiled.stablePrefixContent,
|
|
@@ -398,25 +375,35 @@ var prependPromptMessage = (messages, agentConfig, resolvedModel, language, cont
|
|
|
398
375
|
const systemMessage2 = { role: "system", content };
|
|
399
376
|
return [systemMessage2, ...messages];
|
|
400
377
|
}
|
|
401
|
-
const
|
|
378
|
+
const promptProvenance = preservePromptProvenance && agentConfig.prompt?.trim() ? { agent_prompt_in_messages: true } : {};
|
|
379
|
+
if (preservePromptBoundary) {
|
|
380
|
+
const compiled = buildSystemPromptContext({
|
|
381
|
+
agentConfig,
|
|
382
|
+
language,
|
|
383
|
+
contexts,
|
|
384
|
+
dispatchIntent,
|
|
385
|
+
callerModel: agentConfig?.model
|
|
386
|
+
});
|
|
387
|
+
if (!compiled.content.trim()) return messages;
|
|
388
|
+
return [{
|
|
389
|
+
role: "system",
|
|
390
|
+
content: compiled.content,
|
|
391
|
+
stable_prefix_chars: compiled.stablePrefixContent.length,
|
|
392
|
+
...promptProvenance
|
|
393
|
+
}, ...messages];
|
|
394
|
+
}
|
|
395
|
+
const promptContent = buildSystemPrompt({ agentConfig, language, contexts, dispatchIntent, callerModel: agentConfig?.model });
|
|
402
396
|
if (!promptContent.trim()) return messages;
|
|
403
|
-
const systemMessage = { role: "system", content: promptContent };
|
|
397
|
+
const systemMessage = { role: "system", content: promptContent, ...promptProvenance };
|
|
404
398
|
return [systemMessage, ...messages];
|
|
405
399
|
};
|
|
406
|
-
var
|
|
407
|
-
if (
|
|
408
|
-
|
|
409
|
-
return
|
|
410
|
-
};
|
|
411
|
-
var shouldDisableMiMoThinking = (agentConfig, resolvedModel) => {
|
|
412
|
-
if (agentConfig.enableThinking === true) return false;
|
|
413
|
-
if (/xiaomimimo\.com/i.test(agentConfig.customProviderUrl ?? "") || (agentConfig.provider ?? "").toLowerCase() === "mimo") {
|
|
414
|
-
return true;
|
|
415
|
-
}
|
|
416
|
-
return isPlatformMimoProviderModel(agentConfig.provider, resolvedModel);
|
|
400
|
+
var resolveLlamaCppThinkingToggle = (agentConfig) => {
|
|
401
|
+
if (!isLoopbackUrl(agentConfig.customProviderUrl) || !/qwen/i.test(agentConfig.model ?? "")) return void 0;
|
|
402
|
+
const effort = agentConfig.reasoning_effort?.toLowerCase();
|
|
403
|
+
return effort ? effort !== "none" && effort !== "off" : agentConfig.enableThinking ?? void 0;
|
|
417
404
|
};
|
|
418
405
|
var shouldDisableKimiThinking = (agentConfig, providerName, resolvedModel) => {
|
|
419
|
-
if (agentConfig.enableThinking !== false) return false;
|
|
406
|
+
if (agentConfig.reasoning_effort || agentConfig.enableThinking !== false) return false;
|
|
420
407
|
if (providerName === "deepinfra") return isDeepInfraKimiModel(resolvedModel);
|
|
421
408
|
if (providerName === "fireworks") return isFireworksKimiModel(resolvedModel);
|
|
422
409
|
return false;
|
|
@@ -453,6 +440,8 @@ var buildRequestBody = (options) => {
|
|
|
453
440
|
const {
|
|
454
441
|
model,
|
|
455
442
|
messages,
|
|
443
|
+
preservePromptBoundary,
|
|
444
|
+
preservePromptProvenance,
|
|
456
445
|
providerName,
|
|
457
446
|
customProviderUrl,
|
|
458
447
|
temperature,
|
|
@@ -463,13 +452,22 @@ var buildRequestBody = (options) => {
|
|
|
463
452
|
reasoning_effort,
|
|
464
453
|
shapingCounts
|
|
465
454
|
} = options;
|
|
466
|
-
const cleanedMessages = messages.map(
|
|
467
|
-
|
|
455
|
+
const cleanedMessages = messages.map((message) => {
|
|
456
|
+
const sanitized = sanitizeChatCompletionsMessage(message, {
|
|
468
457
|
provider: providerName,
|
|
469
458
|
model,
|
|
470
459
|
...shapingCounts ? { shapingCounts } : {}
|
|
471
|
-
})
|
|
472
|
-
|
|
460
|
+
});
|
|
461
|
+
if (message.role === "system") {
|
|
462
|
+
if (preservePromptBoundary && message.stable_prefix_chars !== void 0) {
|
|
463
|
+
sanitized.stable_prefix_chars = message.stable_prefix_chars;
|
|
464
|
+
}
|
|
465
|
+
if (preservePromptProvenance && message.agent_prompt_in_messages === true) {
|
|
466
|
+
sanitized.agent_prompt_in_messages = true;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return sanitized;
|
|
470
|
+
});
|
|
473
471
|
const bodyData = {
|
|
474
472
|
model,
|
|
475
473
|
messages: cleanedMessages,
|
|
@@ -500,7 +498,7 @@ var buildRequestBody = (options) => {
|
|
|
500
498
|
if (typeof max_tokens === "number") bodyData.max_tokens = max_tokens;
|
|
501
499
|
return bodyData;
|
|
502
500
|
};
|
|
503
|
-
var generateOpenAIRequestBody = (agentConfig, providerName, messages, contexts, stableMessages = [], prependSystemPrompt = true, shapingCounts) => {
|
|
501
|
+
var generateOpenAIRequestBody = (agentConfig, providerName, messages, contexts, stableMessages = [], prependSystemPrompt = true, shapingCounts, preservePromptBoundary = false, preservePromptProvenance = preservePromptBoundary) => {
|
|
504
502
|
const resolvedModel = providerName === "fireworks" ? resolveFireworksKimiModel(agentConfig.model) : agentConfig.model ?? "";
|
|
505
503
|
let processedStable = [...stableMessages];
|
|
506
504
|
if (isClaudeModel(resolvedModel) && processedStable.length > 0) {
|
|
@@ -532,11 +530,15 @@ var generateOpenAIRequestBody = (agentConfig, providerName, messages, contexts,
|
|
|
532
530
|
resolvedModel,
|
|
533
531
|
typeof navigator !== "undefined" ? navigator.language : "en",
|
|
534
532
|
contexts,
|
|
535
|
-
prependSystemPrompt
|
|
533
|
+
prependSystemPrompt,
|
|
534
|
+
preservePromptBoundary,
|
|
535
|
+
preservePromptProvenance
|
|
536
536
|
);
|
|
537
537
|
const requestBody = buildRequestBody({
|
|
538
538
|
model: resolvedModel,
|
|
539
539
|
messages: messagesWithPrompt,
|
|
540
|
+
preservePromptBoundary,
|
|
541
|
+
preservePromptProvenance,
|
|
540
542
|
providerName,
|
|
541
543
|
customProviderUrl: agentConfig.customProviderUrl,
|
|
542
544
|
temperature: agentConfig.temperature,
|
|
@@ -547,18 +549,28 @@ var generateOpenAIRequestBody = (agentConfig, providerName, messages, contexts,
|
|
|
547
549
|
reasoning_effort: agentConfig.reasoning_effort,
|
|
548
550
|
...shapingCounts ? { shapingCounts } : {}
|
|
549
551
|
});
|
|
550
|
-
|
|
552
|
+
const llamaCppThinking = resolveLlamaCppThinkingToggle(agentConfig);
|
|
553
|
+
if (llamaCppThinking !== void 0) {
|
|
554
|
+
delete requestBody.reasoning_effort;
|
|
551
555
|
requestBody.chat_template_kwargs = {
|
|
552
556
|
...requestBody.chat_template_kwargs ?? {},
|
|
553
|
-
enable_thinking:
|
|
557
|
+
enable_thinking: llamaCppThinking
|
|
554
558
|
};
|
|
555
559
|
}
|
|
556
|
-
if (
|
|
557
|
-
|
|
560
|
+
if (usesMimoThinkingWire(agentConfig.provider, resolvedModel, agentConfig.customProviderUrl)) {
|
|
561
|
+
const effort = agentConfig.reasoning_effort;
|
|
562
|
+
if (effort === "none" || effort === "off") {
|
|
563
|
+
requestBody.thinking = { type: "disabled" };
|
|
564
|
+
} else if (effort) {
|
|
565
|
+
const depth = clampReasoningEffort(effort, "mimo", resolvedModel);
|
|
566
|
+
if (depth) requestBody.reasoning_effort = depth;
|
|
567
|
+
} else if (agentConfig.enableThinking !== true) {
|
|
568
|
+
requestBody.thinking = { type: "disabled" };
|
|
569
|
+
}
|
|
558
570
|
}
|
|
559
571
|
if (shouldDisableKimiThinking(agentConfig, providerName, resolvedModel)) {
|
|
560
572
|
requestBody.thinking = { type: "disabled" };
|
|
561
|
-
requestBody.reasoning_effort = "none";
|
|
573
|
+
if (providerName !== "deepinfra") requestBody.reasoning_effort = "none";
|
|
562
574
|
requestBody.reasoning = { enabled: false };
|
|
563
575
|
}
|
|
564
576
|
return normalizeChatCompletionsBodyForProvider({
|
|
@@ -571,6 +583,21 @@ var generateOpenAIRequestBody = (agentConfig, providerName, messages, contexts,
|
|
|
571
583
|
|
|
572
584
|
// packages/integrations/openai/generateResponseRequestBody.ts
|
|
573
585
|
var DEFAULT_RESPONSES_COMPACTION_THRESHOLD = 2e5;
|
|
586
|
+
function usesGpt62DeveloperPrefix(agentConfig) {
|
|
587
|
+
const provider = asTrimmedLowercaseString(agentConfig.provider);
|
|
588
|
+
if (agentConfig.customProviderUrl || agentConfig.apiSource === "custom") return false;
|
|
589
|
+
let model = asTrimmedLowercaseString(agentConfig.model).replace(/^openai\//, "");
|
|
590
|
+
if (provider === "nolo") {
|
|
591
|
+
const route = resolvePlatformHostedRouting(agentConfig.model);
|
|
592
|
+
if (route?.wire !== "responses" || route.endpoint !== OPENAI_RESPONSES_ENDPOINT) {
|
|
593
|
+
return false;
|
|
594
|
+
}
|
|
595
|
+
model = route.upstreamModelId ?? model;
|
|
596
|
+
} else if (provider !== "openai") {
|
|
597
|
+
return false;
|
|
598
|
+
}
|
|
599
|
+
return isGpt62DeveloperPrefixModel(model);
|
|
600
|
+
}
|
|
574
601
|
function resolveResponsesCompactionThreshold(agentConfig) {
|
|
575
602
|
const configured = Number(
|
|
576
603
|
agentConfig.responsesCompactionThreshold ?? agentConfig.responses_compaction_threshold
|
|
@@ -590,7 +617,10 @@ function selectResponsesContinuationMessages(msgs) {
|
|
|
590
617
|
}
|
|
591
618
|
function generateResponseRequestBody(agentConfig, msgs, contexts, prependSystemPrompt = true, responsesState) {
|
|
592
619
|
const language = typeof navigator !== "undefined" && navigator.language ? navigator.language : "zh-CN";
|
|
593
|
-
const state =
|
|
620
|
+
const state = selectResponsesConversationState(
|
|
621
|
+
responsesState === void 0 ? agentConfig.responsesState : responsesState,
|
|
622
|
+
agentConfig
|
|
623
|
+
);
|
|
594
624
|
const supportsServerState = supportsResponsesConversationState(agentConfig);
|
|
595
625
|
const stateful = supportsServerState && state && agentConfig.store !== false ? state : null;
|
|
596
626
|
const input = convertMessagesToResponsesInput(
|
|
@@ -603,14 +633,27 @@ function generateResponseRequestBody(agentConfig, msgs, contexts, prependSystemP
|
|
|
603
633
|
...getUsageRequestOptions(agentConfig.provider, { api: "responses" })
|
|
604
634
|
};
|
|
605
635
|
if (prependSystemPrompt) {
|
|
606
|
-
const
|
|
636
|
+
const compiled = buildSystemPromptContext({
|
|
607
637
|
agentConfig,
|
|
608
638
|
language,
|
|
609
639
|
contexts,
|
|
610
640
|
// 按当前用户输入检测派发意图:无意图只注入最小派发协议(安全硬门常在)。
|
|
611
|
-
dispatchIntent: detectDispatchIntentFromMessages(msgs)
|
|
641
|
+
dispatchIntent: detectDispatchIntentFromMessages(msgs),
|
|
642
|
+
callerModel: agentConfig?.model
|
|
612
643
|
});
|
|
613
|
-
|
|
644
|
+
const legacyContinuation = supportsServerState && responsesState === void 0 && agentConfig.previous_response_id !== void 0;
|
|
645
|
+
if (!stateful && !legacyContinuation && usesGpt62DeveloperPrefix(agentConfig)) {
|
|
646
|
+
if (compiled.stablePrefixContent) {
|
|
647
|
+
input.unshift({
|
|
648
|
+
type: "message",
|
|
649
|
+
role: "developer",
|
|
650
|
+
content: [{ type: "input_text", text: compiled.stablePrefixContent }]
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
if (compiled.dynamicContent) body.instructions = compiled.dynamicContent;
|
|
654
|
+
} else {
|
|
655
|
+
body.instructions = compiled.content;
|
|
656
|
+
}
|
|
614
657
|
}
|
|
615
658
|
if (agentConfig.temperature !== void 0) {
|
|
616
659
|
body.temperature = agentConfig.temperature;
|
|
@@ -779,9 +822,8 @@ var generateRequestBody = ({
|
|
|
779
822
|
agentConfig,
|
|
780
823
|
imageSettings.shouldEnableImage
|
|
781
824
|
);
|
|
782
|
-
const
|
|
783
|
-
|
|
784
|
-
);
|
|
825
|
+
const plan = resolveAgentCallPlan(agentConfigForRequest, {});
|
|
826
|
+
const clientWire = resolveClientWire(plan);
|
|
785
827
|
if (clientWire === "responses") {
|
|
786
828
|
const body = generateResponseRequestBody(
|
|
787
829
|
agentConfigForRequest,
|
|
@@ -802,13 +844,17 @@ var generateRequestBody = ({
|
|
|
802
844
|
);
|
|
803
845
|
return body;
|
|
804
846
|
}
|
|
847
|
+
const codexOAuth = plan.authMethod.kind === "oauth" && plan.authMethod.ref === "chatgpt";
|
|
805
848
|
const baseBody = generateOpenAIRequestBody(
|
|
806
849
|
agentConfigForRequest,
|
|
807
850
|
provider,
|
|
808
851
|
messages,
|
|
809
852
|
contexts,
|
|
810
853
|
stableMessages,
|
|
811
|
-
prependSystemPrompt
|
|
854
|
+
prependSystemPrompt,
|
|
855
|
+
void 0,
|
|
856
|
+
codexOAuth && usesCodexDeveloperPrefix(agentConfigForRequest, agentConfigForRequest.model),
|
|
857
|
+
codexOAuth
|
|
812
858
|
);
|
|
813
859
|
return applyImageConfigIfNeeded(baseBody, agentConfigForRequest, provider);
|
|
814
860
|
};
|
|
@@ -848,11 +894,11 @@ async function resolveDirectRequestApiKey(agentConfig, options) {
|
|
|
848
894
|
const broker = factory();
|
|
849
895
|
const local = await safeBrokerGet(broker, credentialRef);
|
|
850
896
|
if (local) return local;
|
|
851
|
-
if (credentialRef.startsWith("provider-key:") && options?.providerSecretFetcher) {
|
|
897
|
+
if (isAgentCredentialShared(agentConfig) && credentialRef.startsWith("provider-key:") && options?.providerSecretFetcher) {
|
|
852
898
|
const providerSecret = await options.providerSecretFetcher(credentialRef);
|
|
853
899
|
if (providerSecret) return providerSecret;
|
|
854
900
|
}
|
|
855
|
-
if (agentConfig
|
|
901
|
+
if (isAgentCredentialShared(agentConfig) && options?.syncFetcher) {
|
|
856
902
|
const synced = await options.syncFetcher(credentialRef);
|
|
857
903
|
const trimmed = asTrimmedString(synced);
|
|
858
904
|
if (trimmed) {
|
|
@@ -873,11 +919,11 @@ async function safeBrokerGet(broker, ref) {
|
|
|
873
919
|
}
|
|
874
920
|
}
|
|
875
921
|
|
|
876
|
-
// packages/ai/chat/
|
|
922
|
+
// packages/ai/chat/buildProxyPayload.ts
|
|
877
923
|
var buildProxyPayload = (bodyData, api, agentConfig, dialogId) => {
|
|
878
924
|
const apiSource = agentConfig.apiSource === "custom" || agentConfig.apiSource === "cli" ? agentConfig.apiSource : void 0;
|
|
879
925
|
const provider = bodyData.provider || agentConfig.provider || (apiSource === "custom" ? "custom" : void 0);
|
|
880
|
-
const apiKey =
|
|
926
|
+
const apiKey = resolveOutboundProxyApiKey(agentConfig);
|
|
881
927
|
return {
|
|
882
928
|
...bodyData,
|
|
883
929
|
url: api,
|
|
@@ -889,12 +935,14 @@ var buildProxyPayload = (bodyData, api, agentConfig, dialogId) => {
|
|
|
889
935
|
KEY: apiKey
|
|
890
936
|
};
|
|
891
937
|
};
|
|
938
|
+
|
|
939
|
+
// packages/ai/chat/fetchUtils.ts
|
|
892
940
|
var fetchDirectly = async (params) => {
|
|
893
941
|
const { api, agentConfig, bodyData, signal, currentServer, token, dialogId } = params;
|
|
894
942
|
try {
|
|
895
943
|
const apiKey = await resolveDirectRequestApiKey(agentConfig, {
|
|
896
944
|
syncFetcher: currentServer && token ? (ref) => fetchServerSyncedCredential({ currentServer, authToken: token }, ref) : void 0,
|
|
897
|
-
providerSecretFetcher: currentServer && token ? async (ref) => {
|
|
945
|
+
providerSecretFetcher: isAgentCredentialShared(agentConfig) && currentServer && token ? async (ref) => {
|
|
898
946
|
const presetId = ref.startsWith("provider-key:") ? ref.slice("provider-key:".length) : ref;
|
|
899
947
|
const local = getLocalProviderSecret(presetId);
|
|
900
948
|
if (local) return local;
|
|
@@ -978,19 +1026,33 @@ var formatFriendlyNetworkErrorMessage = (error) => {
|
|
|
978
1026
|
return rawMessage;
|
|
979
1027
|
};
|
|
980
1028
|
var performFetchRequest = async (params) => {
|
|
1029
|
+
let direct = false;
|
|
981
1030
|
try {
|
|
982
|
-
const
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1031
|
+
const { agentConfig, bodyData } = params;
|
|
1032
|
+
const credentialRef = "credentialRef" in agentConfig && typeof agentConfig.credentialRef === "string" ? agentConfig.credentialRef : void 0;
|
|
1033
|
+
const plan = resolveAgentCallPlan({
|
|
1034
|
+
key: "",
|
|
1035
|
+
provider: bodyData.provider || agentConfig.provider,
|
|
1036
|
+
model: agentConfig.model,
|
|
1037
|
+
apiSource: agentConfig.apiSource,
|
|
1038
|
+
cliProvider: agentConfig.cliProvider ?? void 0,
|
|
1039
|
+
customProviderUrl: agentConfig.customProviderUrl,
|
|
1040
|
+
apiKey: agentConfig.apiKey ?? void 0,
|
|
1041
|
+
apiKeyRef: agentConfig.apiKeyRef,
|
|
1042
|
+
credentialRef,
|
|
1043
|
+
credentialSynced: agentConfig.credentialSynced,
|
|
1044
|
+
useServerProxy: agentConfig.useServerProxy
|
|
1045
|
+
}, void 0, { canResolveLocalCredential: true });
|
|
1046
|
+
direct = plan.transport === "direct";
|
|
1047
|
+
return direct ? await fetchDirectly(params) : await fetchWithServerProxy(params);
|
|
987
1048
|
} catch (error) {
|
|
988
1049
|
if (error instanceof DirectApiKeyResolutionError || error?.kind === "credential_missing") {
|
|
989
1050
|
throw error;
|
|
990
1051
|
}
|
|
991
1052
|
console.error("[performFetchRequest] \u8BF7\u6C42\u8FC7\u7A0B\u4E2D\u53D1\u751F\u9519\u8BEF:", error);
|
|
992
|
-
if (params.preserveStructuredError) throw error;
|
|
993
|
-
const
|
|
1053
|
+
if (params.preserveStructuredError || params.signal?.aborted || error?.name === "AbortError") throw error;
|
|
1054
|
+
const rawMessage = toErrorMessage(error);
|
|
1055
|
+
const friendlyMsg = direct && /failed to fetch|networkerror|network error|load failed/i.test(rawMessage) && !(typeof navigator !== "undefined" && navigator.onLine === false) ? "\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25\uFF1A\u6D4F\u89C8\u5668\u76F4\u8FDE\u670D\u52A1\u5546\u65F6\uFF0C\u53EF\u80FD\u88AB\u670D\u52A1\u5546\u7684\u8DE8\u57DF\u9650\u5236\uFF08CORS\uFF09\u62E6\u622A\u3002" : formatFriendlyNetworkErrorMessage(error);
|
|
994
1056
|
throw new Error(
|
|
995
1057
|
friendlyMsg.startsWith("\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25") ? friendlyMsg : `\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25: ${friendlyMsg}`
|
|
996
1058
|
);
|
|
@@ -1232,8 +1294,482 @@ function sanitizeOutboundBody(body) {
|
|
|
1232
1294
|
return next;
|
|
1233
1295
|
}
|
|
1234
1296
|
|
|
1297
|
+
// packages/core/redactUrlUserinfo.ts
|
|
1298
|
+
var REDACTED_USERINFO = "[REDACTED]@";
|
|
1299
|
+
var REDACTED = "[REDACTED]";
|
|
1300
|
+
var SPECIAL_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "ws", "wss", "ftp"]);
|
|
1301
|
+
var MAX_SCHEME_CHARS = 8;
|
|
1302
|
+
var isTabOrNewline = (char) => char === " " || char === "\n" || char === "\r";
|
|
1303
|
+
var isAsciiAlpha = (char) => char >= "a" && char <= "z" || char >= "A" && char <= "Z";
|
|
1304
|
+
var isSchemeChar = (char) => isAsciiAlpha(char) || char >= "0" && char <= "9" || char === "+" || char === "-" || char === ".";
|
|
1305
|
+
var isPrecededBySchemeWord = (text, idx) => {
|
|
1306
|
+
let index = idx - 1;
|
|
1307
|
+
if (index < 0 || !isSchemeChar(text[index])) return false;
|
|
1308
|
+
while (index > 0 && isSchemeChar(text[index - 1])) index -= 1;
|
|
1309
|
+
return isAsciiAlpha(text[index]);
|
|
1310
|
+
};
|
|
1311
|
+
var matchSpecialSchemeBeforeColon = (text, colonIdx) => {
|
|
1312
|
+
let chars = "";
|
|
1313
|
+
let index = colonIdx - 1;
|
|
1314
|
+
while (index >= 0 && chars.length < 5) {
|
|
1315
|
+
const char = text[index];
|
|
1316
|
+
if (isTabOrNewline(char)) {
|
|
1317
|
+
index -= 1;
|
|
1318
|
+
continue;
|
|
1319
|
+
}
|
|
1320
|
+
if (!isAsciiAlpha(char)) break;
|
|
1321
|
+
chars = char.toLowerCase() + chars;
|
|
1322
|
+
if (SPECIAL_SCHEMES.has(chars) && !isPrecededBySchemeWord(text, index)) return true;
|
|
1323
|
+
index -= 1;
|
|
1324
|
+
}
|
|
1325
|
+
return false;
|
|
1326
|
+
};
|
|
1327
|
+
var isFullSpecialSchemeBeforeColon = (text, colonIdx) => {
|
|
1328
|
+
let index = colonIdx - 1;
|
|
1329
|
+
let chars = "";
|
|
1330
|
+
while (index >= 0 && chars.length <= MAX_SCHEME_CHARS) {
|
|
1331
|
+
const char = text[index];
|
|
1332
|
+
if (isTabOrNewline(char)) {
|
|
1333
|
+
index -= 1;
|
|
1334
|
+
continue;
|
|
1335
|
+
}
|
|
1336
|
+
if (!isSchemeChar(char)) break;
|
|
1337
|
+
chars = char.toLowerCase() + chars;
|
|
1338
|
+
index -= 1;
|
|
1339
|
+
}
|
|
1340
|
+
if (chars.length > MAX_SCHEME_CHARS) return false;
|
|
1341
|
+
if (!isAsciiAlpha(chars[0] ?? "")) return false;
|
|
1342
|
+
return SPECIAL_SCHEMES.has(chars);
|
|
1343
|
+
};
|
|
1344
|
+
var hasValidSchemeBeforeColon = (text, colonIdx) => {
|
|
1345
|
+
let index = colonIdx - 1;
|
|
1346
|
+
let sawAlpha = false;
|
|
1347
|
+
while (index >= 0) {
|
|
1348
|
+
const char = text[index];
|
|
1349
|
+
if (isTabOrNewline(char)) {
|
|
1350
|
+
index -= 1;
|
|
1351
|
+
continue;
|
|
1352
|
+
}
|
|
1353
|
+
if (!isSchemeChar(char)) break;
|
|
1354
|
+
if (isAsciiAlpha(char)) sawAlpha = true;
|
|
1355
|
+
index -= 1;
|
|
1356
|
+
}
|
|
1357
|
+
return sawAlpha;
|
|
1358
|
+
};
|
|
1359
|
+
var matchDoubleSlashAfterColon = (text, colonIdx) => {
|
|
1360
|
+
let index = colonIdx + 1;
|
|
1361
|
+
let slashes = 0;
|
|
1362
|
+
while (index < text.length && slashes < 2) {
|
|
1363
|
+
const char = text[index];
|
|
1364
|
+
if (isTabOrNewline(char)) {
|
|
1365
|
+
index += 1;
|
|
1366
|
+
continue;
|
|
1367
|
+
}
|
|
1368
|
+
if (char === "/") {
|
|
1369
|
+
slashes += 1;
|
|
1370
|
+
index += 1;
|
|
1371
|
+
continue;
|
|
1372
|
+
}
|
|
1373
|
+
return -1;
|
|
1374
|
+
}
|
|
1375
|
+
return slashes === 2 ? index : -1;
|
|
1376
|
+
};
|
|
1377
|
+
var skipSpecialAuthorityPrefix = (text, colonIdx) => {
|
|
1378
|
+
let index = colonIdx + 1;
|
|
1379
|
+
while (index < text.length) {
|
|
1380
|
+
const char = text[index];
|
|
1381
|
+
if (char === "/" || char === "\\" || isTabOrNewline(char)) index += 1;
|
|
1382
|
+
else break;
|
|
1383
|
+
}
|
|
1384
|
+
return index;
|
|
1385
|
+
};
|
|
1386
|
+
var authorityCandidates = (text, colonIdx) => {
|
|
1387
|
+
const fullSchemeIsSpecial = isFullSpecialSchemeBeforeColon(text, colonIdx);
|
|
1388
|
+
if (!fullSchemeIsSpecial && !hasValidSchemeBeforeColon(text, colonIdx)) return [];
|
|
1389
|
+
const candidates = [];
|
|
1390
|
+
const afterSlashes = matchDoubleSlashAfterColon(text, colonIdx);
|
|
1391
|
+
if (!fullSchemeIsSpecial && afterSlashes !== -1) {
|
|
1392
|
+
candidates.push({ start: afterSlashes, isSpecial: false });
|
|
1393
|
+
}
|
|
1394
|
+
if (fullSchemeIsSpecial || matchSpecialSchemeBeforeColon(text, colonIdx)) {
|
|
1395
|
+
candidates.push({ start: skipSpecialAuthorityPrefix(text, colonIdx), isSpecial: true });
|
|
1396
|
+
}
|
|
1397
|
+
return candidates;
|
|
1398
|
+
};
|
|
1399
|
+
var findNextStop = (text, from, includeBackslash) => {
|
|
1400
|
+
for (let index = from; index < text.length; index += 1) {
|
|
1401
|
+
const char = text[index];
|
|
1402
|
+
if (char === "/" || char === "?" || char === "#" || includeBackslash && char === "\\") {
|
|
1403
|
+
return index;
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
return text.length;
|
|
1407
|
+
};
|
|
1408
|
+
var hasNonIgnoredChar = (text, start, end) => {
|
|
1409
|
+
for (let index = start; index < end; index += 1) {
|
|
1410
|
+
if (!isTabOrNewline(text[index])) return true;
|
|
1411
|
+
}
|
|
1412
|
+
return false;
|
|
1413
|
+
};
|
|
1414
|
+
function redactUrlUserinfo(text) {
|
|
1415
|
+
const lastAtInText = text.lastIndexOf("@");
|
|
1416
|
+
if (lastAtInText === -1 || !text.includes(":")) return text;
|
|
1417
|
+
let output = "";
|
|
1418
|
+
let cursor = 0;
|
|
1419
|
+
let scanFrom = 0;
|
|
1420
|
+
let nextAt = -1;
|
|
1421
|
+
let nextSpecialStop = -1;
|
|
1422
|
+
let nextNonSpecialStop = -1;
|
|
1423
|
+
while (scanFrom < lastAtInText) {
|
|
1424
|
+
const colonIdx = text.indexOf(":", scanFrom);
|
|
1425
|
+
if (colonIdx === -1 || colonIdx >= lastAtInText) break;
|
|
1426
|
+
scanFrom = colonIdx + 1;
|
|
1427
|
+
const candidates = authorityCandidates(text, colonIdx);
|
|
1428
|
+
if (candidates.length === 0) continue;
|
|
1429
|
+
let authorityStart = -1;
|
|
1430
|
+
let authorityEnd = -1;
|
|
1431
|
+
for (const candidate of candidates) {
|
|
1432
|
+
if (nextAt < candidate.start) {
|
|
1433
|
+
nextAt = text.indexOf("@", candidate.start);
|
|
1434
|
+
if (nextAt === -1) break;
|
|
1435
|
+
}
|
|
1436
|
+
const end = candidate.isSpecial ? nextSpecialStop < candidate.start ? nextSpecialStop = findNextStop(text, candidate.start, true) : nextSpecialStop : nextNonSpecialStop < candidate.start ? nextNonSpecialStop = findNextStop(text, candidate.start, false) : nextNonSpecialStop;
|
|
1437
|
+
if (nextAt >= end) continue;
|
|
1438
|
+
authorityStart = candidate.start;
|
|
1439
|
+
authorityEnd = end;
|
|
1440
|
+
break;
|
|
1441
|
+
}
|
|
1442
|
+
if (authorityStart === -1) {
|
|
1443
|
+
if (nextAt === -1) break;
|
|
1444
|
+
continue;
|
|
1445
|
+
}
|
|
1446
|
+
const lastAt = text.lastIndexOf("@", authorityEnd - 1);
|
|
1447
|
+
if (lastAt <= authorityStart) continue;
|
|
1448
|
+
if (!hasNonIgnoredChar(text, authorityStart, lastAt)) continue;
|
|
1449
|
+
if (text.slice(authorityStart, lastAt) === "[REDACTED]") {
|
|
1450
|
+
scanFrom = lastAt + 1;
|
|
1451
|
+
continue;
|
|
1452
|
+
}
|
|
1453
|
+
output += `${text.slice(cursor, authorityStart)}${REDACTED_USERINFO}`;
|
|
1454
|
+
cursor = lastAt + 1;
|
|
1455
|
+
scanFrom = cursor;
|
|
1456
|
+
}
|
|
1457
|
+
return cursor === 0 ? text : output + text.slice(cursor);
|
|
1458
|
+
}
|
|
1459
|
+
function redactUrlQueryAndFragment(text) {
|
|
1460
|
+
if (!text.includes(":") || !text.includes("?") && !text.includes("#")) return text;
|
|
1461
|
+
let output = "";
|
|
1462
|
+
let cursor = 0;
|
|
1463
|
+
let scanFrom = 0;
|
|
1464
|
+
while (scanFrom < text.length) {
|
|
1465
|
+
const colonIdx = text.indexOf(":", scanFrom);
|
|
1466
|
+
if (colonIdx === -1) break;
|
|
1467
|
+
scanFrom = colonIdx + 1;
|
|
1468
|
+
let urlStart = -1;
|
|
1469
|
+
for (const candidate of authorityCandidates(text, colonIdx)) {
|
|
1470
|
+
if (urlStart === -1 || candidate.start < urlStart) urlStart = candidate.start;
|
|
1471
|
+
}
|
|
1472
|
+
if (urlStart === -1 && hasValidSchemeBeforeColon(text, colonIdx)) urlStart = colonIdx + 1;
|
|
1473
|
+
if (urlStart === -1) continue;
|
|
1474
|
+
if (urlStart < cursor) continue;
|
|
1475
|
+
let marker = -1;
|
|
1476
|
+
for (let index = urlStart; index < text.length; index += 1) {
|
|
1477
|
+
const char = text[index];
|
|
1478
|
+
if (char === "?" || char === "#") {
|
|
1479
|
+
marker = index;
|
|
1480
|
+
break;
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
if (marker === -1) break;
|
|
1484
|
+
output += `${text.slice(cursor, marker)}${text[marker]}${REDACTED}`;
|
|
1485
|
+
cursor = text.length;
|
|
1486
|
+
scanFrom = text.length;
|
|
1487
|
+
}
|
|
1488
|
+
return cursor === 0 ? text : output + text.slice(cursor);
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
// packages/ai/agent/toolErrorReport.ts
|
|
1492
|
+
var TOOL_ERROR_REPORT_PATH = "/api/diagnostics/tool-errors";
|
|
1493
|
+
var REPORT_TIMEOUT_MS = 3e3;
|
|
1494
|
+
var MAX_INFLIGHT_REPORTS = 1;
|
|
1495
|
+
var MAX_DEDUPE_ENTRIES = 100;
|
|
1496
|
+
var MESSAGE_MAX_CHARS = 1e3;
|
|
1497
|
+
var STACK_MAX_CHARS = 4e3;
|
|
1498
|
+
var ERROR_CLASS_MAX_CHARS = 120;
|
|
1499
|
+
var IDENTIFIER_MAX_CHARS = 200;
|
|
1500
|
+
var TOOL_ERROR_REPORT_MAX_BODY_BYTES = 16 * 1024;
|
|
1501
|
+
var CONTROL_CHARS_PATTERN = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g;
|
|
1502
|
+
var REDACTED2 = "[REDACTED]";
|
|
1503
|
+
var TOOL_ERROR_REPORT_ALLOWED_FIELDS = [
|
|
1504
|
+
"dialogId",
|
|
1505
|
+
"callId",
|
|
1506
|
+
"toolName",
|
|
1507
|
+
"errorClass",
|
|
1508
|
+
"message",
|
|
1509
|
+
"stack",
|
|
1510
|
+
"clientVersion"
|
|
1511
|
+
];
|
|
1512
|
+
var dedupeKeys = /* @__PURE__ */ new Map();
|
|
1513
|
+
var inflightReports = 0;
|
|
1514
|
+
var sanitizedBoundedString = (value, maxChars) => {
|
|
1515
|
+
if (typeof value !== "string") return void 0;
|
|
1516
|
+
const cleaned = sanitizeToolErrorText(value).trim();
|
|
1517
|
+
if (!cleaned) return void 0;
|
|
1518
|
+
return cleaned.length > maxChars ? cleaned.slice(0, maxChars) : cleaned;
|
|
1519
|
+
};
|
|
1520
|
+
function sanitizeToolErrorText(input) {
|
|
1521
|
+
if (typeof input !== "string" || !input) return "";
|
|
1522
|
+
let text = input;
|
|
1523
|
+
text = text.replace(CONTROL_CHARS_PATTERN, "");
|
|
1524
|
+
text = redactUrlUserinfo(text);
|
|
1525
|
+
text = redactUrlQueryAndFragment(text);
|
|
1526
|
+
text = text.replace(
|
|
1527
|
+
/([?&](?:access[_-]?token|refresh[_-]?token|api[_-]?key|apikey|token|secret|password|sig|signature|key)=)[^&\s"'<>[\]]+/gi,
|
|
1528
|
+
(_match, prefix) => `${prefix}${REDACTED2}`
|
|
1529
|
+
);
|
|
1530
|
+
text = text.replace(
|
|
1531
|
+
/\b(bearer)\s+[A-Za-z0-9._~+/=-]{4,}/gi,
|
|
1532
|
+
(_match, scheme) => `${scheme} ${REDACTED2}`
|
|
1533
|
+
);
|
|
1534
|
+
text = text.replace(
|
|
1535
|
+
/\beyJ[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]{4,}\b/g,
|
|
1536
|
+
REDACTED2
|
|
1537
|
+
);
|
|
1538
|
+
text = text.replace(
|
|
1539
|
+
/((?:api[_-]?key|apikey|access[_-]?token|refresh[_-]?token|token|password|secret|authorization)["']?\s*[:=]\s*)("?)([^\s"',;}\][]+)/gi,
|
|
1540
|
+
(_match, prefix, quote) => `${prefix}${quote}${REDACTED2}`
|
|
1541
|
+
);
|
|
1542
|
+
text = text.replace(/\bsk-[A-Za-z0-9_-]{12,}/g, REDACTED2);
|
|
1543
|
+
return text;
|
|
1544
|
+
}
|
|
1545
|
+
var resolveErrorClass = (error) => {
|
|
1546
|
+
if (error && typeof error === "object") {
|
|
1547
|
+
const record = error;
|
|
1548
|
+
const name = sanitizedBoundedString(record.name, ERROR_CLASS_MAX_CHARS) ?? sanitizedBoundedString(record.constructor?.name, ERROR_CLASS_MAX_CHARS);
|
|
1549
|
+
if (name) return name;
|
|
1550
|
+
return "Error";
|
|
1551
|
+
}
|
|
1552
|
+
return "Error";
|
|
1553
|
+
};
|
|
1554
|
+
var resolveErrorMessage = (error, errorClass) => {
|
|
1555
|
+
const raw = error && typeof error === "object" ? error.message : error;
|
|
1556
|
+
const text = typeof raw === "string" ? raw : raw === void 0 || raw === null ? "" : String(raw);
|
|
1557
|
+
const sanitized = sanitizeToolErrorText(text).trim();
|
|
1558
|
+
const bounded = sanitized.length > MESSAGE_MAX_CHARS ? sanitized.slice(0, MESSAGE_MAX_CHARS) : sanitized;
|
|
1559
|
+
return bounded || errorClass;
|
|
1560
|
+
};
|
|
1561
|
+
var resolveStack = (error) => {
|
|
1562
|
+
if (!error || typeof error !== "object") return void 0;
|
|
1563
|
+
const stack = error.stack;
|
|
1564
|
+
if (typeof stack !== "string") return void 0;
|
|
1565
|
+
const sanitized = sanitizeToolErrorText(stack).trim();
|
|
1566
|
+
if (!sanitized) return void 0;
|
|
1567
|
+
return sanitized.length > STACK_MAX_CHARS ? sanitized.slice(0, STACK_MAX_CHARS) : sanitized;
|
|
1568
|
+
};
|
|
1569
|
+
function buildToolErrorReportPayload(input) {
|
|
1570
|
+
const dialogId = sanitizedBoundedString(input.dialogId, IDENTIFIER_MAX_CHARS);
|
|
1571
|
+
const callId = sanitizedBoundedString(input.callId, IDENTIFIER_MAX_CHARS);
|
|
1572
|
+
const toolName = sanitizedBoundedString(input.toolName, IDENTIFIER_MAX_CHARS);
|
|
1573
|
+
if (!dialogId || !callId || !toolName) return null;
|
|
1574
|
+
const errorClass = resolveErrorClass(input.error);
|
|
1575
|
+
const message = sanitizeToolErrorText(resolveErrorMessage(input.error, errorClass)) || errorClass;
|
|
1576
|
+
const stack = resolveStack(input.error);
|
|
1577
|
+
return {
|
|
1578
|
+
dialogId,
|
|
1579
|
+
callId,
|
|
1580
|
+
toolName,
|
|
1581
|
+
errorClass,
|
|
1582
|
+
message,
|
|
1583
|
+
...stack ? { stack } : {}
|
|
1584
|
+
};
|
|
1585
|
+
}
|
|
1586
|
+
var pickAllowedFields = (payload) => {
|
|
1587
|
+
const out = {};
|
|
1588
|
+
for (const field of TOOL_ERROR_REPORT_ALLOWED_FIELDS) {
|
|
1589
|
+
const value = payload[field];
|
|
1590
|
+
if (typeof value === "string" && value) out[field] = value;
|
|
1591
|
+
}
|
|
1592
|
+
return out;
|
|
1593
|
+
};
|
|
1594
|
+
var truncateToUtf8Bytes = (value, maxBytes) => {
|
|
1595
|
+
if (maxBytes <= 0) return "";
|
|
1596
|
+
const encoder = new TextEncoder();
|
|
1597
|
+
if (encoder.encode(value).length <= maxBytes) return value;
|
|
1598
|
+
let used = 0;
|
|
1599
|
+
let out = "";
|
|
1600
|
+
for (const char of value) {
|
|
1601
|
+
const size = encoder.encode(char).length;
|
|
1602
|
+
if (used + size > maxBytes) break;
|
|
1603
|
+
used += size;
|
|
1604
|
+
out += char;
|
|
1605
|
+
}
|
|
1606
|
+
return out;
|
|
1607
|
+
};
|
|
1608
|
+
var utf8ByteLength = (value) => new TextEncoder().encode(value).length;
|
|
1609
|
+
var buildBoundedBody = (fields) => {
|
|
1610
|
+
const withoutStack = { ...fields };
|
|
1611
|
+
delete withoutStack.stack;
|
|
1612
|
+
const attempts = fields.stack ? [fields, withoutStack] : [withoutStack];
|
|
1613
|
+
for (const attempt of attempts) {
|
|
1614
|
+
const serialized = JSON.stringify(attempt);
|
|
1615
|
+
if (utf8ByteLength(serialized) <= TOOL_ERROR_REPORT_MAX_BODY_BYTES) return serialized;
|
|
1616
|
+
}
|
|
1617
|
+
const base = { ...withoutStack, message: "" };
|
|
1618
|
+
const budgetForMessage = TOOL_ERROR_REPORT_MAX_BODY_BYTES - utf8ByteLength(JSON.stringify(base));
|
|
1619
|
+
if (budgetForMessage > 0) {
|
|
1620
|
+
const shrunk = truncateToUtf8Bytes(withoutStack.message ?? "", budgetForMessage);
|
|
1621
|
+
if (shrunk) {
|
|
1622
|
+
const serialized = JSON.stringify({ ...withoutStack, message: shrunk });
|
|
1623
|
+
if (utf8ByteLength(serialized) <= TOOL_ERROR_REPORT_MAX_BODY_BYTES) return serialized;
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
const fallback = JSON.stringify({
|
|
1627
|
+
...withoutStack,
|
|
1628
|
+
message: withoutStack.errorClass ?? ""
|
|
1629
|
+
});
|
|
1630
|
+
return utf8ByteLength(fallback) <= TOOL_ERROR_REPORT_MAX_BODY_BYTES ? fallback : null;
|
|
1631
|
+
};
|
|
1632
|
+
function resolveSafeReportOrigin(value) {
|
|
1633
|
+
if (typeof value !== "string" || !value.trim()) return null;
|
|
1634
|
+
let url;
|
|
1635
|
+
try {
|
|
1636
|
+
url = new URL(value.trim());
|
|
1637
|
+
} catch {
|
|
1638
|
+
return null;
|
|
1639
|
+
}
|
|
1640
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") return null;
|
|
1641
|
+
if (url.username || url.password) return null;
|
|
1642
|
+
if (url.search || url.hash) return null;
|
|
1643
|
+
if (url.pathname !== "/" && url.pathname !== "") return null;
|
|
1644
|
+
if (url.protocol === "http:" && !isLoopbackHostname(url.hostname)) return null;
|
|
1645
|
+
return url.origin;
|
|
1646
|
+
}
|
|
1647
|
+
var collectConfiguredOrigins = (state) => {
|
|
1648
|
+
const origins = /* @__PURE__ */ new Set();
|
|
1649
|
+
const push = (value) => {
|
|
1650
|
+
const normalized = normalizeKnownServerOrigin(value);
|
|
1651
|
+
if (normalized) origins.add(normalized);
|
|
1652
|
+
};
|
|
1653
|
+
push(state?.settings?.currentServer);
|
|
1654
|
+
const syncServers = state?.settings?.syncServers;
|
|
1655
|
+
if (Array.isArray(syncServers)) syncServers.forEach(push);
|
|
1656
|
+
const registry = state?.settings?.userAuthorityRegistry;
|
|
1657
|
+
if (registry && typeof registry === "object") {
|
|
1658
|
+
for (const entry of Object.values(registry)) {
|
|
1659
|
+
if (typeof entry === "string") {
|
|
1660
|
+
push(entry);
|
|
1661
|
+
continue;
|
|
1662
|
+
}
|
|
1663
|
+
if (entry && typeof entry === "object") {
|
|
1664
|
+
const record = entry;
|
|
1665
|
+
push(record.authorityServer);
|
|
1666
|
+
push(record.homeServer);
|
|
1667
|
+
push(record.primaryServer);
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
return origins;
|
|
1672
|
+
};
|
|
1673
|
+
function resolveToolErrorReportTarget(state) {
|
|
1674
|
+
if (!state || typeof state !== "object") return null;
|
|
1675
|
+
const snapshot = getSessionSnapshotForState(state);
|
|
1676
|
+
const activeAccountId = typeof snapshot?.activeAccountId === "string" ? snapshot.activeAccountId.trim() : "";
|
|
1677
|
+
const rawToken = typeof snapshot?.activeToken === "string" ? snapshot.activeToken.trim() : "";
|
|
1678
|
+
if (!activeAccountId || !rawToken) return null;
|
|
1679
|
+
const configuredOrigins = collectConfiguredOrigins(state);
|
|
1680
|
+
if (isGoogleAuthoritySession(rawToken)) {
|
|
1681
|
+
const sameOrigin = resolveSafeReportOrigin(googleSessionServer(rawToken));
|
|
1682
|
+
if (!sameOrigin) return null;
|
|
1683
|
+
return { baseUrl: sameOrigin, token: rawToken };
|
|
1684
|
+
}
|
|
1685
|
+
const authorityServer = resolveUserAuthorityServer({
|
|
1686
|
+
ownerUserId: activeAccountId,
|
|
1687
|
+
registry: state?.settings?.userAuthorityRegistry ?? null
|
|
1688
|
+
});
|
|
1689
|
+
const authorityOrigin = resolveSafeReportOrigin(authorityServer);
|
|
1690
|
+
const currentOrigin = resolveSafeReportOrigin(selectCurrentServer(state));
|
|
1691
|
+
const authorityKnown = typeof authorityServer === "string" && authorityServer.trim().length > 0;
|
|
1692
|
+
const candidate = authorityKnown ? authorityOrigin : currentOrigin;
|
|
1693
|
+
if (!candidate) return null;
|
|
1694
|
+
if (!configuredOrigins.has(candidate)) return null;
|
|
1695
|
+
return { baseUrl: candidate, token: rawToken };
|
|
1696
|
+
}
|
|
1697
|
+
var dedupeKeyOf = (payload) => `${payload.dialogId}|${payload.callId}|${payload.toolName}|${payload.errorClass}`;
|
|
1698
|
+
var rememberDedupeKey = (key) => {
|
|
1699
|
+
dedupeKeys.set(key, true);
|
|
1700
|
+
while (dedupeKeys.size > MAX_DEDUPE_ENTRIES) {
|
|
1701
|
+
const oldest = dedupeKeys.keys().next();
|
|
1702
|
+
if (oldest.done) break;
|
|
1703
|
+
dedupeKeys.delete(oldest.value);
|
|
1704
|
+
}
|
|
1705
|
+
};
|
|
1706
|
+
async function reportToolError(args) {
|
|
1707
|
+
const key = dedupeKeyOf(args.payload);
|
|
1708
|
+
if (dedupeKeys.has(key)) return false;
|
|
1709
|
+
if (inflightReports >= MAX_INFLIGHT_REPORTS) return false;
|
|
1710
|
+
const baseUrl = resolveSafeReportOrigin(args.baseUrl);
|
|
1711
|
+
if (!baseUrl) return false;
|
|
1712
|
+
const requestUrl = `${baseUrl}${TOOL_ERROR_REPORT_PATH}`;
|
|
1713
|
+
let requestToken;
|
|
1714
|
+
try {
|
|
1715
|
+
requestToken = googleSessionRequestToken(args.token, requestUrl);
|
|
1716
|
+
} catch {
|
|
1717
|
+
return false;
|
|
1718
|
+
}
|
|
1719
|
+
if (!requestToken) return false;
|
|
1720
|
+
if (typeof AbortController !== "function") return false;
|
|
1721
|
+
const timeoutMs = typeof args.timeoutMs === "number" && args.timeoutMs > 0 ? args.timeoutMs : REPORT_TIMEOUT_MS;
|
|
1722
|
+
rememberDedupeKey(key);
|
|
1723
|
+
inflightReports += 1;
|
|
1724
|
+
const controller = new AbortController();
|
|
1725
|
+
const timer = setTimeout(() => {
|
|
1726
|
+
try {
|
|
1727
|
+
controller.abort();
|
|
1728
|
+
} catch {
|
|
1729
|
+
}
|
|
1730
|
+
}, timeoutMs);
|
|
1731
|
+
try {
|
|
1732
|
+
const fetchImpl = args.fetchImpl ?? (typeof fetch === "function" ? fetch : void 0);
|
|
1733
|
+
if (!fetchImpl) return false;
|
|
1734
|
+
const body = buildBoundedBody(pickAllowedFields(args.payload));
|
|
1735
|
+
if (!body) return false;
|
|
1736
|
+
const response = await fetchImpl(requestUrl, {
|
|
1737
|
+
method: "POST",
|
|
1738
|
+
headers: {
|
|
1739
|
+
"Content-Type": "application/json",
|
|
1740
|
+
Authorization: `Bearer ${requestToken}`
|
|
1741
|
+
},
|
|
1742
|
+
body,
|
|
1743
|
+
// 不跟随重定向:避免把 Authorization 带到别处。
|
|
1744
|
+
redirect: "error",
|
|
1745
|
+
credentials: "omit",
|
|
1746
|
+
signal: controller.signal
|
|
1747
|
+
});
|
|
1748
|
+
return response?.ok === true;
|
|
1749
|
+
} catch {
|
|
1750
|
+
return false;
|
|
1751
|
+
} finally {
|
|
1752
|
+
clearTimeout(timer);
|
|
1753
|
+
inflightReports -= 1;
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
var isBrowserRuntime = () => typeof window !== "undefined" && typeof document !== "undefined";
|
|
1757
|
+
function reportToolExecutionErrorInBackground(args) {
|
|
1758
|
+
try {
|
|
1759
|
+
if (!isBrowserRuntime()) return;
|
|
1760
|
+
const payload = buildToolErrorReportPayload(args);
|
|
1761
|
+
if (!payload) return;
|
|
1762
|
+
const target = resolveToolErrorReportTarget(args.thunkApi?.getState?.());
|
|
1763
|
+
if (!target) return;
|
|
1764
|
+
void reportToolError({ ...target, payload }).catch(() => {
|
|
1765
|
+
});
|
|
1766
|
+
} catch {
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1235
1770
|
// packages/ai/tools/stripModelConfirmationFlags.ts
|
|
1236
1771
|
var CONFIRMATION_INPUT_KEYS = {
|
|
1772
|
+
knowledge_capture_requires_confirmation: "__confirmedKnowledgeCapture",
|
|
1237
1773
|
self_evolution_requires_confirmation: "__confirmedSelfEvolution",
|
|
1238
1774
|
agent_update_requires_confirmation: "__confirmedSelfEvolution",
|
|
1239
1775
|
media_job_start_requires_confirmation: "__confirmedMediaJobStart"
|
|
@@ -1280,6 +1816,7 @@ export {
|
|
|
1280
1816
|
updateResponsesConversationState,
|
|
1281
1817
|
isResponsesConversationStateRejection,
|
|
1282
1818
|
generateRequestBody,
|
|
1819
|
+
reportToolExecutionErrorInBackground,
|
|
1283
1820
|
CONFIRMATION_INPUT_KEYS,
|
|
1284
1821
|
stripModelToolArgs,
|
|
1285
1822
|
DirectApiKeyResolutionError,
|