nolo-cli 0.228.0 → 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.
Files changed (212) hide show
  1. package/{_executeModel-GIFVXKDT.js → _executeModel-AKCTHGMP.js} +62 -61
  2. package/{action-WZTKEF5H.js → action-C6IQAKN4.js} +6 -6
  3. package/{addContentAction-MLI6GOBV.js → addContentAction-53364YDW.js} +10 -10
  4. package/{addDialogAgentAction-ARGQM22H.js → addDialogAgentAction-U5DD5EN5.js} +9 -9
  5. package/{agentDeleteCommand-UF7XVELS.js → agentDeleteCommand-2E5FAGUO.js} +99 -93
  6. package/{agentEmailCommands-SFHRPQYC.js → agentEmailCommands-UGZZAH7E.js} +99 -93
  7. package/{agentListCommands-IXKBP3W5.js → agentListCommands-JCTW3J2K.js} +240 -52
  8. package/{agentMachineCommands-7NX6PWQ6.js → agentMachineCommands-QPG5ZXF4.js} +45 -41
  9. package/{agentProviderCommands-C5T7C5KZ.js → agentProviderCommands-QLTABYR7.js} +2 -2
  10. package/{agentPullCommand-4EQZYHU4.js → agentPullCommand-2EYJ5ENC.js} +1 -1
  11. package/{agentRecordCommands-IUNX6XD6.js → agentRecordCommands-4NTVR6MZ.js} +98 -92
  12. package/{agentRunCommand-LCR4XADM.js → agentRunCommand-VHF34PYC.js} +103 -94
  13. package/{agentRunControl-RN2P6AOD.js → agentRunControl-QYTXUQGY.js} +10 -7
  14. package/{agentRuntimeLocal-LVXPQ7QA.js → agentRuntimeLocal-U54AKHXH.js} +38 -36
  15. package/{agentSlice-ZGMOH6TE.js → agentSlice-4JGDEXWK.js} +10 -10
  16. package/{appDeleteCommands-BESCJOQM.js → appDeleteCommands-XBE5QJ6P.js} +46 -42
  17. package/{appDeployCommands-LPTR6IOX.js → appDeployCommands-QIYLXXGA.js} +46 -42
  18. package/{appDeployStatusCommands-BZ7KZ5RD.js → appDeployStatusCommands-JXS6ZQZZ.js} +46 -42
  19. package/{appGetCommands-EDWGJV4S.js → appGetCommands-SZS7SJPK.js} +46 -42
  20. package/{appListCommands-OPRWYPM6.js → appListCommands-B3GBJSNV.js} +46 -42
  21. package/{authCommand-3C3RN4OU.js → authCommand-V6EOMZX6.js} +15 -15
  22. package/{authCommands-ZMVEDCQD.js → authCommands-T5FODCEG.js} +2 -2
  23. package/{builtinSkillRegistry-VRCMQ77Q.js → builtinSkillRegistry-ZQC3IIO2.js} +4 -3
  24. package/{chromeOpsCommands-NZITLHWO.js → chromeOpsCommands-OFX7ZGKP.js} +2 -2
  25. package/{chunk-MZVCFV3T.js → chunk-223KZUJ6.js} +4 -4
  26. package/{chunk-UF6J7NXV.js → chunk-2C5VN7NH.js} +1 -1
  27. package/{chunk-MAA42MMV.js → chunk-2FZVXOFX.js} +4 -4
  28. package/{chunk-ESN4WNWU.js → chunk-2JHGUL5K.js} +2 -2
  29. package/chunk-3A5NNQCN.js +64 -0
  30. package/chunk-3F2FRLIO.js +372 -0
  31. package/{chunk-V4IYI3SB.js → chunk-46FETNLF.js} +2 -2
  32. package/{chunk-RR3MB26M.js → chunk-4GYVS4PM.js} +8 -6
  33. package/{chunk-ZQ6K57FJ.js → chunk-4YPH5KRA.js} +1 -1
  34. package/{chunk-Y4NPF2UN.js → chunk-5AYP5QBB.js} +5 -5
  35. package/{chunk-4OXPN3WC.js → chunk-5ISNPTQH.js} +4 -4
  36. package/{chunk-CO6E7YK6.js → chunk-5P3PPQVP.js} +1 -1
  37. package/{chunk-6TVYUQRM.js → chunk-6BMTKYAO.js} +2 -2
  38. package/{chunk-KLAMJNKQ.js → chunk-6PAHSSD2.js} +15 -8
  39. package/{chunk-CTWCZKNS.js → chunk-6SOWMEAY.js} +4 -4
  40. package/{chunk-ARFCL53U.js → chunk-6VEO7Z3Y.js} +5 -5
  41. package/{chunk-ZM5AZTQG.js → chunk-7BIJFGKS.js} +20 -8
  42. package/{chunk-BAH3BAUZ.js → chunk-7OVOZRZF.js} +5 -5
  43. package/{chunk-N74XL3NI.js → chunk-7PON4LBY.js} +42 -24
  44. package/{chunk-LTVEOOZL.js → chunk-7WHCIA5V.js} +16 -3
  45. package/{chunk-HZDK56EK.js → chunk-ADYWV732.js} +34 -12
  46. package/{chunk-2FK2KZSL.js → chunk-AIFQKNPP.js} +1 -1
  47. package/{chunk-VTHWBTRE.js → chunk-BPB3T5EU.js} +5 -8
  48. package/{chunk-SX6AWTNK.js → chunk-BZLGPM5B.js} +3 -3
  49. package/{chunk-MTM4LRVG.js → chunk-BZMDWGQQ.js} +2 -2
  50. package/{chunk-JP2BH4NC.js → chunk-CEKRIR22.js} +1 -1
  51. package/{chunk-5HUO7SEX.js → chunk-D634SL2Y.js} +1 -1
  52. package/{chunk-SCMYAGQE.js → chunk-DHRPLRIR.js} +294 -159
  53. package/{chunk-VUHKG4KS.js → chunk-DNNPARJK.js} +9 -5
  54. package/{chunk-X22AUZKL.js → chunk-E3LSO6EI.js} +189 -88
  55. package/{chunk-LHCGKAFO.js → chunk-EHFBP6IK.js} +100 -48
  56. package/{chunk-6ASGEP5D.js → chunk-EJQE5HB7.js} +1 -1
  57. package/{chunk-2BKNICGK.js → chunk-EL5NRJHI.js} +1 -1
  58. package/chunk-EUGTFFO6.js +42 -0
  59. package/{chunk-YFW4H6DL.js → chunk-EVHTYVD2.js} +821 -131
  60. package/{chunk-6XRPBZRS.js → chunk-EYLGAEB4.js} +0 -134
  61. package/{chunk-E5RYFR7E.js → chunk-FEIVARWR.js} +49 -15
  62. package/{chunk-3DJJ4CFG.js → chunk-FLBJ7IJI.js} +9 -9
  63. package/{chunk-W3HSD32M.js → chunk-FXEPZKNJ.js} +2 -2
  64. package/{chunk-VKCPKCSS.js → chunk-FYAMUU55.js} +625 -62
  65. package/{chunk-JEWMQR6J.js → chunk-FZANZZ63.js} +1 -1
  66. package/{chunk-WWTSEBDF.js → chunk-GIXWVN2W.js} +1 -1
  67. package/{chunk-YHNUDTU4.js → chunk-HDKMVYNJ.js} +4 -4
  68. package/chunk-HEVRQGGH.js +106 -0
  69. package/{chunk-PBPXXMWZ.js → chunk-HFHJPHFK.js} +1 -1
  70. package/{chunk-WQDTSK5U.js → chunk-HPDLPEUG.js} +11 -5
  71. package/{chunk-SPU3L3OR.js → chunk-HQUGB2HM.js} +3 -3
  72. package/chunk-IVK2KT3H.js +209 -0
  73. package/{chunk-73PZD7JZ.js → chunk-IYLUK67R.js} +2 -2
  74. package/{chunk-BFKJ2RS3.js → chunk-J55F3IEZ.js} +1 -1
  75. package/{chunk-ADOOL3PG.js → chunk-J7JRCOIW.js} +1 -1
  76. package/{chunk-AEZBAFC6.js → chunk-JAKRY74O.js} +138 -8
  77. package/{chunk-NEG5LYK5.js → chunk-JCQ3WCQ3.js} +3 -1
  78. package/{chunk-W6T4FNZP.js → chunk-JLZJL3WC.js} +219 -351
  79. package/{chunk-PQ63BDV3.js → chunk-JPXACKSW.js} +9 -1
  80. package/{chunk-IIOSZAJX.js → chunk-KDBDOXOM.js} +137 -53
  81. package/{chunk-CIGCTSBF.js → chunk-KDDHQMSH.js} +1 -1
  82. package/{chunk-OAZP4TSA.js → chunk-KG27JIG4.js} +2 -2
  83. package/{chunk-RHBD22LV.js → chunk-KHYSFS3W.js} +80 -4
  84. package/{chunk-7UVVLYKC.js → chunk-KKIQAVDR.js} +5 -5
  85. package/{chunk-HS7MLR74.js → chunk-KZ4A7EIV.js} +3 -5
  86. package/{chunk-OLGFIQN2.js → chunk-LLUBUHNT.js} +1 -1
  87. package/{chunk-QJTZ76CP.js → chunk-LS5KAVFQ.js} +1 -0
  88. package/{chunk-K26XPZRB.js → chunk-LVZVSLKO.js} +29 -9
  89. package/{chunk-XJSEST7D.js → chunk-MNFUKRRU.js} +3 -3
  90. package/{chunk-R5NRFXGD.js → chunk-O3A2CHAL.js} +5 -5
  91. package/{chunk-4IQN6FWY.js → chunk-OB4FBZXJ.js} +4 -4
  92. package/{chunk-J2VIGDJN.js → chunk-OJSJJKHF.js} +3 -3
  93. package/{chunk-OHUYN3YU.js → chunk-OKAXQFON.js} +1 -1
  94. package/{chunk-CD2DK5JA.js → chunk-OKH74FML.js} +2 -1
  95. package/{chunk-MYYNZG2M.js → chunk-OOV5JN25.js} +4 -4
  96. package/{chunk-TMRJGSK2.js → chunk-OOVOAG4Q.js} +1 -1
  97. package/chunk-OQFOE4SJ.js +405 -0
  98. package/{chunk-AS6L5KSD.js → chunk-P4R5KXU7.js} +2 -2
  99. package/{chunk-VIYVRPMJ.js → chunk-PHREU2KZ.js} +5 -3
  100. package/{chunk-EDT65EUE.js → chunk-PIVTQRX6.js} +45 -15
  101. package/{chunk-QMNVV3YM.js → chunk-PJL7OJRC.js} +12 -11
  102. package/{chunk-XCA4WHX5.js → chunk-PNLDLUMO.js} +315 -360
  103. package/{chunk-UPOW5HTG.js → chunk-QGFLVQ6E.js} +3 -3
  104. package/{chunk-JU7VN4LF.js → chunk-QONAOHVW.js} +6 -6
  105. package/{chunk-UOUMPHS5.js → chunk-R3FZHW4Q.js} +13 -13
  106. package/{chunk-K7VIXYTZ.js → chunk-R3MV2GII.js} +1 -45
  107. package/{chunk-FE7G6DSP.js → chunk-R72QWIFO.js} +14 -4
  108. package/{chunk-KZAT2M2V.js → chunk-RIWKZT7E.js} +22 -0
  109. package/{chunk-RMWDKLBE.js → chunk-S7H4KTMB.js} +1099 -71
  110. package/{chunk-IJZC2KIJ.js → chunk-SA356NGW.js} +1 -1
  111. package/{chunk-BVEDT6DM.js → chunk-SCAC3NM5.js} +3 -3
  112. package/{chunk-EQZQUQ33.js → chunk-SLUN7W6S.js} +5 -5
  113. package/{chunk-KK3FCYZM.js → chunk-SQL7YNED.js} +7 -4
  114. package/{chunk-LMGFVH65.js → chunk-SSOR2EDT.js} +10 -10
  115. package/chunk-TRRXYFTR.js +46 -0
  116. package/{chunk-XNTZD4AE.js → chunk-TUOHSUK5.js} +19367 -17503
  117. package/chunk-TYJCIA2O.js +835 -0
  118. package/{chunk-FTWAOKFU.js → chunk-U3BUWDUP.js} +415 -1962
  119. package/{chunk-CD64YXRB.js → chunk-U6QNVOR5.js} +1 -1
  120. package/chunk-UAF5VQCE.js +77 -0
  121. package/{chunk-CIUZXD5D.js → chunk-UFGUJ2IH.js} +5 -5
  122. package/{chunk-CTIEJRTP.js → chunk-UP7KBWLE.js} +81 -29
  123. package/{chunk-GX6DITLQ.js → chunk-UUCYUN6Y.js} +1 -1
  124. package/{chunk-UHW6SCVK.js → chunk-UZKBVQUX.js} +1 -1
  125. package/{chunk-XSRSAU3O.js → chunk-V5TI7HJH.js} +3 -3
  126. package/{chunk-WFGNWWJI.js → chunk-VH7UO6E5.js} +252 -114
  127. package/{chunk-ITBX27W6.js → chunk-VJFDG3ZG.js} +30 -122
  128. package/{chunk-6MTVACLN.js → chunk-WC3J5SL2.js} +277 -293
  129. package/{chunk-HCCQEMTK.js → chunk-WD5547ZF.js} +15 -12
  130. package/{chunk-X3OZ655T.js → chunk-WS36XPJD.js} +2 -2
  131. package/{chunk-JFRJEPFI.js → chunk-WSLL7VV4.js} +2 -2
  132. package/chunk-XRGBJHZX.js +136 -0
  133. package/{chunk-KZ5OD2MO.js → chunk-Y2KWJTOZ.js} +3 -3
  134. package/{dialogUsageCommand-6RW2FY6K.js → chunk-Y2TCTNUD.js} +24 -17
  135. package/{chunk-FFFKAOJN.js → chunk-YN23INFZ.js} +1 -1
  136. package/{chunk-ODBYGVO2.js → chunk-YXK3GJF5.js} +5 -5
  137. package/{chunk-6CXQ3YNJ.js → chunk-Z2OWAYMI.js} +53 -31
  138. package/{chunk-6XVPMGXK.js → chunk-ZTHAJU3O.js} +10 -4
  139. package/{chunk-D25ONVOH.js → chunk-ZYPXOQS2.js} +1 -1
  140. package/{cliAgentConfigHelpers-37ZNEY5Y.js → cliAgentConfigHelpers-BXHQ3PXP.js} +8 -8
  141. package/{cliAuthorityBrokerClient-SFPC3WVK.js → cliAuthorityBrokerClient-TFNXJLXL.js} +1 -1
  142. package/cliAuthorityBrokerProcess-5ZFBTHLB.js +22 -0
  143. package/{cliLocalAgentRecordReader-MCQVRWBR.js → cliLocalAgentRecordReader-47PXMHPH.js} +43 -41
  144. package/{commandRegistry-NTH5IAN5.js → commandRegistry-CTMPAQH2.js} +93 -156
  145. package/{contentThunks-SPXTX5U2.js → contentThunks-CAHIIZO5.js} +25 -25
  146. package/{cooldownCommands-TIFCHCUN.js → cooldownCommands-WDOI5VD7.js} +3 -3
  147. package/{createAgentAutomationAction-KUQKCOXB.js → createAgentAutomationAction-M25XZSPD.js} +25 -25
  148. package/{createDialogAction-HJN5U3XS.js → createDialogAction-4SN7FKI7.js} +26 -26
  149. package/{createPageAction-ZAHRDOAU.js → createPageAction-N7QPDN3M.js} +28 -28
  150. package/{db-CMUTP3W5.js → db-VR74ADGC.js} +7 -2
  151. package/{dbSlice-656PMWR2.js → dbSlice-RWPSVHBC.js} +9 -9
  152. package/{deleteFile-ZCQESEEQ.js → deleteFile-ECU6FU5C.js} +12 -7
  153. package/{dialogCommands-KZTZLWPZ.js → dialogCommands-BBHWCKDP.js} +57 -47
  154. package/{dialogNotifyCommand-PST75COP.js → dialogNotifyCommand-IASQGEMW.js} +9 -9
  155. package/{dialogSlice-BXIERQHO.js → dialogSlice-JI3J22RV.js} +23 -23
  156. package/dialogTraceCommand-EW2KK6A4.js +961 -0
  157. package/dialogUsageCommand-WJ3U6KZU.js +27 -0
  158. package/{docCreateCommands-26HJ5NAY.js → docCreateCommands-QSX3X5U4.js} +45 -41
  159. package/{docDeleteCommands-UAOHH5XK.js → docDeleteCommands-63JBG2HQ.js} +46 -42
  160. package/{docReadCommands-4ADG7YE6.js → docReadCommands-CQFKRQUI.js} +45 -41
  161. package/{docStore-FZ75HWP2.js → docStore-XLBKGGNM.js} +10 -10
  162. package/{docUpdateCommands-OGFJZENF.js → docUpdateCommands-534LUK25.js} +45 -41
  163. package/ebookDownloaderAgentCommand-DYSKF5ZY.js +677 -0
  164. package/{getPricing-FCHYVRJU.js → getPricing-5BLZRPTM.js} +3 -3
  165. package/{handleSendMessageAction-KP6GGBFY.js → handleSendMessageAction-Q2VMEVOR.js} +90 -48
  166. package/{hostCredentialCreate-23TX56G7.js → hostCredentialCreate-C57T7YPE.js} +99 -93
  167. package/index.js +23 -11
  168. package/{localDialogRead-CIOTQM5T.js → localDialogRead-BJJT3TF5.js} +1 -1
  169. package/{localRuntimeAdapter-MTUWOYPN.js → localRuntimeAdapter-OALZPFZU.js} +96 -90
  170. package/{localRuntimeAuthority-TYHQCTZN.js → localRuntimeAuthority-UF2DAQ3F.js} +13 -3
  171. package/{localRuntimeDb-BO7IVWAZ.js → localRuntimeDb-ZJFGNHML.js} +1 -1
  172. package/{machineCommands-4WJUJQHW.js → machineCommands-N6IVWRZT.js} +109 -92
  173. package/{machineWsRunDispatch-V3U4JM67.js → machineWsRunDispatch-PDWYB33B.js} +97 -91
  174. package/{markdownToSlate-KIYM7B3P.js → markdownToSlate-PXYAIBVL.js} +1 -1
  175. package/{mcpLocalAuthorizeCommand-TI656UWC.js → mcpLocalAuthorizeCommand-KYI4EGF5.js} +17 -13
  176. package/{memberThunks-JFYC4Z5L.js → memberThunks-43B7UYC5.js} +11 -11
  177. package/{models-EP7VG6N2.js → models-ZX2BYIMB.js} +2 -2
  178. package/package.json +2 -1
  179. package/{projectArchive-NU2Z5HOR.js → projectArchive-TJNW5DLM.js} +28 -28
  180. package/{providerPresetApply-4H7YP5D7.js → providerPresetApply-NTJUINI6.js} +35 -16
  181. package/{providerRegistry-F3UPOTIY.js → providerRegistry-W45SLUV6.js} +5 -5
  182. package/{read-BRZHXUJ6.js → read-KG6INYUT.js} +12 -7
  183. package/{readDocTool-N7RVFQEE.js → readDocTool-N3GA52JR.js} +1 -1
  184. package/{readlineWorkspace-T56MRMS5.js → readlineWorkspace-PJZJVGA5.js} +1296 -1056
  185. package/{removeDialogAgentAction-J7XU7OUX.js → removeDialogAgentAction-EEVSOQOJ.js} +11 -11
  186. package/{runAgentClientLoop-O2GRCGRZ.js → runAgentClientLoop-3VC5TCDW.js} +69 -58
  187. package/{runtimeDoctorCommands-RDRJXMXC.js → runtimeDoctorCommands-V3M3JTUV.js} +14 -11
  188. package/{secretCommands-2FEMRUFM.js → secretCommands-KVVZS7A6.js} +2 -2
  189. package/{setDialogExtraReferencesAction-Q4V2ZZW2.js → setDialogExtraReferencesAction-DNO5POHA.js} +10 -10
  190. package/{setPrimaryDialogAgentAction-742H5S6T.js → setPrimaryDialogAgentAction-QABBEO4C.js} +11 -11
  191. package/{settingThunks-T4FXSV6M.js → settingThunks-DVKG4X4S.js} +13 -17
  192. package/{skillDiscovery-MDDKPTW3.js → skillDiscovery-ZMJH36AK.js} +3 -3
  193. package/{spaceCommands-W5TAVFDT.js → spaceCommands-AGGZXPY3.js} +218 -77
  194. package/{streamAgentChatTurn-OWDJMU5E.js → streamAgentChatTurn-4GTLL2OF.js} +111 -95
  195. package/{switchDialogAgentAction-HLDLHRRA.js → switchDialogAgentAction-KYWJSGOO.js} +9 -9
  196. package/{tableCommands-44GC4N6J.js → tableCommands-EFA754RE.js} +3 -3
  197. package/{tools-O7SGGVA3.js → tools-5AGPOPLW.js} +48 -47
  198. package/{tuiRestart-EOGC2BYY.js → tuiRestart-77E7PL4R.js} +9 -8
  199. package/{tuiSummaryLlmCaller-TM5BU73J.js → tuiSummaryLlmCaller-HROLGN4F.js} +12 -12
  200. package/{updateCommands-FBYA5WVG.js → updateCommands-GJGRS6JK.js} +3 -3
  201. package/{updateDialogTitleAction-EXSZGTLL.js → updateDialogTitleAction-5OSEDGRK.js} +25 -25
  202. package/{usageCommand-L4OFWXEU.js → usageCommand-WI6SQOPB.js} +2 -2
  203. package/{usageRebuildCommand-7JR33UHS.js → usageRebuildCommand-WQRLLZAT.js} +3 -3
  204. package/{windowsSelfUpdate-M4V77OUB.js → windowsSelfUpdate-C7LGVWYX.js} +2 -2
  205. package/{workloadLifecycle-ZCSQCHG3.js → workloadLifecycle-P2SJVV3S.js} +2 -2
  206. package/chunk-FGHEF6WI.js +0 -34
  207. package/chunk-U5LOKQ2R.js +0 -176
  208. package/chunk-YDRRGVT5.js +0 -142
  209. package/chunk-YGDYYFRX.js +0 -86
  210. package/chunk-Z7KE4K3H.js +0 -758
  211. package/lib-62SWPXNF.js +0 -21042
  212. /package/{chunk-ANUP75N2.js → chunk-2E4BYAUE.js} +0 -0
