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.
- package/{_executeModel-F4MT6OPO.js → _executeModel-D6G3B45S.js} +51 -51
- package/{action-WZTKEF5H.js → action-QQOQ2LP3.js} +3 -3
- package/{addContentAction-MLI6GOBV.js → addContentAction-MB22YIDV.js} +6 -6
- package/{addDialogAgentAction-ARGQM22H.js → addDialogAgentAction-KNTBVVGY.js} +5 -5
- package/{agentDeleteCommand-DBCRHB4S.js → agentDeleteCommand-YCWDGJSF.js} +87 -82
- package/{agentEmailCommands-T4PAJ4KG.js → agentEmailCommands-DTWD5FWC.js} +87 -82
- package/{agentListCommands-5ULWKQ3E.js → agentListCommands-JTOONLYL.js} +233 -46
- package/{agentMachineCommands-65QUOCEY.js → agentMachineCommands-25X7OTLQ.js} +38 -36
- package/{agentProviderCommands-C5T7C5KZ.js → agentProviderCommands-QLTABYR7.js} +2 -2
- package/{agentPullCommand-4EQZYHU4.js → agentPullCommand-6OCNLVGC.js} +1 -1
- package/{agentRecordCommands-EKANS3A5.js → agentRecordCommands-SXE3WV2X.js} +86 -81
- package/{agentRunCommand-336PXBRJ.js → agentRunCommand-QSIED54S.js} +87 -82
- package/{agentRunControl-QMWTWV7C.js → agentRunControl-KNNDEEDI.js} +8 -6
- package/{agentRuntimeLocal-KKXJOBD3.js → agentRuntimeLocal-HVJJMB4W.js} +32 -31
- package/{agentSlice-FWYXP332.js → agentSlice-NBUJJVRI.js} +7 -7
- package/{appDeleteCommands-ERJK367V.js → appDeleteCommands-YU6TT6VN.js} +39 -37
- package/{appDeployCommands-LUV6QKQJ.js → appDeployCommands-4DEIX7YP.js} +39 -37
- package/{appDeployStatusCommands-WW7IYQD4.js → appDeployStatusCommands-3VKS6GBQ.js} +39 -37
- package/{appGetCommands-G7XYYSFO.js → appGetCommands-22FNNROT.js} +39 -37
- package/{appListCommands-4RXCIDNI.js → appListCommands-FVGMLHVU.js} +39 -37
- package/{authCommand-3C3RN4OU.js → authCommand-5DC3ES4Q.js} +15 -15
- package/{authCommands-ZMVEDCQD.js → authCommands-BLXNAUF4.js} +2 -2
- package/{chromeOpsCommands-NZITLHWO.js → chromeOpsCommands-AA555ANS.js} +1 -1
- package/{chunk-MAA42MMV.js → chunk-2FZVXOFX.js} +4 -4
- package/chunk-2GAUJDA5.js +594 -0
- package/{chunk-ESN4WNWU.js → chunk-2JHGUL5K.js} +2 -2
- package/{chunk-222CJNC2.js → chunk-2LANL4B5.js} +3 -3
- package/{chunk-W4G25PVP.js → chunk-2PB653F5.js} +196 -253
- package/{chunk-UF6J7NXV.js → chunk-3272HU62.js} +1 -1
- package/chunk-3A5NNQCN.js +64 -0
- package/{chunk-7IQA2VJF.js → chunk-3N3JPQBQ.js} +210 -56
- package/{chunk-LXKK7QFI.js → chunk-4HAOOY6G.js} +53 -23
- package/{chunk-ZQ6K57FJ.js → chunk-4YPH5KRA.js} +1 -1
- package/{chunk-ADOOL3PG.js → chunk-52M4RYVP.js} +1 -1
- package/{chunk-U7OMQLRE.js → chunk-5IN2NBDX.js} +9 -9
- package/{chunk-BAH3BAUZ.js → chunk-5QEOTC35.js} +5 -5
- package/{chunk-E5RYFR7E.js → chunk-5UYDG6HP.js} +19 -0
- package/{chunk-Z7A2ZQ5X.js → chunk-64ACTEAE.js} +1 -1
- package/{chunk-CTWCZKNS.js → chunk-6SOWMEAY.js} +4 -4
- package/{chunk-BFKJ2RS3.js → chunk-7RYODZDD.js} +1 -1
- package/{chunk-YWNCRUBZ.js → chunk-7XO73H5X.js} +116 -6
- package/{chunk-SMEX763N.js → chunk-7ZOVFB2H.js} +100 -43
- package/{chunk-UR4ZMRV3.js → chunk-A5F6DYP2.js} +1 -1
- package/{chunk-ZKMS73DK.js → chunk-A6VIMCWI.js} +3 -3
- package/{chunk-SX6AWTNK.js → chunk-BZLGPM5B.js} +3 -3
- package/{chunk-LTVEOOZL.js → chunk-CIAV4WK2.js} +14 -1
- package/{chunk-HZDK56EK.js → chunk-CO2NXG2J.js} +32 -10
- package/{chunk-OHUYN3YU.js → chunk-CYGFNMCH.js} +1 -1
- package/{chunk-MZVCFV3T.js → chunk-D3WOFN6N.js} +3 -3
- package/{chunk-VUHKG4KS.js → chunk-DNNPARJK.js} +9 -5
- package/{chunk-VV5IS3ES.js → chunk-DU3DJYVA.js} +5 -5
- package/{chunk-SPU3L3OR.js → chunk-EFM2IPZR.js} +3 -3
- package/{chunk-73PZD7JZ.js → chunk-EG3JTV7H.js} +2 -2
- package/{chunk-6ASGEP5D.js → chunk-EJQE5HB7.js} +1 -1
- package/{chunk-6XRPBZRS.js → chunk-EYLGAEB4.js} +0 -134
- package/{chunk-CD64YXRB.js → chunk-F6Q64KRV.js} +1 -1
- package/{chunk-TMRJGSK2.js → chunk-FRC2DNTN.js} +1 -1
- package/{chunk-W3HSD32M.js → chunk-FXEPZKNJ.js} +2 -2
- package/{chunk-I3J7HO3U.js → chunk-FZI2P64R.js} +137 -53
- package/{chunk-WWTSEBDF.js → chunk-GIXWVN2W.js} +1 -1
- package/{chunk-XHG7QROB.js → chunk-GO7UC5VH.js} +5 -5
- package/{chunk-RDBDHGU7.js → chunk-GVH2IP2M.js} +5 -5
- package/{chunk-AXZ5DDLB.js → chunk-GWS2X7TX.js} +235 -120
- package/{chunk-KHVTT4WW.js → chunk-HF4C5WIU.js} +81 -542
- package/{chunk-ATRU65OK.js → chunk-HMREADP6.js} +21 -19
- package/chunk-HZD5HXUO.js +405 -0
- package/{chunk-VHMPJGT4.js → chunk-ITCOQAHS.js} +3 -3
- package/{chunk-BQ4CZEVZ.js → chunk-ITMBFT35.js} +1 -1
- package/chunk-IVK2KT3H.js +209 -0
- package/{chunk-FFFKAOJN.js → chunk-JAYPSNGR.js} +1 -1
- package/{chunk-NEG5LYK5.js → chunk-JCQ3WCQ3.js} +3 -1
- package/{chunk-3IVFGQIM.js → chunk-JF5QT3YY.js} +2 -2
- package/{chunk-V4IYI3SB.js → chunk-JKALGWDL.js} +2 -2
- package/{chunk-PQ63BDV3.js → chunk-JPXACKSW.js} +9 -1
- package/{chunk-HS7MLR74.js → chunk-KZ4A7EIV.js} +3 -5
- package/{chunk-HEIIOJGN.js → chunk-LAQC5FAP.js} +4 -4
- package/{chunk-I3OW5RAX.js → chunk-LNIA5JVX.js} +8 -8
- package/{chunk-QJTZ76CP.js → chunk-LS5KAVFQ.js} +1 -0
- package/{chunk-W6T4FNZP.js → chunk-LUPZLKXL.js} +192 -352
- package/{chunk-K26XPZRB.js → chunk-LVZVSLKO.js} +29 -9
- package/{chunk-SHDJLJWV.js → chunk-N2ZAY2DK.js} +1 -1
- package/{chunk-WEZ27JA7.js → chunk-NMXGIRSG.js} +1 -1
- package/{chunk-MTM4LRVG.js → chunk-NNUIVAC2.js} +1 -1
- package/{chunk-ARFCL53U.js → chunk-NPUHKEOB.js} +4 -4
- package/{chunk-32WTED6G.js → chunk-O6LPLIRS.js} +94 -83
- package/{chunk-4IQN6FWY.js → chunk-OB4FBZXJ.js} +4 -4
- package/{chunk-CD2DK5JA.js → chunk-OKH74FML.js} +2 -1
- package/{chunk-UPOW5HTG.js → chunk-OMIXG25B.js} +2 -2
- package/{chunk-MYYNZG2M.js → chunk-OOV5JN25.js} +4 -4
- package/{chunk-AS6L5KSD.js → chunk-P4R5KXU7.js} +2 -2
- package/{chunk-OKKA4BCM.js → chunk-P6HMEKLL.js} +114 -56
- package/{chunk-VTHWBTRE.js → chunk-PENRYZ4D.js} +1 -1
- package/{chunk-VIYVRPMJ.js → chunk-PHREU2KZ.js} +5 -3
- package/{chunk-EDT65EUE.js → chunk-PIVTQRX6.js} +45 -15
- package/{chunk-KJDN2YRH.js → chunk-QMKWSKWA.js} +4 -4
- package/{chunk-6TVYUQRM.js → chunk-QV32GSVO.js} +2 -2
- package/{chunk-K7VIXYTZ.js → chunk-R3MV2GII.js} +1 -45
- package/{chunk-XJSEST7D.js → chunk-SMCKJJXI.js} +2 -2
- package/{chunk-JFRJEPFI.js → chunk-SMZFWEMX.js} +1 -1
- package/{chunk-KK3FCYZM.js → chunk-SQL7YNED.js} +7 -4
- package/{chunk-D25ONVOH.js → chunk-SSZHE2RK.js} +1 -1
- package/{chunk-OLGFIQN2.js → chunk-T4VVQHSE.js} +1 -1
- package/{chunk-6QL3SUEK.js → chunk-TDI7ARZO.js} +3 -3
- package/{chunk-X6LYQDN5.js → chunk-TDLZA6LJ.js} +13 -10
- package/chunk-TRRXYFTR.js +46 -0
- package/{chunk-WMKA2DPK.js → chunk-TTUIM3PJ.js} +4 -4
- package/{chunk-RHBD22LV.js → chunk-TTWNTFTO.js} +39 -4
- package/{chunk-ZM5AZTQG.js → chunk-U7BP25PE.js} +18 -6
- package/{chunk-X3OZ655T.js → chunk-UI3Z3HDK.js} +1 -1
- package/{chunk-GX6DITLQ.js → chunk-UUCYUN6Y.js} +1 -1
- package/{chunk-BVEDT6DM.js → chunk-VH7AQEEF.js} +3 -3
- package/{chunk-PGDM7AM2.js → chunk-WAOHK3NJ.js} +9 -9
- package/{chunk-2FK2KZSL.js → chunk-WLHUANWZ.js} +1 -1
- package/{chunk-ZTWDSOXD.js → chunk-WNIBQBOR.js} +1 -1
- package/{chunk-SLUZ6FBJ.js → chunk-XBCADGK2.js} +1 -1
- package/chunk-XRGBJHZX.js +136 -0
- package/{chunk-6XVPMGXK.js → chunk-YB5D2GK4.js} +9 -3
- package/{chunk-AKWA6PCE.js → chunk-YQYYYATY.js} +45 -27
- package/{chunk-WQDTSK5U.js → chunk-ZMFA2TLE.js} +1 -1
- package/{chunk-CFDOIIOZ.js → chunk-ZMXO5G3E.js} +29 -23
- package/{chunk-YQO5UKHP.js → chunk-ZNOXY73P.js} +632 -124
- package/{cliAgentConfigHelpers-37ZNEY5Y.js → cliAgentConfigHelpers-FKBPFPKR.js} +7 -7
- package/{cliAuthorityBrokerClient-SFPC3WVK.js → cliAuthorityBrokerClient-TFNXJLXL.js} +1 -1
- package/cliAuthorityBrokerProcess-IUCB4XA6.js +22 -0
- package/{cliLocalAgentRecordReader-R4CLUHYO.js → cliLocalAgentRecordReader-DWU3LBO2.js} +36 -35
- package/{commandRegistry-UIZRI4JV.js → commandRegistry-7FVATZS2.js} +74 -74
- package/{contentThunks-ZQSZA4GH.js → contentThunks-25XCB7VY.js} +20 -20
- package/{cooldownCommands-TIFCHCUN.js → cooldownCommands-PT5L4LNB.js} +3 -3
- package/{createAgentAutomationAction-RQE4F6PR.js → createAgentAutomationAction-FC5RI2LW.js} +20 -20
- package/{createDialogAction-JDSMQ34U.js → createDialogAction-IL3ISSQQ.js} +21 -21
- package/{createPageAction-VLF6XCYO.js → createPageAction-RVYBEYZV.js} +23 -23
- package/{db-CMUTP3W5.js → db-JMGVD4TB.js} +4 -2
- package/{dbSlice-656PMWR2.js → dbSlice-WG3ZG6PZ.js} +5 -5
- package/{deleteFile-ZCQESEEQ.js → deleteFile-4TIG54YN.js} +3 -3
- package/{dialogCommands-PLM7ZFWH.js → dialogCommands-VUJISJZF.js} +48 -42
- package/{dialogNotifyCommand-PST75COP.js → dialogNotifyCommand-JKYVSR6K.js} +8 -8
- package/{dialogSlice-63DD2ER2.js → dialogSlice-UMP55UAW.js} +18 -18
- package/{dialogUsageCommand-6RW2FY6K.js → dialogUsageCommand-IHAXS7DW.js} +5 -5
- package/{docCreateCommands-BST5DO7L.js → docCreateCommands-S46F6GKP.js} +38 -36
- package/{docDeleteCommands-YE6G2SO4.js → docDeleteCommands-LJG4NK6J.js} +39 -37
- package/{docReadCommands-M6T35U3G.js → docReadCommands-YPAYGHNM.js} +38 -36
- package/{docStore-7QNJWRJ2.js → docStore-VK3MVJ5Q.js} +6 -6
- package/{docUpdateCommands-6DFWGPVG.js → docUpdateCommands-MPTM6267.js} +38 -36
- package/{getPricing-FCHYVRJU.js → getPricing-5BLZRPTM.js} +3 -3
- package/{handleSendMessageAction-FCEFFAV4.js → handleSendMessageAction-VPKVNKBU.js} +83 -41
- package/{hostCredentialCreate-YEWCAMZN.js → hostCredentialCreate-K56HWPNY.js} +86 -81
- package/index.js +23 -11
- package/{localDialogRead-CIOTQM5T.js → localDialogRead-NXILOV3T.js} +1 -1
- package/{localRuntimeAdapter-Z22ZOZRY.js → localRuntimeAdapter-KVU72FWT.js} +84 -79
- package/{localRuntimeAuthority-TYHQCTZN.js → localRuntimeAuthority-QKWTPBQQ.js} +13 -3
- package/{localRuntimeDb-BO7IVWAZ.js → localRuntimeDb-3CIC4SKC.js} +1 -1
- package/{machineCommands-PT5OJ36V.js → machineCommands-C3O5RKNJ.js} +85 -80
- package/{machineWsRunDispatch-DQVNBSVE.js → machineWsRunDispatch-ZLART7ZA.js} +85 -80
- package/{markdownToSlate-KIYM7B3P.js → markdownToSlate-PXYAIBVL.js} +1 -1
- package/{mcpLocalAuthorizeCommand-GO6AYT63.js → mcpLocalAuthorizeCommand-LO7E4VQ5.js} +15 -11
- package/{memberThunks-JFYC4Z5L.js → memberThunks-7DNR6DRD.js} +7 -7
- package/{models-EP7VG6N2.js → models-ZX2BYIMB.js} +2 -2
- package/package.json +2 -1
- package/{projectArchive-4XUC5SLF.js → projectArchive-UBJFYRL7.js} +23 -23
- package/{providerPresetApply-4H7YP5D7.js → providerPresetApply-NTJUINI6.js} +35 -16
- package/{providerRegistry-F3UPOTIY.js → providerRegistry-W45SLUV6.js} +5 -5
- package/{read-BRZHXUJ6.js → read-Z2JOK6F6.js} +3 -3
- package/{readDocTool-N7RVFQEE.js → readDocTool-3QYSVWBT.js} +1 -1
- package/{readlineWorkspace-7U5QM3OM.js → readlineWorkspace-TSIYF7C6.js} +655 -248
- package/{removeDialogAgentAction-J7XU7OUX.js → removeDialogAgentAction-LRKDU4RI.js} +7 -7
- package/{runAgentClientLoop-7D7UCAS2.js → runAgentClientLoop-YAHGOWXN.js} +48 -48
- package/{runtimeDoctorCommands-RDRJXMXC.js → runtimeDoctorCommands-QGZSKNSE.js} +14 -11
- package/{secretCommands-2FEMRUFM.js → secretCommands-BXAQEOES.js} +2 -2
- package/{setDialogExtraReferencesAction-Q4V2ZZW2.js → setDialogExtraReferencesAction-KIITOCFP.js} +6 -6
- package/{setPrimaryDialogAgentAction-742H5S6T.js → setPrimaryDialogAgentAction-Y36PKFFB.js} +7 -7
- package/{settingThunks-IHXUF276.js → settingThunks-YQNG5L6K.js} +5 -5
- package/{spaceCommands-WCLD36WH.js → spaceCommands-P644AAZZ.js} +37 -35
- package/{streamAgentChatTurn-DVTOINT3.js → streamAgentChatTurn-5CSYAUAY.js} +81 -77
- package/{switchDialogAgentAction-HLDLHRRA.js → switchDialogAgentAction-U2VLPPVO.js} +5 -5
- package/{tools-BOPINT5S.js → tools-UZ3CDIR2.js} +38 -38
- package/{tuiRestart-5F2APN66.js → tuiRestart-GF4DGAAN.js} +7 -7
- package/{tuiSummaryLlmCaller-TM5BU73J.js → tuiSummaryLlmCaller-HROLGN4F.js} +13 -13
- package/{updateCommands-FBYA5WVG.js → updateCommands-BZ4YDHNM.js} +3 -3
- package/{updateDialogTitleAction-S76PUCLQ.js → updateDialogTitleAction-53XCCDK2.js} +20 -20
- package/{usageCommand-L4OFWXEU.js → usageCommand-XVJ7ZUTM.js} +2 -2
- package/{usageRebuildCommand-7JR33UHS.js → usageRebuildCommand-NK6S3D4J.js} +3 -3
- package/{windowsSelfUpdate-M4V77OUB.js → windowsSelfUpdate-4BAXX7C3.js} +2 -2
- package/{workloadLifecycle-ZCSQCHG3.js → workloadLifecycle-DYX5ZMAT.js} +2 -2
- package/chunk-FGHEF6WI.js +0 -34
- package/{chunk-ANUP75N2.js → chunk-2E4BYAUE.js} +0 -0
- package/{chunk-CDIRKCPD.js → chunk-6HL6E7ZD.js} +152 -152
|
@@ -1,26 +1,42 @@
|
|
|
1
1
|
import {
|
|
2
2
|
toolRegistry
|
|
3
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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
|
|
22
|
-
|
|
23
|
-
|
|
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) =>
|
|
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
|
-
|
|
41
|
-
const
|
|
42
|
-
if (!response.ok) {
|
|
43
|
-
|
|
44
|
-
|
|
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
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
|
57
|
-
|
|
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
|
|
138
|
+
return unavailable;
|
|
67
139
|
}
|
|
68
|
-
if (!result.ok || !result.bytes) return
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
89
|
-
if (!
|
|
90
|
-
|
|
91
|
-
fetched.set(url,
|
|
166
|
+
let result2 = fetched.get(url);
|
|
167
|
+
if (!result2) {
|
|
168
|
+
result2 = fetchImage(url, signal, maxBytes);
|
|
169
|
+
fetched.set(url, result2);
|
|
92
170
|
}
|
|
93
|
-
return
|
|
171
|
+
return result2;
|
|
94
172
|
};
|
|
95
173
|
const usedBytes = { value: 0 };
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
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
|
|
201
|
+
return result;
|
|
118
202
|
};
|
|
119
203
|
|
|
120
204
|
// packages/ai/tools/toolSchemaCompatibility.ts
|
|
@@ -2,26 +2,26 @@ import {
|
|
|
2
2
|
clipMultilineText,
|
|
3
3
|
fetchAndSerializeTable,
|
|
4
4
|
waitForAbortableDelay
|
|
5
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
6
|
+
} from "./chunk-SSZHE2RK.js";
|
|
7
7
|
import {
|
|
8
8
|
clearCliLocalRuntimePreparedAgentCache
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GWS2X7TX.js";
|
|
10
10
|
import {
|
|
11
11
|
readCredentialAvailability
|
|
12
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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) {
|