nolo-cli 0.250.0-alpha.1 → 0.252.0-alpha.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 (186) hide show
  1. package/{_executeModel-F4MT6OPO.js → _executeModel-D6G3B45S.js} +51 -51
  2. package/{action-WZTKEF5H.js → action-QQOQ2LP3.js} +3 -3
  3. package/{addContentAction-MLI6GOBV.js → addContentAction-MB22YIDV.js} +6 -6
  4. package/{addDialogAgentAction-ARGQM22H.js → addDialogAgentAction-KNTBVVGY.js} +5 -5
  5. package/{agentDeleteCommand-DBCRHB4S.js → agentDeleteCommand-YCWDGJSF.js} +87 -82
  6. package/{agentEmailCommands-T4PAJ4KG.js → agentEmailCommands-DTWD5FWC.js} +87 -82
  7. package/{agentListCommands-5ULWKQ3E.js → agentListCommands-JTOONLYL.js} +233 -46
  8. package/{agentMachineCommands-65QUOCEY.js → agentMachineCommands-25X7OTLQ.js} +38 -36
  9. package/{agentProviderCommands-C5T7C5KZ.js → agentProviderCommands-QLTABYR7.js} +2 -2
  10. package/{agentPullCommand-4EQZYHU4.js → agentPullCommand-6OCNLVGC.js} +1 -1
  11. package/{agentRecordCommands-EKANS3A5.js → agentRecordCommands-SXE3WV2X.js} +86 -81
  12. package/{agentRunCommand-336PXBRJ.js → agentRunCommand-QSIED54S.js} +87 -82
  13. package/{agentRunControl-QMWTWV7C.js → agentRunControl-KNNDEEDI.js} +8 -6
  14. package/{agentRuntimeLocal-KKXJOBD3.js → agentRuntimeLocal-HVJJMB4W.js} +32 -31
  15. package/{agentSlice-FWYXP332.js → agentSlice-NBUJJVRI.js} +7 -7
  16. package/{appDeleteCommands-ERJK367V.js → appDeleteCommands-YU6TT6VN.js} +39 -37
  17. package/{appDeployCommands-LUV6QKQJ.js → appDeployCommands-4DEIX7YP.js} +39 -37
  18. package/{appDeployStatusCommands-WW7IYQD4.js → appDeployStatusCommands-3VKS6GBQ.js} +39 -37
  19. package/{appGetCommands-G7XYYSFO.js → appGetCommands-22FNNROT.js} +39 -37
  20. package/{appListCommands-4RXCIDNI.js → appListCommands-FVGMLHVU.js} +39 -37
  21. package/{authCommand-3C3RN4OU.js → authCommand-5DC3ES4Q.js} +15 -15
  22. package/{authCommands-ZMVEDCQD.js → authCommands-BLXNAUF4.js} +2 -2
  23. package/{chromeOpsCommands-NZITLHWO.js → chromeOpsCommands-AA555ANS.js} +1 -1
  24. package/{chunk-MAA42MMV.js → chunk-2FZVXOFX.js} +4 -4
  25. package/chunk-2GAUJDA5.js +594 -0
  26. package/{chunk-ESN4WNWU.js → chunk-2JHGUL5K.js} +2 -2
  27. package/{chunk-222CJNC2.js → chunk-2LANL4B5.js} +3 -3
  28. package/{chunk-W4G25PVP.js → chunk-2PB653F5.js} +196 -253
  29. package/{chunk-UF6J7NXV.js → chunk-3272HU62.js} +1 -1
  30. package/chunk-3A5NNQCN.js +64 -0
  31. package/{chunk-7IQA2VJF.js → chunk-3N3JPQBQ.js} +210 -56
  32. package/{chunk-LXKK7QFI.js → chunk-4HAOOY6G.js} +53 -23
  33. package/{chunk-ZQ6K57FJ.js → chunk-4YPH5KRA.js} +1 -1
  34. package/{chunk-ADOOL3PG.js → chunk-52M4RYVP.js} +1 -1
  35. package/{chunk-U7OMQLRE.js → chunk-5IN2NBDX.js} +9 -9
  36. package/{chunk-BAH3BAUZ.js → chunk-5QEOTC35.js} +5 -5
  37. package/{chunk-E5RYFR7E.js → chunk-5UYDG6HP.js} +19 -0
  38. package/{chunk-Z7A2ZQ5X.js → chunk-64ACTEAE.js} +1 -1
  39. package/{chunk-CTWCZKNS.js → chunk-6SOWMEAY.js} +4 -4
  40. package/{chunk-BFKJ2RS3.js → chunk-7RYODZDD.js} +1 -1
  41. package/{chunk-YWNCRUBZ.js → chunk-7XO73H5X.js} +116 -6
  42. package/{chunk-SMEX763N.js → chunk-7ZOVFB2H.js} +100 -43
  43. package/{chunk-UR4ZMRV3.js → chunk-A5F6DYP2.js} +1 -1
  44. package/{chunk-ZKMS73DK.js → chunk-A6VIMCWI.js} +3 -3
  45. package/{chunk-SX6AWTNK.js → chunk-BZLGPM5B.js} +3 -3
  46. package/{chunk-LTVEOOZL.js → chunk-CIAV4WK2.js} +14 -1
  47. package/{chunk-HZDK56EK.js → chunk-CO2NXG2J.js} +32 -10
  48. package/{chunk-OHUYN3YU.js → chunk-CYGFNMCH.js} +1 -1
  49. package/{chunk-MZVCFV3T.js → chunk-D3WOFN6N.js} +3 -3
  50. package/{chunk-VUHKG4KS.js → chunk-DNNPARJK.js} +9 -5
  51. package/{chunk-VV5IS3ES.js → chunk-DU3DJYVA.js} +5 -5
  52. package/{chunk-SPU3L3OR.js → chunk-EFM2IPZR.js} +3 -3
  53. package/{chunk-73PZD7JZ.js → chunk-EG3JTV7H.js} +2 -2
  54. package/{chunk-6ASGEP5D.js → chunk-EJQE5HB7.js} +1 -1
  55. package/{chunk-6XRPBZRS.js → chunk-EYLGAEB4.js} +0 -134
  56. package/{chunk-CD64YXRB.js → chunk-F6Q64KRV.js} +1 -1
  57. package/{chunk-TMRJGSK2.js → chunk-FRC2DNTN.js} +1 -1
  58. package/{chunk-W3HSD32M.js → chunk-FXEPZKNJ.js} +2 -2
  59. package/{chunk-I3J7HO3U.js → chunk-FZI2P64R.js} +137 -53
  60. package/{chunk-WWTSEBDF.js → chunk-GIXWVN2W.js} +1 -1
  61. package/{chunk-XHG7QROB.js → chunk-GO7UC5VH.js} +5 -5
  62. package/{chunk-RDBDHGU7.js → chunk-GVH2IP2M.js} +5 -5
  63. package/{chunk-AXZ5DDLB.js → chunk-GWS2X7TX.js} +235 -120
  64. package/{chunk-KHVTT4WW.js → chunk-HF4C5WIU.js} +81 -542
  65. package/{chunk-ATRU65OK.js → chunk-HMREADP6.js} +21 -19
  66. package/chunk-HZD5HXUO.js +405 -0
  67. package/{chunk-VHMPJGT4.js → chunk-ITCOQAHS.js} +3 -3
  68. package/{chunk-BQ4CZEVZ.js → chunk-ITMBFT35.js} +1 -1
  69. package/chunk-IVK2KT3H.js +209 -0
  70. package/{chunk-FFFKAOJN.js → chunk-JAYPSNGR.js} +1 -1
  71. package/{chunk-NEG5LYK5.js → chunk-JCQ3WCQ3.js} +3 -1
  72. package/{chunk-3IVFGQIM.js → chunk-JF5QT3YY.js} +2 -2
  73. package/{chunk-V4IYI3SB.js → chunk-JKALGWDL.js} +2 -2
  74. package/{chunk-PQ63BDV3.js → chunk-JPXACKSW.js} +9 -1
  75. package/{chunk-HS7MLR74.js → chunk-KZ4A7EIV.js} +3 -5
  76. package/{chunk-HEIIOJGN.js → chunk-LAQC5FAP.js} +4 -4
  77. package/{chunk-I3OW5RAX.js → chunk-LNIA5JVX.js} +8 -8
  78. package/{chunk-QJTZ76CP.js → chunk-LS5KAVFQ.js} +1 -0
  79. package/{chunk-W6T4FNZP.js → chunk-LUPZLKXL.js} +192 -352
  80. package/{chunk-K26XPZRB.js → chunk-LVZVSLKO.js} +29 -9
  81. package/{chunk-SHDJLJWV.js → chunk-N2ZAY2DK.js} +1 -1
  82. package/{chunk-WEZ27JA7.js → chunk-NMXGIRSG.js} +1 -1
  83. package/{chunk-MTM4LRVG.js → chunk-NNUIVAC2.js} +1 -1
  84. package/{chunk-ARFCL53U.js → chunk-NPUHKEOB.js} +4 -4
  85. package/{chunk-32WTED6G.js → chunk-O6LPLIRS.js} +94 -83
  86. package/{chunk-4IQN6FWY.js → chunk-OB4FBZXJ.js} +4 -4
  87. package/{chunk-CD2DK5JA.js → chunk-OKH74FML.js} +2 -1
  88. package/{chunk-UPOW5HTG.js → chunk-OMIXG25B.js} +2 -2
  89. package/{chunk-MYYNZG2M.js → chunk-OOV5JN25.js} +4 -4
  90. package/{chunk-AS6L5KSD.js → chunk-P4R5KXU7.js} +2 -2
  91. package/{chunk-OKKA4BCM.js → chunk-P6HMEKLL.js} +114 -56
  92. package/{chunk-VTHWBTRE.js → chunk-PENRYZ4D.js} +1 -1
  93. package/{chunk-VIYVRPMJ.js → chunk-PHREU2KZ.js} +5 -3
  94. package/{chunk-EDT65EUE.js → chunk-PIVTQRX6.js} +45 -15
  95. package/{chunk-KJDN2YRH.js → chunk-QMKWSKWA.js} +4 -4
  96. package/{chunk-6TVYUQRM.js → chunk-QV32GSVO.js} +2 -2
  97. package/{chunk-K7VIXYTZ.js → chunk-R3MV2GII.js} +1 -45
  98. package/{chunk-XJSEST7D.js → chunk-SMCKJJXI.js} +2 -2
  99. package/{chunk-JFRJEPFI.js → chunk-SMZFWEMX.js} +1 -1
  100. package/{chunk-KK3FCYZM.js → chunk-SQL7YNED.js} +7 -4
  101. package/{chunk-D25ONVOH.js → chunk-SSZHE2RK.js} +1 -1
  102. package/{chunk-OLGFIQN2.js → chunk-T4VVQHSE.js} +1 -1
  103. package/{chunk-6QL3SUEK.js → chunk-TDI7ARZO.js} +3 -3
  104. package/{chunk-X6LYQDN5.js → chunk-TDLZA6LJ.js} +13 -10
  105. package/chunk-TRRXYFTR.js +46 -0
  106. package/{chunk-WMKA2DPK.js → chunk-TTUIM3PJ.js} +4 -4
  107. package/{chunk-RHBD22LV.js → chunk-TTWNTFTO.js} +39 -4
  108. package/{chunk-ZM5AZTQG.js → chunk-U7BP25PE.js} +18 -6
  109. package/{chunk-X3OZ655T.js → chunk-UI3Z3HDK.js} +1 -1
  110. package/{chunk-GX6DITLQ.js → chunk-UUCYUN6Y.js} +1 -1
  111. package/{chunk-BVEDT6DM.js → chunk-VH7AQEEF.js} +3 -3
  112. package/{chunk-PGDM7AM2.js → chunk-WAOHK3NJ.js} +9 -9
  113. package/{chunk-2FK2KZSL.js → chunk-WLHUANWZ.js} +1 -1
  114. package/{chunk-ZTWDSOXD.js → chunk-WNIBQBOR.js} +1 -1
  115. package/{chunk-SLUZ6FBJ.js → chunk-XBCADGK2.js} +1 -1
  116. package/chunk-XRGBJHZX.js +136 -0
  117. package/{chunk-6XVPMGXK.js → chunk-YB5D2GK4.js} +9 -3
  118. package/{chunk-AKWA6PCE.js → chunk-YQYYYATY.js} +45 -27
  119. package/{chunk-WQDTSK5U.js → chunk-ZMFA2TLE.js} +1 -1
  120. package/{chunk-CFDOIIOZ.js → chunk-ZMXO5G3E.js} +29 -23
  121. package/{chunk-YQO5UKHP.js → chunk-ZNOXY73P.js} +632 -124
  122. package/{cliAgentConfigHelpers-37ZNEY5Y.js → cliAgentConfigHelpers-FKBPFPKR.js} +7 -7
  123. package/{cliAuthorityBrokerClient-SFPC3WVK.js → cliAuthorityBrokerClient-TFNXJLXL.js} +1 -1
  124. package/cliAuthorityBrokerProcess-IUCB4XA6.js +22 -0
  125. package/{cliLocalAgentRecordReader-R4CLUHYO.js → cliLocalAgentRecordReader-DWU3LBO2.js} +36 -35
  126. package/{commandRegistry-UIZRI4JV.js → commandRegistry-7FVATZS2.js} +74 -74
  127. package/{contentThunks-ZQSZA4GH.js → contentThunks-25XCB7VY.js} +20 -20
  128. package/{cooldownCommands-TIFCHCUN.js → cooldownCommands-PT5L4LNB.js} +3 -3
  129. package/{createAgentAutomationAction-RQE4F6PR.js → createAgentAutomationAction-FC5RI2LW.js} +20 -20
  130. package/{createDialogAction-JDSMQ34U.js → createDialogAction-IL3ISSQQ.js} +21 -21
  131. package/{createPageAction-VLF6XCYO.js → createPageAction-RVYBEYZV.js} +23 -23
  132. package/{db-CMUTP3W5.js → db-JMGVD4TB.js} +4 -2
  133. package/{dbSlice-656PMWR2.js → dbSlice-WG3ZG6PZ.js} +5 -5
  134. package/{deleteFile-ZCQESEEQ.js → deleteFile-4TIG54YN.js} +3 -3
  135. package/{dialogCommands-PLM7ZFWH.js → dialogCommands-VUJISJZF.js} +48 -42
  136. package/{dialogNotifyCommand-PST75COP.js → dialogNotifyCommand-JKYVSR6K.js} +8 -8
  137. package/{dialogSlice-63DD2ER2.js → dialogSlice-UMP55UAW.js} +18 -18
  138. package/{dialogUsageCommand-6RW2FY6K.js → dialogUsageCommand-IHAXS7DW.js} +5 -5
  139. package/{docCreateCommands-BST5DO7L.js → docCreateCommands-S46F6GKP.js} +38 -36
  140. package/{docDeleteCommands-YE6G2SO4.js → docDeleteCommands-LJG4NK6J.js} +39 -37
  141. package/{docReadCommands-M6T35U3G.js → docReadCommands-YPAYGHNM.js} +38 -36
  142. package/{docStore-7QNJWRJ2.js → docStore-VK3MVJ5Q.js} +6 -6
  143. package/{docUpdateCommands-6DFWGPVG.js → docUpdateCommands-MPTM6267.js} +38 -36
  144. package/{getPricing-FCHYVRJU.js → getPricing-5BLZRPTM.js} +3 -3
  145. package/{handleSendMessageAction-FCEFFAV4.js → handleSendMessageAction-VPKVNKBU.js} +83 -41
  146. package/{hostCredentialCreate-YEWCAMZN.js → hostCredentialCreate-K56HWPNY.js} +86 -81
  147. package/index.js +23 -11
  148. package/{localDialogRead-CIOTQM5T.js → localDialogRead-NXILOV3T.js} +1 -1
  149. package/{localRuntimeAdapter-Z22ZOZRY.js → localRuntimeAdapter-KVU72FWT.js} +84 -79
  150. package/{localRuntimeAuthority-TYHQCTZN.js → localRuntimeAuthority-QKWTPBQQ.js} +13 -3
  151. package/{localRuntimeDb-BO7IVWAZ.js → localRuntimeDb-3CIC4SKC.js} +1 -1
  152. package/{machineCommands-PT5OJ36V.js → machineCommands-C3O5RKNJ.js} +85 -80
  153. package/{machineWsRunDispatch-DQVNBSVE.js → machineWsRunDispatch-ZLART7ZA.js} +85 -80
  154. package/{markdownToSlate-KIYM7B3P.js → markdownToSlate-PXYAIBVL.js} +1 -1
  155. package/{mcpLocalAuthorizeCommand-GO6AYT63.js → mcpLocalAuthorizeCommand-LO7E4VQ5.js} +15 -11
  156. package/{memberThunks-JFYC4Z5L.js → memberThunks-7DNR6DRD.js} +7 -7
  157. package/{models-EP7VG6N2.js → models-ZX2BYIMB.js} +2 -2
  158. package/package.json +2 -1
  159. package/{projectArchive-4XUC5SLF.js → projectArchive-UBJFYRL7.js} +23 -23
  160. package/{providerPresetApply-4H7YP5D7.js → providerPresetApply-NTJUINI6.js} +35 -16
  161. package/{providerRegistry-F3UPOTIY.js → providerRegistry-W45SLUV6.js} +5 -5
  162. package/{read-BRZHXUJ6.js → read-Z2JOK6F6.js} +3 -3
  163. package/{readDocTool-N7RVFQEE.js → readDocTool-3QYSVWBT.js} +1 -1
  164. package/{readlineWorkspace-7U5QM3OM.js → readlineWorkspace-TSIYF7C6.js} +655 -248
  165. package/{removeDialogAgentAction-J7XU7OUX.js → removeDialogAgentAction-LRKDU4RI.js} +7 -7
  166. package/{runAgentClientLoop-7D7UCAS2.js → runAgentClientLoop-YAHGOWXN.js} +48 -48
  167. package/{runtimeDoctorCommands-RDRJXMXC.js → runtimeDoctorCommands-QGZSKNSE.js} +14 -11
  168. package/{secretCommands-2FEMRUFM.js → secretCommands-BXAQEOES.js} +2 -2
  169. package/{setDialogExtraReferencesAction-Q4V2ZZW2.js → setDialogExtraReferencesAction-KIITOCFP.js} +6 -6
  170. package/{setPrimaryDialogAgentAction-742H5S6T.js → setPrimaryDialogAgentAction-Y36PKFFB.js} +7 -7
  171. package/{settingThunks-IHXUF276.js → settingThunks-YQNG5L6K.js} +5 -5
  172. package/{spaceCommands-WCLD36WH.js → spaceCommands-P644AAZZ.js} +37 -35
  173. package/{streamAgentChatTurn-DVTOINT3.js → streamAgentChatTurn-5CSYAUAY.js} +81 -77
  174. package/{switchDialogAgentAction-HLDLHRRA.js → switchDialogAgentAction-U2VLPPVO.js} +5 -5
  175. package/{tools-BOPINT5S.js → tools-UZ3CDIR2.js} +38 -38
  176. package/{tuiRestart-5F2APN66.js → tuiRestart-GF4DGAAN.js} +7 -7
  177. package/{tuiSummaryLlmCaller-TM5BU73J.js → tuiSummaryLlmCaller-HROLGN4F.js} +13 -13
  178. package/{updateCommands-FBYA5WVG.js → updateCommands-BZ4YDHNM.js} +3 -3
  179. package/{updateDialogTitleAction-S76PUCLQ.js → updateDialogTitleAction-53XCCDK2.js} +20 -20
  180. package/{usageCommand-L4OFWXEU.js → usageCommand-XVJ7ZUTM.js} +2 -2
  181. package/{usageRebuildCommand-7JR33UHS.js → usageRebuildCommand-NK6S3D4J.js} +3 -3
  182. package/{windowsSelfUpdate-M4V77OUB.js → windowsSelfUpdate-4BAXX7C3.js} +2 -2
  183. package/{workloadLifecycle-ZCSQCHG3.js → workloadLifecycle-DYX5ZMAT.js} +2 -2
  184. package/chunk-FGHEF6WI.js +0 -34
  185. package/{chunk-ANUP75N2.js → chunk-2E4BYAUE.js} +0 -0
  186. package/{chunk-CDIRKCPD.js → chunk-6HL6E7ZD.js} +152 -152