@@ -1,12 +1,26 @@
1
1
  import {
2
2
  getLocalProviderSecret
3
- } from "./chunk-HS7MLR74.js";
3
+ } from "./chunk-KZ4A7EIV.js";
4
4
  import {
5
5
  performServerProxyFetchWithRetry
6
- } from "./chunk-JU7VN4LF.js";
6
+ } from "./chunk-QONAOHVW.js";
7
7
  import {
8
8
  fetchServerSyncedCredential
9
- } from "./chunk-N74XL3NI.js";
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
25
  buildIdentityBlock,
12
26
  buildPlatformStaticContextLayers,
@@ -15,7 +29,7 @@ import {
15
29
  compileContextLayers,
16
30
  detectDispatchIntentFromMessages,
17
31
  resolveToolGuidedSections
18
- } from "./chunk-Z7KE4K3H.js";
32
+ } from "./chunk-TYJCIA2O.js";
19
33
  import {
20
34
  convertMessagesToResponsesInput,
21
35
  getUsageRequestOptions,
@@ -24,39 +38,46 @@ import {
24
38
  resolveReasoningReplayOptions,
25
39
  shouldStripReasoningContentForOutbound,
26
40
  stablePromptCacheKey
27
- } from "./chunk-W3HSD32M.js";
41
+ } from "./chunk-FXEPZKNJ.js";
28
42
  import {
29
43
  resolveAgentCallPlan,
30
44
  resolveClientWire
31
- } from "./chunk-VUHKG4KS.js";
45
+ } from "./chunk-DNNPARJK.js";
46
+ import {
47
+ isGpt62DeveloperPrefixModel,
48
+ usesCodexDeveloperPrefix
49
+ } from "./chunk-7WHCIA5V.js";
32
50
  import {
33
51
  createFileCredentialBroker
34
52
  } from "./chunk-E6A5NHDH.js";
