nolo-cli 0.251.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-55PHWQWB.js → _executeModel-D6G3B45S.js} +44 -44
- package/{action-WZTKEF5H.js → action-QQOQ2LP3.js} +3 -3
- package/{addContentAction-LBVAQUF7.js → addContentAction-MB22YIDV.js} +6 -6
- package/{addDialogAgentAction-6WAUSUSZ.js → addDialogAgentAction-KNTBVVGY.js} +5 -5
- package/{agentDeleteCommand-KEO3KDK3.js → agentDeleteCommand-YCWDGJSF.js} +66 -65
- package/{agentEmailCommands-RWJQQRNT.js → agentEmailCommands-DTWD5FWC.js} +66 -65
- package/{agentListCommands-L3TLPLNH.js → agentListCommands-JTOONLYL.js} +224 -37
- package/{agentMachineCommands-EZWWXWDH.js → agentMachineCommands-25X7OTLQ.js} +29 -27
- package/{agentProviderCommands-C5T7C5KZ.js → agentProviderCommands-QLTABYR7.js} +2 -2
- package/{agentRecordCommands-7W2CGHJJ.js → agentRecordCommands-SXE3WV2X.js} +65 -64
- package/{agentRunCommand-POL6B6BO.js → agentRunCommand-QSIED54S.js} +65 -64
- package/{agentRunControl-FKSXBUAF.js → agentRunControl-KNNDEEDI.js} +8 -6
- package/{agentRuntimeLocal-WSHWNIMF.js → agentRuntimeLocal-HVJJMB4W.js} +24 -23
- package/{agentSlice-3G2YLTA4.js → agentSlice-NBUJJVRI.js} +6 -6
- package/{appDeleteCommands-DZZQCVYH.js → appDeleteCommands-YU6TT6VN.js} +31 -29
- package/{appDeployCommands-NJJBVNH5.js → appDeployCommands-4DEIX7YP.js} +31 -29
- package/{appDeployStatusCommands-GBOAFEYG.js → appDeployStatusCommands-3VKS6GBQ.js} +31 -29
- package/{appGetCommands-GOOKYMKO.js → appGetCommands-22FNNROT.js} +31 -29
- package/{appListCommands-OBCGUG3S.js → appListCommands-FVGMLHVU.js} +31 -29
- package/{authCommand-77CRN332.js → authCommand-5DC3ES4Q.js} +12 -12
- package/{chromeOpsCommands-6RLEBBJJ.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-PKMDYRAM.js → chunk-2PB653F5.js} +171 -237
- package/{chunk-GMWZRXRM.js → chunk-3272HU62.js} +1 -1
- package/{chunk-3ZWJVKFB.js → chunk-3N3JPQBQ.js} +82 -38
- package/{chunk-LXKK7QFI.js → chunk-4HAOOY6G.js} +53 -23
- package/{chunk-ZQ6K57FJ.js → chunk-4YPH5KRA.js} +1 -1
- package/{chunk-T4V6C3J3.js → chunk-52M4RYVP.js} +1 -1
- package/{chunk-6UNJ6JGR.js → chunk-5IN2NBDX.js} +4 -4
- package/{chunk-OQCAHPDQ.js → chunk-5QEOTC35.js} +4 -4
- package/{chunk-R7D5SRAZ.js → chunk-5UYDG6HP.js} +17 -0
- package/{chunk-Z7A2ZQ5X.js → chunk-64ACTEAE.js} +1 -1
- package/{chunk-CTWCZKNS.js → chunk-6SOWMEAY.js} +4 -4
- package/{chunk-UCMUXZJV.js → chunk-7XO73H5X.js} +111 -1
- package/{chunk-N3SEV3CG.js → chunk-7ZOVFB2H.js} +79 -30
- package/{chunk-UR4ZMRV3.js → chunk-A5F6DYP2.js} +1 -1
- package/{chunk-FAFDIQJG.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-IFJ6OTI6.js → chunk-CO2NXG2J.js} +32 -10
- package/{chunk-D3E5MYXO.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-PLS2MJVW.js → chunk-DU3DJYVA.js} +4 -4
- package/{chunk-MTS5DCL2.js → chunk-EG3JTV7H.js} +2 -2
- package/{chunk-6ASGEP5D.js → chunk-EJQE5HB7.js} +1 -1
- package/{chunk-CD64YXRB.js → chunk-F6Q64KRV.js} +1 -1
- package/{chunk-L5HV76QT.js → chunk-FRC2DNTN.js} +1 -1
- package/{chunk-W3HSD32M.js → chunk-FXEPZKNJ.js} +2 -2
- package/{chunk-D35TOEMM.js → chunk-FZI2P64R.js} +137 -53
- package/{chunk-WWTSEBDF.js → chunk-GIXWVN2W.js} +1 -1
- package/{chunk-CUYFRVJF.js → chunk-GO7UC5VH.js} +5 -5
- package/{chunk-KZVRPCOR.js → chunk-GVH2IP2M.js} +4 -4
- package/{chunk-KGOBJAWC.js → chunk-GWS2X7TX.js} +206 -93
- package/{chunk-KHVTT4WW.js → chunk-HF4C5WIU.js} +81 -542
- package/{chunk-Q5KZ6F55.js → chunk-HMREADP6.js} +19 -17
- package/{chunk-X337N4D6.js → chunk-ITCOQAHS.js} +3 -3
- package/{chunk-BQ4CZEVZ.js → chunk-ITMBFT35.js} +1 -1
- package/chunk-IVK2KT3H.js +209 -0
- package/{chunk-IXAGRTAR.js → chunk-JAYPSNGR.js} +1 -1
- package/{chunk-LOXR4TQN.js → chunk-JF5QT3YY.js} +2 -2
- package/{chunk-QLGL43SI.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-3KWJPTVP.js → chunk-LAQC5FAP.js} +4 -4
- package/{chunk-NTNX77FI.js → chunk-LNIA5JVX.js} +6 -6
- package/{chunk-QJTZ76CP.js → chunk-LS5KAVFQ.js} +1 -0
- package/{chunk-K26XPZRB.js → chunk-LVZVSLKO.js} +29 -9
- package/{chunk-ZSRR6HCH.js → chunk-N2ZAY2DK.js} +1 -1
- package/{chunk-MTM4LRVG.js → chunk-NNUIVAC2.js} +1 -1
- package/{chunk-HD5EKSLF.js → chunk-NPUHKEOB.js} +2 -2
- package/{chunk-OARYOLF3.js → chunk-O6LPLIRS.js} +11 -11
- package/{chunk-HQLCYPL4.js → chunk-OB4FBZXJ.js} +4 -4
- package/{chunk-CD2DK5JA.js → chunk-OKH74FML.js} +2 -1
- package/{chunk-IZWGO2ZS.js → chunk-OMIXG25B.js} +1 -1
- package/{chunk-CJ2BP6V7.js → chunk-OOV5JN25.js} +2 -2
- package/{chunk-AS6L5KSD.js → chunk-P4R5KXU7.js} +2 -2
- package/{chunk-K5CIMK3R.js → chunk-P6HMEKLL.js} +114 -56
- package/{chunk-VTHWBTRE.js → chunk-PENRYZ4D.js} +1 -1
- package/{chunk-WZPG63Q4.js → chunk-PIVTQRX6.js} +43 -13
- package/{chunk-KJDN2YRH.js → chunk-QMKWSKWA.js} +4 -4
- package/{chunk-XC5RPSXK.js → chunk-QV32GSVO.js} +2 -2
- package/{chunk-XJSEST7D.js → chunk-SMCKJJXI.js} +2 -2
- package/{chunk-KRAPKTAS.js → chunk-SMZFWEMX.js} +1 -1
- package/{chunk-43VT5PLM.js → chunk-T4VVQHSE.js} +1 -1
- package/{chunk-W2N4OAKM.js → chunk-TDI7ARZO.js} +3 -3
- package/{chunk-TGKAUEV3.js → chunk-TDLZA6LJ.js} +13 -10
- package/{chunk-LMMRWGGJ.js → chunk-TTUIM3PJ.js} +2 -2
- package/{chunk-5IKKSJYX.js → chunk-TTWNTFTO.js} +35 -2
- 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-U2OWDHDE.js → chunk-VH7AQEEF.js} +2 -2
- package/{chunk-ZKKJZBNO.js → chunk-WAOHK3NJ.js} +9 -9
- package/{chunk-2FK2KZSL.js → chunk-WLHUANWZ.js} +1 -1
- package/{chunk-JUYI2D7J.js → chunk-WNIBQBOR.js} +1 -1
- package/{chunk-SLUZ6FBJ.js → chunk-XBCADGK2.js} +1 -1
- package/{chunk-6XVPMGXK.js → chunk-YB5D2GK4.js} +9 -3
- package/{chunk-QJ5YDTEF.js → chunk-YQYYYATY.js} +42 -24
- package/{chunk-WQDTSK5U.js → chunk-ZMFA2TLE.js} +1 -1
- package/{chunk-CFDOIIOZ.js → chunk-ZMXO5G3E.js} +29 -23
- package/{chunk-A55E2OCP.js → chunk-ZNOXY73P.js} +632 -124
- package/{cliAgentConfigHelpers-N6LTB7UY.js → cliAgentConfigHelpers-FKBPFPKR.js} +6 -6
- package/{cliLocalAgentRecordReader-NFNGYOOW.js → cliLocalAgentRecordReader-DWU3LBO2.js} +28 -27
- package/{commandRegistry-OM5DU4DS.js → commandRegistry-7FVATZS2.js} +70 -70
- package/{contentThunks-7URM43ET.js → contentThunks-25XCB7VY.js} +18 -18
- package/{cooldownCommands-JEEV75B7.js → cooldownCommands-PT5L4LNB.js} +3 -3
- package/{createAgentAutomationAction-GGEXIKMC.js → createAgentAutomationAction-FC5RI2LW.js} +18 -18
- package/{createDialogAction-IXXEMFRQ.js → createDialogAction-IL3ISSQQ.js} +19 -19
- package/{createPageAction-IXIVLIOO.js → createPageAction-RVYBEYZV.js} +19 -19
- package/{db-J5KE7XRI.js → db-JMGVD4TB.js} +2 -1
- package/{dbSlice-IE4ADINL.js → dbSlice-WG3ZG6PZ.js} +5 -5
- package/{deleteFile-ZCQESEEQ.js → deleteFile-4TIG54YN.js} +3 -3
- package/{dialogCommands-RPBHOZB6.js → dialogCommands-VUJISJZF.js} +33 -31
- package/{dialogNotifyCommand-ECKI5MMA.js → dialogNotifyCommand-JKYVSR6K.js} +7 -7
- package/{dialogSlice-5FQB2TNN.js → dialogSlice-UMP55UAW.js} +16 -16
- package/{docCreateCommands-XJ2X57DW.js → docCreateCommands-S46F6GKP.js} +30 -28
- package/{docDeleteCommands-45WGFFEB.js → docDeleteCommands-LJG4NK6J.js} +31 -29
- package/{docReadCommands-LRRVDS46.js → docReadCommands-YPAYGHNM.js} +30 -28
- package/{docStore-SUAVM24F.js → docStore-VK3MVJ5Q.js} +6 -6
- package/{docUpdateCommands-QUYX6BVR.js → docUpdateCommands-MPTM6267.js} +30 -28
- package/{getPricing-FCHYVRJU.js → getPricing-5BLZRPTM.js} +3 -3
- package/{handleSendMessageAction-FDIWBQUB.js → handleSendMessageAction-VPKVNKBU.js} +33 -33
- package/{hostCredentialCreate-CEXQHYT4.js → hostCredentialCreate-K56HWPNY.js} +65 -64
- package/index.js +8 -8
- package/{localDialogRead-USDZXKIL.js → localDialogRead-NXILOV3T.js} +1 -1
- package/{localRuntimeAdapter-O3JBRK6S.js → localRuntimeAdapter-KVU72FWT.js} +64 -63
- package/{machineCommands-I3YA7TNC.js → machineCommands-C3O5RKNJ.js} +65 -64
- package/{machineWsRunDispatch-E5CIE2OJ.js → machineWsRunDispatch-ZLART7ZA.js} +65 -64
- package/{mcpLocalAuthorizeCommand-K5J2VMG6.js → mcpLocalAuthorizeCommand-LO7E4VQ5.js} +6 -6
- package/{memberThunks-T7EAZE6A.js → memberThunks-7DNR6DRD.js} +7 -7
- package/{models-EP7VG6N2.js → models-ZX2BYIMB.js} +2 -2
- package/package.json +1 -1
- package/{projectArchive-A7E65AZO.js → projectArchive-UBJFYRL7.js} +19 -19
- 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-2O65NBFG.js → readlineWorkspace-TSIYF7C6.js} +610 -206
- package/{removeDialogAgentAction-GRT72HLK.js → removeDialogAgentAction-LRKDU4RI.js} +7 -7
- package/{runAgentClientLoop-NWCZIXCG.js → runAgentClientLoop-YAHGOWXN.js} +41 -41
- package/{runtimeDoctorCommands-26HYHFTK.js → runtimeDoctorCommands-QGZSKNSE.js} +5 -5
- package/{secretCommands-XR72SHLK.js → secretCommands-BXAQEOES.js} +2 -2
- package/{setDialogExtraReferencesAction-CBG3X46B.js → setDialogExtraReferencesAction-KIITOCFP.js} +6 -6
- package/{setPrimaryDialogAgentAction-EWTDZOAX.js → setPrimaryDialogAgentAction-Y36PKFFB.js} +7 -7
- package/{settingThunks-X4PT66J2.js → settingThunks-YQNG5L6K.js} +5 -5
- package/{spaceCommands-EVSNTGRS.js → spaceCommands-P644AAZZ.js} +29 -27
- package/{streamAgentChatTurn-SYP3OEM5.js → streamAgentChatTurn-5CSYAUAY.js} +54 -50
- package/{switchDialogAgentAction-YHPZ7K6E.js → switchDialogAgentAction-U2VLPPVO.js} +5 -5
- package/{tools-2AO2SK4L.js → tools-UZ3CDIR2.js} +34 -34
- package/{tuiRestart-HBQDF4AE.js → tuiRestart-GF4DGAAN.js} +7 -7
- package/{tuiSummaryLlmCaller-Q2PNR63K.js → tuiSummaryLlmCaller-HROLGN4F.js} +12 -12
- package/{updateCommands-6SI7NWVC.js → updateCommands-BZ4YDHNM.js} +3 -3
- package/{updateDialogTitleAction-MWVMBIPZ.js → updateDialogTitleAction-53XCCDK2.js} +18 -18
- package/{usageCommand-D44AOTMH.js → usageCommand-XVJ7ZUTM.js} +1 -1
- package/{usageRebuildCommand-IRIMKDI5.js → usageRebuildCommand-NK6S3D4J.js} +2 -2
- package/{windowsSelfUpdate-BJIJKKIS.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
- package/{dialogUsageCommand-TBIA2QAF.js → dialogUsageCommand-IHAXS7DW.js} +3 -3
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-X4O7FJF5.js";
|
|
11
11
|
import {
|
|
12
12
|
getModelContextWindow
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-2FZVXOFX.js";
|
|
14
14
|
import {
|
|
15
15
|
isRecord
|
|
16
16
|
} from "./chunk-KUG52IAP.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
isFireworksKimiModel,
|
|
22
22
|
isNoloHostedProvider,
|
|
23
23
|
resolvePlatformEffectiveModel
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-JPXACKSW.js";
|
|
25
25
|
import {
|
|
26
26
|
asTrimmedLowercaseString
|
|
27
27
|
} from "./chunk-QSJ3HFEF.js";
|
|
@@ -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";
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
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) {
|