@@ -1,26 +1,42 @@
1
1
  import {
2
2
  toolRegistry
3
- } from "./chunk-7IQA2VJF.js";
3
+ } from "./chunk-3N3JPQBQ.js";
4
4
  import {
5
+ INLINE_IMAGE_MAX_BYTES,
6
+ INLINE_IMAGE_TOTAL_MAX_BYTES,
5
7
  runtime_default
6
- } from "./chunk-YQO5UKHP.js";
8
+ } from "./chunk-ZNOXY73P.js";
7
9
  import {
8
10
  canonicalizeToolNames
9
11
  } from "./chunk-YLAHYLDQ.js";
12
+ import {
13
+ API_ENDPOINTS,
14
+ NOLO_CLUSTER_SERVERS
15
+ } from "./chunk-LCBAMY2M.js";
10
16
  import {
11
17
  isRecord
12
18
  } from "./chunk-KUG52IAP.js";
13
19
  import {
14
20
  isNoloHostedProvider
15
- } from "./chunk-PQ63BDV3.js";
21
+ } from "./chunk-JPXACKSW.js";
16
22
  import {
17
23
  asTrimmedLowercaseString
18
24
  } from "./chunk-QSJ3HFEF.js";
19
25
 
20
26
  // packages/ai/chat/inlineImageUrlsForCustomProvider.ts