35
53
  import {
36
54
  MEMORY_USE_GUIDANCE,
37
55
  buildUserResponseLanguageContext
38
- } from "./chunk-YGDYYFRX.js";
56
+ } from "./chunk-UAF5VQCE.js";
39
57
  import {
40
58
  wrapHistoricalSummaryWithReplayGuard
41
59
  } from "./chunk-2SXN7LAY.js";
42
60
  import {
43
61
  buildSkillGuidancePromptBlock
44
- } from "./chunk-6MTVACLN.js";
62
+ } from "./chunk-WC3J5SL2.js";
45
63
  import {
46
64
  canonicalizeToolNames
47
65
  } from "./chunk-YLAHYLDQ.js";
48
66
  import {
49
- API_ENDPOINTS
67
+ API_ENDPOINTS,
68
+ normalizeKnownServerOrigin
50
69
  } from "./chunk-LCBAMY2M.js";
51
70
  import {
52
71
  toErrorMessage
53
72
  } from "./chunk-HNMXYYJR.js";
54
73
  import {
55
- buildProviderAuthHeaders
56
- } from "./chunk-K26XPZRB.js";
74
+ buildProviderAuthHeaders,
75
+ isAgentCredentialShared,
76
+ resolveOutboundProxyApiKey
77
+ } from "./chunk-LVZVSLKO.js";
57
78
  import {
58
79
  OPENAI_RESPONSES_ENDPOINT
59
- } from "./chunk-ESN4WNWU.js";
80
+ } from "./chunk-2JHGUL5K.js";
60
81
  import {
61
82
  asTrimmedString
62
83
  } from "./chunk-3EUW3WEO.js";
@@ -64,7 +85,7 @@ import {
64
85
  clampReasoningEffort,
65
86
  getModelConfig,
66
87
  isModelSupportReasoningEffort
67
- } from "./chunk-CD2DK5JA.js";
88
+ } from "./chunk-OKH74FML.js";
68
89
  import {
69
90
  isRecord
70
91
  } from "./chunk-KUG52IAP.js";
@@ -72,15 +93,16 @@ import {
72
93
  asOptionalTrimmedString
73
94
  } from "./chunk-G3SUCT4W.js";
74
95
  import {
96
+ isLoopbackHostname,
75
97
  isLoopbackUrl
76
98
  } from "./chunk-4SN6J65J.js";
77
99
  import {
78
100
  isDeepInfraKimiModel,
79
101
  isFireworksKimiModel,
80
- isPlatformMimoProviderModel,
81
102
  resolveFireworksKimiModel,
82
- resolvePlatformHostedRouting
83
- } from "./chunk-PQ63BDV3.js";
103
+ resolvePlatformHostedRouting,
104
+ usesMimoThinkingWire
105
+ } from "./chunk-JPXACKSW.js";
84
106
  import {
85
107
  asTrimmedLowercaseString
86
108
  } from "./chunk-QSJ3HFEF.js";
@@ -240,7 +262,12 @@ ${mainPrompt}` : "";
240
262
  const agentTools = canonicalizeToolNames(agentConfig.tools ?? []);
241
263
  const hasAskTool = agentTools.includes("ask_user");
242
264
  const toolSections = resolveToolGuidedSections(agentTools, {
243
- 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
244
271
  });
245
272
  const {
246
273
  startupProtocol,
@@ -279,6 +306,7 @@ ${wrapHistoricalSummaryWithReplayGuard(contexts.dialogSummary)}` : "";
279
306
  { id: "agent-orchestration", owner: "platform", cacheScope: "session", content: toolSections.agentOrchestration },