21
- var INLINE_IMAGE_MAX_BYTES = 5 * 1024 * 1024;
22
- var INLINE_IMAGE_TOTAL_MAX_BYTES = 20 * 1024 * 1024;
23
- var FILE_CONTENT_PATH = "/api/v1/db/file/content/";
27
+ var FILE_CONTENT_PATH = `${API_ENDPOINTS.DATABASE}/file/content/`;
28
+ function trustedInlineFile(url, serverUrl, pageOrigin) {
29
+ try {
30
+ const source = new URL(url, pageOrigin ?? serverUrl);
31
+ const originOf = (base) => base ? new URL(base).origin : void 0;
32
+ if (!/^https?:$/.test(source.protocol) || source.username || source.password || !(source.origin === originOf(serverUrl) || source.origin === originOf(pageOrigin) || NOLO_CLUSTER_SERVERS.some((origin) => origin === source.origin))) return null;
33
+ const id = source.pathname.startsWith(FILE_CONTENT_PATH) ? source.pathname.slice(FILE_CONTENT_PATH.length) : "";
34
+ if (!/^[A-Za-z0-9._~-]{1,256}$/.test(id) || id === "." || id === "..") return null;
35
+ return { origin: source.origin, id, spaceId: source.searchParams.get("spaceId") };
36
+ } catch {
37
+ return null;
38
+ }
39
+ }
24
40
  var shouldInlineImageUrlsForAgent = (agentConfig) => {
25
41
  const apiSource = agentConfig?.apiSource?.toLowerCase();
26
42
  const provider = agentConfig?.provider?.toLowerCase();
@@ -29,7 +45,15 @@ var shouldInlineImageUrlsForAgent = (agentConfig) => {
29
45
  if (isNoloHostedProvider(provider)) return true;
30
46
  return provider === "openrouter" && model === "minimax/minimax-m3";
31
47
  };
32
- var isInlineCandidate = (url) => /^https?:\/\//i.test(url) && url.includes(FILE_CONTENT_PATH);
48
+ var isInlineCandidate = (url) => {
49
+ if (/^data:/i.test(url)) return false;
50
+ if (url.includes(FILE_CONTENT_PATH)) return true;
51
+ try {
52
+ return new URL(url, "https://relative.invalid").pathname.startsWith(FILE_CONTENT_PATH);
53
+ } catch {
54
+ return false;
55
+ }
56
+ };
33
57
  var bytesToBase64 = (bytes) => {
34
58
  const chunks = [];
35
59
  for (let offset = 0; offset < bytes.length; offset += 32768) {
@@ -37,84 +61,144 @@ var bytesToBase64 = (bytes) => {
37
61
  }
38
62
  return btoa(chunks.join(""));
39
63
  };
40
- var defaultFetchImage = async (url, signal, _maxBytes) => {
41
- const response = await fetch(url, { signal });
42
- if (!response.ok) {
43
- return {
44
- ok: false,
45
- error: `HTTP ${response.status}`
46
- };
64
+ async function readBoundedInlineImage(response, maxBytes) {
65
+ const declaredSize = Number(response.headers.get("content-length"));
66
+ if (!response.ok || !response.body || declaredSize > maxBytes) {
67
+ await response.body?.cancel();
68
+ return declaredSize > maxBytes ? { ok: false, skippedSize: declaredSize } : { ok: false };
47
69
  }
48
- const bytes = new Uint8Array(await response.arrayBuffer());
49
- return {
50
- ok: true,
51
- mimeType: response.headers.get("content-type") ?? "application/octet-stream",
52
- bytes
70
+ const reader = response.body.getReader();
71
+ const chunks = [];
72
+ let size = 0;
73
+ for (; ; ) {
74
+ const { value, done } = await reader.read();
75
+ if (done) break;
76
+ size += value.byteLength;
77
+ if (size > maxBytes) {
78
+ await reader.cancel();
79
+ return { ok: false, skippedSize: size };
80
+ }
81
+ chunks.push(value);
82
+ }
83
+ const bytes = new Uint8Array(size);
84
+ let offset = 0;
85
+ for (const chunk of chunks) {
86
+ bytes.set(chunk, offset);
87
+ offset += chunk.byteLength;
88
+ }
89
+ return { ok: true, bytes, mimeType: response.headers.get("content-type") ?? void 0 };
90
+ }
91
+ function publicImageFetcher(options) {
92
+ const timeout = AbortSignal.timeout(5e3);
93
+ const request = options.request ?? fetch;
94
+ const pageOrigin = typeof window === "undefined" ? void 0 : window.location?.origin;
95
+ return async (url, signal, maxBytes = INLINE_IMAGE_MAX_BYTES) => {
96
+ try {
97
+ const file = trustedInlineFile(url, options.serverUrl, pageOrigin);
98
+ if (!file) return { ok: false };
99
+ const init = {
100
+ credentials: "omit",
101
+ redirect: "error",
102
+ cache: "no-store",
103
+ signal: signal ? AbortSignal.any([signal, timeout]) : timeout
104
+ };
105
+ const base = `${file.origin}${API_ENDPOINTS.DATABASE}/file`;
106
+ const proof = await request(`${base}/public/${file.id}`, init);
107
+ if (!proof.ok || (await proof.json())?.public !== true) {
108
+ if (!proof.bodyUsed) await proof.body?.cancel();
109
+ return { ok: false };
110
+ }
111
+ return await readBoundedInlineImage(await request(`${base}/public-content/${file.id}?maxBytes=${maxBytes}`, init), maxBytes);
112
+ } catch {
113
+ signal?.throwIfAborted();
114
+ return { ok: false };
115
+ }
53
116
  };
54
- };
117
+ }
55
118
  var cloneImagePartWithDataUrl = async (part, fetchImage, options, usedBytes) => {
56
- const url = part?.image_url?.url;
57
- if (typeof url !== "string" || !isInlineCandidate(url) || options.isAllowedImageUrl && !options.isAllowedImageUrl(url)) return part;
119
+ const native = part?.type === "input_image";
120
+ const url = native && typeof part.image_url === "string" ? part.image_url : part?.image_url?.url;
121
+ const unavailable = { type: native ? "input_text" : "text", text: "[Image unavailable]" };
122
+ if (typeof url !== "string" || !isInlineCandidate(url)) return part;
58
123
  if (options.signal?.aborted) throw new DOMException("The operation was aborted", "AbortError");
59
124
  const remaining = options.maxTotalBytes === void 0 ? void 0 : options.maxTotalBytes - usedBytes.value;
125
+ if (remaining !== void 0 && remaining <= 0) {
126
+ options.onSkipTooLarge?.(url, void 0, "total-budget");
127
+ return unavailable;
128
+ }
60
129
  const fetchLimit = options.maxBytes === void 0 ? remaining : remaining === void 0 ? options.maxBytes : Math.min(options.maxBytes, remaining);
61
- const result = await fetchImage(url, options.signal, fetchLimit);
130
+ const result = await fetchImage(url, options.signal, fetchLimit).catch(() => {
131
+ options.signal?.throwIfAborted();
132
+ return { ok: false };
133
+ });
62
134
  if (options.signal?.aborted) throw new DOMException("The operation was aborted", "AbortError");
63
135
  if (result.skippedSize !== void 0) {
64
136
  const reason = options.maxBytes !== void 0 && result.skippedSize > options.maxBytes ? "per-image" : "total-budget";
65
137
  options.onSkipTooLarge?.(url, result.skippedSize, reason);
66
- return part;
138
+ return unavailable;
67
139
  }
68
- if (!result.ok || !result.bytes) return part;
140
+ if (!result.ok || !result.bytes) return unavailable;
69
141
  if (options.maxBytes !== void 0 && result.bytes.byteLength > options.maxBytes) {
70
142
  options.onSkipTooLarge?.(url, result.bytes.byteLength, "per-image");
71
- return part;
143
+ return unavailable;
72
144
  }
73
145
  if (options.maxTotalBytes !== void 0 && usedBytes.value + result.bytes.byteLength > options.maxTotalBytes) {
74
146
  options.onSkipTooLarge?.(url, result.bytes.byteLength, "total-budget");
75
- return part;
147
+ return unavailable;
76
148
  }
77
149
  usedBytes.value += result.bytes.byteLength;
78
150
  const mimeType = (result.mimeType || "application/octet-stream").split(";")[0].trim() || "application/octet-stream";
79
- return { ...part, image_url: { ...part.image_url, url: `data:${mimeType};base64,${bytesToBase64(result.bytes)}` } };
151
+ const dataUrl = `data:${mimeType};base64,${bytesToBase64(result.bytes)}`;
152
+ return { ...part, image_url: native ? dataUrl : { ...part.image_url, url: dataUrl } };
80
153
  };
81
154
  var inlineImageUrlsForCustomProvider = async (bodyData, options) => {
82
155
  if (!options.shouldInline) return bodyData;
83
156
  const body = bodyData;
84
- if (!Array.isArray(body?.messages)) return bodyData;
85
- const fetchImage = options.fetchImage ?? defaultFetchImage;
157
+ if (!Array.isArray(body?.messages) && !Array.isArray(body?.input)) return bodyData;
158
+ options = {
159
+ ...options,
160
+ maxBytes: Math.min(options.maxBytes ?? INLINE_IMAGE_MAX_BYTES, INLINE_IMAGE_MAX_BYTES),
161
+ maxTotalBytes: Math.min(options.maxTotalBytes ?? INLINE_IMAGE_TOTAL_MAX_BYTES, INLINE_IMAGE_TOTAL_MAX_BYTES)
162
+ };
163
+ const fetchImage = options.fetchImage ?? publicImageFetcher(options);
86
164
  const fetched = /* @__PURE__ */ new Map();
87
165
  const fetchOnce = (url, signal, maxBytes) => {
88
- let result = fetched.get(url);
89
- if (!result) {
90
- result = fetchImage(url, signal, maxBytes);
91
- fetched.set(url, result);
166
+ let result2 = fetched.get(url);
167
+ if (!result2) {
168
+ result2 = fetchImage(url, signal, maxBytes);
169
+ fetched.set(url, result2);
92
170
  }
93
- return result;
171
+ return result2;
94
172
  };
95
173
  const usedBytes = { value: 0 };
96
- let changed = false;
97
- const messages = [...body.messages];
98
- for (let mi = messages.length - 1; mi >= 0; mi--) {
99
- const message = messages[mi];
100
- if (!Array.isArray(message?.content)) continue;
101
- const content = [...message.content];
102
- for (let pi = content.length - 1; pi >= 0; pi--) {
103
- const part = content[pi];
104
- if (part?.type !== "image_url") continue;
105
- if (options.maxTotalBytes !== void 0 && usedBytes.value >= options.maxTotalBytes) {
106
- if (typeof part?.image_url?.url === "string" && isInlineCandidate(part.image_url.url)) options.onSkipTooLarge?.(part.image_url.url, void 0, "total-budget");
107
- continue;
174
+ const rewrite = async (items, imageType) => {
175
+ let output = items;
176
+ for (let i = items.length - 1; i >= 0; i--) {
177
+ const item = items[i];
178
+ let next = item;
179
+ if (item?.type === imageType) next = await cloneImagePartWithDataUrl(item, fetchOnce, options, usedBytes);
180
+ else if (Array.isArray(item?.content)) {
181
+ const content = await rewrite(item.content, imageType);
182
+ if (content !== item.content) next = { ...item, content };
108
183
  }
109
- const cloned = await cloneImagePartWithDataUrl(part, fetchOnce, options, usedBytes);
110
- if (cloned !== part) {
111
- content[pi] = cloned;
112
- changed = true;
184
+ if (imageType === "input_image" && item?.type === "function_call_output" && Array.isArray(item.output)) {
185
+ const outputItems = await rewrite(item.output, imageType);
186
+ if (outputItems !== item.output) next = { ...next, output: outputItems };
187
+ }
188
+ if (next !== item) {
189
+ if (output === items) output = [...items];
190
+ output[i] = next;
113
191
  }
114
192
  }
115
- if (content.some((part, index) => part !== message.content[index])) messages[mi] = { ...message, content };
193
+ return output;
194
+ };
195
+ let result = body;
196
+ for (const [key, imageType] of [["messages", "image_url"], ["input", "input_image"]]) {
197
+ if (!Array.isArray(body[key])) continue;
198
+ const items = await rewrite(body[key], imageType);
199
+ if (items !== body[key]) result = { ...result, [key]: items };
116
200
  }
117
- return changed ? { ...body, messages } : bodyData;
201
+ return result;
118
202
  };
119
203
 
120
204
  // packages/ai/tools/toolSchemaCompatibility.ts
@@ -2,7 +2,7 @@ import {
2
2
  mergeAvailabilityDeadline,
3
3
  resolveCredentialCandidateKeys,
4
4
  resolveCredentialKeyWithFallback
5
- } from "./chunk-QJTZ76CP.js";
5
+ } from "./chunk-LS5KAVFQ.js";
6
6
 
7
7
  // packages/agent-runtime/credentialAvailability.ts
8
8
  import { homedir } from "node:os";
@@ -2,26 +2,26 @@ import {
2
2
  clipMultilineText,
3
3
  fetchAndSerializeTable,
4
4
  waitForAbortableDelay
5
- } from "./chunk-PGDM7AM2.js";
5
+ } from "./chunk-WAOHK3NJ.js";
6
6
  import {
7
7
  isGatewayHttpStatus
8
8
  } from "./chunk-NF64D32W.js";
9
9
  import {
10
10
  resolvePageReadMarkdown,
11
11
  slateToSimplifiedMarkdown
12
- } from "./chunk-CD64YXRB.js";
12
+ } from "./chunk-F6Q64KRV.js";
13
13
  import {
14
14
  extractCategorizedMentions
15
15
  } from "./chunk-AGIM7IMJ.js";
16
16
  import {
17
17
  fetchAndCacheMessages
18
- } from "./chunk-YQO5UKHP.js";
18
+ } from "./chunk-ZNOXY73P.js";
19
19
  import {
20
20
  createSpaceKey
21
21
  } from "./chunk-UAD2WT54.js";
22
22
  import {
23
23
  read
24
- } from "./chunk-HZDK56EK.js";
24
+ } from "./chunk-CO2NXG2J.js";
25
25
  import {
26
26
  createDrainExhaustedResponse,
27
27
  isCoreDrainingBody,
@@ -30,7 +30,7 @@ import {
30
30
  } from "./chunk-3L2WKC3W.js";
31
31
  import {
32
32
  getRuntimeServerContext
33
- } from "./chunk-WQDTSK5U.js";
33
+ } from "./chunk-ZMFA2TLE.js";
34
34
  import {
35
35
  classifyGenerationError
36
36
  } from "./chunk-TLE77UJ5.js";
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk-P27E22MA.js";
4
4
  import {
5
5
  getReadableCliDb
6
- } from "./chunk-D25ONVOH.js";
6
+ } from "./chunk-SSZHE2RK.js";
7
7
  import {
8
8
  clearCliLocalRuntimePreparedAgentCache
9
- } from "./chunk-AXZ5DDLB.js";
9
+ } from "./chunk-GWS2X7TX.js";
10
10
  import {
11
11
  readCredentialAvailability
12
- } from "./chunk-WWTSEBDF.js";
12
+ } from "./chunk-GIXWVN2W.js";
13
13
  import {
14
14
  BIGMODEL_PROVIDER_TARGET,
15
15
  buildCredentialUseGrant,
@@ -25,7 +25,7 @@ import {
25
25
  resolveAgentRecordFromHybridStore,
26
26
  sanitizeAgentRecordForCliOutput,
27
27
  writeAgentRecord
28
- } from "./chunk-KJDN2YRH.js";
28
+ } from "./chunk-QMKWSKWA.js";
29
29
  import {
30
30
  resolveCliAgentKeyInput
31
31
  } from "./chunk-BR3GT6MR.js";
@@ -256,7 +256,7 @@ async function runAgentCreateCommand(args, deps = {}) {
256
256
  let verifyResult;
257
257
  if (parsed.verify) {
258
258
  try {
259
- const { verifyCustomProvider } = await import("./agentProviderCommands-C5T7C5KZ.js");
259
+ const { verifyCustomProvider } = await import("./agentProviderCommands-QLTABYR7.js");
260
260
  const rec = built.nextRecord;
261
261
  const verifyCredentialRef = typeof rec.credentialRef === "string" && rec.credentialRef.trim() ? rec.credentialRef.trim() : "";
262
262
  if (verifyCredentialRef) {