280
307
  { id: "agent-collaboration", owner: "platform", cacheScope: "session", content: toolSections.agentCollaboration },
281
308
  { id: "web-access", owner: "platform", cacheScope: "session", content: toolSections.webAccess },
309
+ { id: "platform-risk-control", owner: "platform", cacheScope: "session", content: toolSections.platformRiskControl },
282
310
  { id: "menu-usage", owner: "platform", cacheScope: "session", content: toolSections.menuUsage },
283
311
  { id: "show-interaction", owner: "platform", cacheScope: "session", content: toolSections.showInteraction },
284
312
  { id: "clarification-mode", owner: "platform", cacheScope: "session", content: clarifyingSection },
@@ -327,12 +355,18 @@ var applyClaudeCache = (stableContent, dynamicContent) => {
327
355
  }
328
356
  return parts.length > 0 ? parts : stableContent;
329
357
  };
330
- var prependPromptMessage = (messages, agentConfig, resolvedModel, language, contexts, prependSystemPrompt = true) => {
358
+ var prependPromptMessage = (messages, agentConfig, resolvedModel, language, contexts, prependSystemPrompt = true, preservePromptBoundary = false, preservePromptProvenance = preservePromptBoundary) => {
331
359
  if (!prependSystemPrompt) return messages;
332
360
  if (!contexts && !agentConfig.prompt) return messages;
333
361
  const dispatchIntent = detectDispatchIntentFromMessages(messages);
334
362
  if (isClaudeModel(resolvedModel)) {
335
- const compiled = buildSystemPromptContext({ agentConfig, language, contexts, dispatchIntent });
363
+ const compiled = buildSystemPromptContext({
364
+ agentConfig,
365
+ language,
366
+ contexts,
367
+ dispatchIntent,
368
+ callerModel: agentConfig?.model
369
+ });
336
370
  if (!compiled.content.trim()) return messages;
337
371
  const content = applyClaudeCache(
338
372
  compiled.stablePrefixContent,
@@ -341,25 +375,35 @@ var prependPromptMessage = (messages, agentConfig, resolvedModel, language, cont
341
375
  const systemMessage2 = { role: "system", content };
342
376
  return [systemMessage2, ...messages];
343
377
  }
344
- const promptContent = buildSystemPrompt({ agentConfig, language, contexts, dispatchIntent });
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 });
345
396
  if (!promptContent.trim()) return messages;
346
- const systemMessage = { role: "system", content: promptContent };
397
+ const systemMessage = { role: "system", content: promptContent, ...promptProvenance };
347
398
  return [systemMessage, ...messages];
348
399
  };
349
- var shouldInjectLlamaCppThinkingToggle = (agentConfig) => {
350
- if (typeof agentConfig.enableThinking !== "boolean") return false;
351
- if (!isLoopbackUrl(agentConfig.customProviderUrl)) return false;
352
- return /qwen/i.test(agentConfig.model ?? "");
353
- };
354
- var shouldDisableMiMoThinking = (agentConfig, resolvedModel) => {
355
- if (agentConfig.enableThinking === true) return false;
356
- if (/xiaomimimo\.com/i.test(agentConfig.customProviderUrl ?? "") || (agentConfig.provider ?? "").toLowerCase() === "mimo") {
357
- return true;
358
- }
359
- 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;
360
404
  };
361
405
  var shouldDisableKimiThinking = (agentConfig, providerName, resolvedModel) => {
362
- if (agentConfig.enableThinking !== false) return false;
406
+ if (agentConfig.reasoning_effort || agentConfig.enableThinking !== false) return false;
363
407
  if (providerName === "deepinfra") return isDeepInfraKimiModel(resolvedModel);
364
408
  if (providerName === "fireworks") return isFireworksKimiModel(resolvedModel);
365
409
  return false;
@@ -396,6 +440,8 @@ var buildRequestBody = (options) => {
396
440
  const {
397
441
  model,
398
442
  messages,
443
+ preservePromptBoundary,
444
+ preservePromptProvenance,
399
445
  providerName,
400
446
  customProviderUrl,
401
447
  temperature,
@@ -406,13 +452,22 @@ var buildRequestBody = (options) => {
406
452
  reasoning_effort,
407
453
  shapingCounts
408
454
  } = options;
409
- const cleanedMessages = messages.map(
410
- (message) => sanitizeChatCompletionsMessage(message, {
455
+ const cleanedMessages = messages.map((message) => {
456
+ const sanitized = sanitizeChatCompletionsMessage(message, {
411
457
  provider: providerName,
412
458
  model,
413
459
  ...shapingCounts ? { shapingCounts } : {}
414
- })
415
- );
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
+ });
416
471
  const bodyData = {
417
472
  model,
418
473
  messages: cleanedMessages,
@@ -443,7 +498,7 @@ var buildRequestBody = (options) => {
443
498
  if (typeof max_tokens === "number") bodyData.max_tokens = max_tokens;
444
499
  return bodyData;
445
500
  };
446
- 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) => {
447
502
  const resolvedModel = providerName === "fireworks" ? resolveFireworksKimiModel(agentConfig.model) : agentConfig.model ?? "";
448
503
  let processedStable = [...stableMessages];
449
504
  if (isClaudeModel(resolvedModel) && processedStable.length > 0) {
@@ -475,11 +530,15 @@ var generateOpenAIRequestBody = (agentConfig, providerName, messages, contexts,
475
530
  resolvedModel,
476
531
  typeof navigator !== "undefined" ? navigator.language : "en",
477
532
  contexts,
478
- prependSystemPrompt
533
+ prependSystemPrompt,
534
+ preservePromptBoundary,
535
+ preservePromptProvenance
479
536
  );
480
537
  const requestBody = buildRequestBody({
481
538
  model: resolvedModel,
482
539
  messages: messagesWithPrompt,
540
+ preservePromptBoundary,
541
+ preservePromptProvenance,
483
542
  providerName,
484
543
  customProviderUrl: agentConfig.customProviderUrl,
485
544
  temperature: agentConfig.temperature,
@@ -490,18 +549,28 @@ var generateOpenAIRequestBody = (agentConfig, providerName, messages, contexts,
490
549
  reasoning_effort: agentConfig.reasoning_effort,
491
550
  ...shapingCounts ? { shapingCounts } : {}
492
551
  });
493
- if (shouldInjectLlamaCppThinkingToggle(agentConfig)) {
552
+ const llamaCppThinking = resolveLlamaCppThinkingToggle(agentConfig);
553
+ if (llamaCppThinking !== void 0) {
554
+ delete requestBody.reasoning_effort;
494
555
  requestBody.chat_template_kwargs = {
495
556
  ...requestBody.chat_template_kwargs ?? {},
496
- enable_thinking: agentConfig.enableThinking
557
+ enable_thinking: llamaCppThinking
497
558
  };
498
559
  }
499
- if (shouldDisableMiMoThinking(agentConfig, resolvedModel)) {
500
- requestBody.thinking = { type: "disabled" };
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
+ }
501
570
  }
502
571
  if (shouldDisableKimiThinking(agentConfig, providerName, resolvedModel)) {
503
572
  requestBody.thinking = { type: "disabled" };
504
- requestBody.reasoning_effort = "none";
573
+ if (providerName !== "deepinfra") requestBody.reasoning_effort = "none";
505
574
  requestBody.reasoning = { enabled: false };
506
575
  }
507
576
  return normalizeChatCompletionsBodyForProvider({
@@ -527,7 +596,7 @@ function usesGpt62DeveloperPrefix(agentConfig) {
527
596
  } else if (provider !== "openai") {
528
597
  return false;
529
598
  }
530
- return /^gpt-6\.2-(astra|sol)$/.test(model);
599
+ return isGpt62DeveloperPrefixModel(model);
531
600
  }
532
601
  function resolveResponsesCompactionThreshold(agentConfig) {
533
602
  const configured = Number(
@@ -569,7 +638,8 @@ function generateResponseRequestBody(agentConfig, msgs, contexts, prependSystemP
569
638
  language,
570
639
  contexts,
571
640
  // 按当前用户输入检测派发意图:无意图只注入最小派发协议(安全硬门常在)。
572
- dispatchIntent: detectDispatchIntentFromMessages(msgs)
641
+ dispatchIntent: detectDispatchIntentFromMessages(msgs),
642
+ callerModel: agentConfig?.model
573
643
  });
574
644
  const legacyContinuation = supportsServerState && responsesState === void 0 && agentConfig.previous_response_id !== void 0;
575
645
  if (!stateful && !legacyContinuation && usesGpt62DeveloperPrefix(agentConfig)) {
@@ -752,9 +822,8 @@ var generateRequestBody = ({
752
822
  agentConfig,
753
823
  imageSettings.shouldEnableImage
754
824
  );
755
- const clientWire = resolveClientWire(
756
- resolveAgentCallPlan(agentConfigForRequest, {})
757
- );
825
+ const plan = resolveAgentCallPlan(agentConfigForRequest, {});
826
+ const clientWire = resolveClientWire(plan);
758
827
  if (clientWire === "responses") {
759
828
  const body = generateResponseRequestBody(
760
829
  agentConfigForRequest,
@@ -775,13 +844,17 @@ var generateRequestBody = ({
775
844
  );
776
845
  return body;
777
846
  }
847
+ const codexOAuth = plan.authMethod.kind === "oauth" && plan.authMethod.ref === "chatgpt";
778
848
  const baseBody = generateOpenAIRequestBody(
779
849
  agentConfigForRequest,
780
850
  provider,
781
851
  messages,
782
852
  contexts,
783
853
  stableMessages,
784
- prependSystemPrompt
854
+ prependSystemPrompt,
855
+ void 0,
856
+ codexOAuth && usesCodexDeveloperPrefix(agentConfigForRequest, agentConfigForRequest.model),
857
+ codexOAuth
785
858
  );
786
859
  return applyImageConfigIfNeeded(baseBody, agentConfigForRequest, provider);
787
860
  };
@@ -821,11 +894,11 @@ async function resolveDirectRequestApiKey(agentConfig, options) {
821
894
  const broker = factory();
822
895
  const local = await safeBrokerGet(broker, credentialRef);
823
896
  if (local) return local;
824
- if (credentialRef.startsWith("provider-key:") && options?.providerSecretFetcher) {
897
+ if (isAgentCredentialShared(agentConfig) && credentialRef.startsWith("provider-key:") && options?.providerSecretFetcher) {
825
898
  const providerSecret = await options.providerSecretFetcher(credentialRef);
826
899
  if (providerSecret) return providerSecret;
827
900
  }
828
- if (agentConfig.credentialSynced && options?.syncFetcher) {
901
+ if (isAgentCredentialShared(agentConfig) && options?.syncFetcher) {
829
902
  const synced = await options.syncFetcher(credentialRef);
830
903
  const trimmed = asTrimmedString(synced);
831
904
  if (trimmed) {
@@ -846,11 +919,11 @@ async function safeBrokerGet(broker, ref) {
846
919
  }
847
920
  }
848
921
 
849
- // packages/ai/chat/fetchUtils.ts
922
+ // packages/ai/chat/buildProxyPayload.ts
850
923
  var buildProxyPayload = (bodyData, api, agentConfig, dialogId) => {
851
924
  const apiSource = agentConfig.apiSource === "custom" || agentConfig.apiSource === "cli" ? agentConfig.apiSource : void 0;
852
925
  const provider = bodyData.provider || agentConfig.provider || (apiSource === "custom" ? "custom" : void 0);
853
- const apiKey = asOptionalTrimmedString(agentConfig.apiKey);
926
+ const apiKey = resolveOutboundProxyApiKey(agentConfig);
854
927
  return {
855
928
  ...bodyData,
856
929
  url: api,
@@ -862,12 +935,14 @@ var buildProxyPayload = (bodyData, api, agentConfig, dialogId) => {
862
935
  KEY: apiKey
863
936
  };
864
937
  };
938
+
939
+ // packages/ai/chat/fetchUtils.ts
865
940
  var fetchDirectly = async (params) => {
866
941
  const { api, agentConfig, bodyData, signal, currentServer, token, dialogId } = params;
867
942
  try {
868
943
  const apiKey = await resolveDirectRequestApiKey(agentConfig, {
869
944
  syncFetcher: currentServer && token ? (ref) => fetchServerSyncedCredential({ currentServer, authToken: token }, ref) : void 0,
870
- providerSecretFetcher: currentServer && token ? async (ref) => {
945
+ providerSecretFetcher: isAgentCredentialShared(agentConfig) && currentServer && token ? async (ref) => {
871
946
  const presetId = ref.startsWith("provider-key:") ? ref.slice("provider-key:".length) : ref;
872
947
  const local = getLocalProviderSecret(presetId);
873
948
  if (local) return local;
@@ -951,19 +1026,33 @@ var formatFriendlyNetworkErrorMessage = (error) => {
951
1026
  return rawMessage;
952
1027
  };
953
1028
  var performFetchRequest = async (params) => {
1029
+ let direct = false;
954
1030
  try {
955
- const planConfig = {
956
- ...params.agentConfig,
957
- provider: params.bodyData.provider || params.agentConfig.provider
958
- };
959
- return resolveAgentCallPlan(planConfig, {}).transport === "server-proxy" ? await fetchWithServerProxy(params) : await fetchDirectly(params);
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);
960
1048
  } catch (error) {
961
1049
  if (error instanceof DirectApiKeyResolutionError || error?.kind === "credential_missing") {
962
1050
  throw error;
963
1051
  }
964
1052
  console.error("[performFetchRequest] \u8BF7\u6C42\u8FC7\u7A0B\u4E2D\u53D1\u751F\u9519\u8BEF:", error);
965
- if (params.preserveStructuredError) throw error;
966
- const friendlyMsg = formatFriendlyNetworkErrorMessage(error);
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);
967
1056
  throw new Error(
968
1057
  friendlyMsg.startsWith("\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25") ? friendlyMsg : `\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25: ${friendlyMsg}`
969
1058
  );
@@ -1205,6 +1294,479 @@ function sanitizeOutboundBody(body) {
1205
1294
  return next;
1206
1295
  }
1207
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
+
1208
1770
  // packages/ai/tools/stripModelConfirmationFlags.ts
1209
1771
  var CONFIRMATION_INPUT_KEYS = {
1210
1772
  knowledge_capture_requires_confirmation: "__confirmedKnowledgeCapture",
@@ -1254,6 +1816,7 @@ export {
1254
1816
  updateResponsesConversationState,
1255
1817
  isResponsesConversationStateRejection,
1256
1818
  generateRequestBody,
1819
+ reportToolExecutionErrorInBackground,
1257
1820
  CONFIRMATION_INPUT_KEYS,
1258
1821
  stripModelToolArgs,
1259
1822
  DirectApiKeyResolutionError,