@dexto/core 1.6.20 → 1.6.22
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/dist/agent/DextoAgent.cjs +159 -51
- package/dist/agent/DextoAgent.d.ts +3 -1
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +162 -53
- package/dist/agent/types.d.ts +2 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/context/manager.cjs +144 -35
- package/dist/context/manager.d.ts +4 -0
- package/dist/context/manager.d.ts.map +1 -1
- package/dist/context/manager.js +146 -36
- package/dist/context/types.cjs +5 -0
- package/dist/context/types.d.ts +21 -1
- package/dist/context/types.d.ts.map +1 -1
- package/dist/context/types.js +4 -0
- package/dist/context/utils.cjs +85 -25
- package/dist/context/utils.d.ts +5 -3
- package/dist/context/utils.d.ts.map +1 -1
- package/dist/context/utils.js +84 -25
- package/dist/llm/executor/turn-executor.cjs +2 -2
- package/dist/llm/executor/turn-executor.d.ts +1 -1
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +2 -2
- package/dist/llm/formatters/vercel.cjs +3 -1
- package/dist/llm/formatters/vercel.d.ts.map +1 -1
- package/dist/llm/formatters/vercel.js +3 -1
- package/dist/llm/registry/index.cjs +43 -12
- package/dist/llm/registry/index.d.ts.map +1 -1
- package/dist/llm/registry/index.js +43 -12
- package/dist/llm/registry/models.generated.cjs +1270 -1324
- package/dist/llm/registry/models.generated.d.ts +617 -210
- package/dist/llm/registry/models.generated.d.ts.map +1 -1
- package/dist/llm/registry/models.generated.js +1270 -1324
- package/dist/llm/registry/sync.cjs +5 -0
- package/dist/llm/registry/sync.d.ts.map +1 -1
- package/dist/llm/registry/sync.js +5 -0
- package/dist/llm/types.cjs +1 -1
- package/dist/llm/types.d.ts +1 -1
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/llm/types.js +1 -1
- package/dist/resources/handlers/filesystem-handler.cjs +55 -9
- package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -1
- package/dist/resources/handlers/filesystem-handler.js +55 -9
- package/dist/resources/reference-parser.cjs +47 -12
- package/dist/resources/reference-parser.d.ts +6 -3
- package/dist/resources/reference-parser.d.ts.map +1 -1
- package/dist/resources/reference-parser.js +47 -12
- package/dist/utils/api-key-resolver.cjs +25 -0
- package/dist/utils/api-key-resolver.d.ts.map +1 -1
- package/dist/utils/api-key-resolver.js +25 -0
- package/package.json +1 -1
package/dist/context/utils.js
CHANGED
|
@@ -82,10 +82,26 @@ function coerceContentToParts(content) {
|
|
|
82
82
|
cloned.filename = item.filename;
|
|
83
83
|
}
|
|
84
84
|
normalized.push(cloned);
|
|
85
|
+
} else if (item.type === "resource") {
|
|
86
|
+
continue;
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
return normalized;
|
|
88
90
|
}
|
|
91
|
+
function normalizeResourceUriForRead(uri) {
|
|
92
|
+
if (uri.startsWith("blob:") || uri.startsWith("mcp:") || uri.startsWith("fs://") || uri.startsWith("http://") || uri.startsWith("https://")) {
|
|
93
|
+
return uri;
|
|
94
|
+
}
|
|
95
|
+
if (uri.startsWith("/") || /^[A-Za-z]:[\\/]/.test(uri)) {
|
|
96
|
+
return `fs://${uri.replace(/\\/g, "/")}`;
|
|
97
|
+
}
|
|
98
|
+
return uri;
|
|
99
|
+
}
|
|
100
|
+
function buildResourceAnchorText(part) {
|
|
101
|
+
const label = part.kind === "image" ? "Attached image" : part.kind === "audio" ? "Attached audio" : part.kind === "video" ? "Attached video" : "Attached file";
|
|
102
|
+
const nameSuffix = part.name && part.name !== part.uri ? ` (${part.name})` : "";
|
|
103
|
+
return `${label}: ${part.uri}${nameSuffix}`;
|
|
104
|
+
}
|
|
89
105
|
function detectInlineMedia(part, index) {
|
|
90
106
|
if (part.type === "text") {
|
|
91
107
|
return null;
|
|
@@ -216,23 +232,23 @@ function buildToolBlobName(kind, mimeType, options, preferredName) {
|
|
|
216
232
|
const unique = generateUniqueSuffix();
|
|
217
233
|
return `${parts.join("-")}-${unique}.${ext}`;
|
|
218
234
|
}
|
|
219
|
-
async function resolveBlobReferenceToParts(resourceUri, resourceManager, logger, allowedMediaTypes) {
|
|
235
|
+
async function resolveBlobReferenceToParts(resourceUri, resourceManager, logger, allowedMediaTypes, expandMatchingMedia = true) {
|
|
220
236
|
try {
|
|
221
|
-
const result = await resourceManager.read(resourceUri);
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
const placeholder = generateMediaPlaceholder(placeholderMetadata);
|
|
234
|
-
return [{ type: "text", text: placeholder }];
|
|
237
|
+
const result = await resourceManager.read(normalizeResourceUriForRead(resourceUri));
|
|
238
|
+
const mimeType = result.contents[0]?.mimeType;
|
|
239
|
+
const metadata = result._meta;
|
|
240
|
+
const shouldPlaceholderForUnsupportedMedia = mimeType !== void 0 && allowedMediaTypes !== void 0 && !matchesAnyMimePattern(mimeType, allowedMediaTypes);
|
|
241
|
+
const shouldPlaceholderForRetainedHistoryMedia = mimeType !== void 0 && isBinaryMediaMimeType(mimeType) && !expandMatchingMedia;
|
|
242
|
+
if (mimeType && (shouldPlaceholderForUnsupportedMedia || shouldPlaceholderForRetainedHistoryMedia)) {
|
|
243
|
+
const placeholderMetadata = {
|
|
244
|
+
mimeType,
|
|
245
|
+
size: metadata?.size ?? 0
|
|
246
|
+
};
|
|
247
|
+
if (metadata?.originalName) {
|
|
248
|
+
placeholderMetadata.originalName = metadata.originalName;
|
|
235
249
|
}
|
|
250
|
+
const placeholder = generateMediaPlaceholder(placeholderMetadata);
|
|
251
|
+
return [{ type: "text", text: placeholder }];
|
|
236
252
|
}
|
|
237
253
|
const parts = [];
|
|
238
254
|
for (const item of result.contents ?? []) {
|
|
@@ -244,11 +260,11 @@ async function resolveBlobReferenceToParts(resourceUri, resourceManager, logger,
|
|
|
244
260
|
continue;
|
|
245
261
|
}
|
|
246
262
|
const base64Data = "blob" in item && typeof item.blob === "string" ? item.blob : "data" in item && typeof item.data === "string" ? item.data : void 0;
|
|
247
|
-
const
|
|
248
|
-
if (!base64Data || !
|
|
263
|
+
const mimeType2 = typeof item.mimeType === "string" ? item.mimeType : void 0;
|
|
264
|
+
if (!base64Data || !mimeType2) {
|
|
249
265
|
continue;
|
|
250
266
|
}
|
|
251
|
-
const resolvedMime =
|
|
267
|
+
const resolvedMime = mimeType2 ?? "application/octet-stream";
|
|
252
268
|
if (resolvedMime.startsWith("image/")) {
|
|
253
269
|
const imagePart = {
|
|
254
270
|
type: "image",
|
|
@@ -304,6 +320,9 @@ function estimateContentPartTokens(part) {
|
|
|
304
320
|
if (part.type === "file") {
|
|
305
321
|
return 1e3;
|
|
306
322
|
}
|
|
323
|
+
if (part.type === "resource") {
|
|
324
|
+
return part.kind === "text" ? 250 : 1e3;
|
|
325
|
+
}
|
|
307
326
|
return 0;
|
|
308
327
|
}
|
|
309
328
|
function estimateMessagesTokens(messages) {
|
|
@@ -410,11 +429,11 @@ async function getFileDataWithBlobSupport(filePart, resourceManager, logger) {
|
|
|
410
429
|
}
|
|
411
430
|
return getFileData(filePart, logger);
|
|
412
431
|
}
|
|
413
|
-
async function expandBlobsInText(text, resourceManager, logger, allowedMediaTypes) {
|
|
432
|
+
async function expandBlobsInText(text, resourceManager, logger, allowedMediaTypes, expandMatchingMedia = true) {
|
|
414
433
|
if (!text.includes("@blob:")) {
|
|
415
434
|
return [{ type: "text", text }];
|
|
416
435
|
}
|
|
417
|
-
const blobRefPattern = /@blob:[a-f0-9]+/g;
|
|
436
|
+
const blobRefPattern = /@blob:[a-f0-9-]+/g;
|
|
418
437
|
const matches = [...text.matchAll(blobRefPattern)];
|
|
419
438
|
if (matches.length === 0) {
|
|
420
439
|
return [{ type: "text", text }];
|
|
@@ -439,7 +458,8 @@ async function expandBlobsInText(text, resourceManager, logger, allowedMediaType
|
|
|
439
458
|
resourceUri,
|
|
440
459
|
resourceManager,
|
|
441
460
|
logger,
|
|
442
|
-
allowedMediaTypes
|
|
461
|
+
allowedMediaTypes,
|
|
462
|
+
expandMatchingMedia
|
|
443
463
|
);
|
|
444
464
|
resolvedCache.set(resourceUri, resolvedParts);
|
|
445
465
|
}
|
|
@@ -458,7 +478,7 @@ async function expandBlobsInText(text, resourceManager, logger, allowedMediaType
|
|
|
458
478
|
}
|
|
459
479
|
return parts.filter((p) => p.type !== "text" || p.text.length > 0);
|
|
460
480
|
}
|
|
461
|
-
async function expandBlobReferences(content, resourceManager, logger, allowedMediaTypes) {
|
|
481
|
+
async function expandBlobReferences(content, resourceManager, logger, allowedMediaTypes, expandMatchingMedia = true) {
|
|
462
482
|
if (content == null || !Array.isArray(content)) {
|
|
463
483
|
return [];
|
|
464
484
|
}
|
|
@@ -475,7 +495,8 @@ async function expandBlobReferences(content, resourceManager, logger, allowedMed
|
|
|
475
495
|
resourceUri,
|
|
476
496
|
resourceManager,
|
|
477
497
|
logger,
|
|
478
|
-
allowedMediaTypes
|
|
498
|
+
allowedMediaTypes,
|
|
499
|
+
expandMatchingMedia
|
|
479
500
|
);
|
|
480
501
|
if (resolved.length > 0) {
|
|
481
502
|
expandedParts.push(...resolved.map((p) => ({ ...p })));
|
|
@@ -491,7 +512,8 @@ async function expandBlobReferences(content, resourceManager, logger, allowedMed
|
|
|
491
512
|
resourceUri,
|
|
492
513
|
resourceManager,
|
|
493
514
|
logger,
|
|
494
|
-
allowedMediaTypes
|
|
515
|
+
allowedMediaTypes,
|
|
516
|
+
expandMatchingMedia
|
|
495
517
|
);
|
|
496
518
|
if (resolved.length > 0) {
|
|
497
519
|
expandedParts.push(...resolved.map((p) => ({ ...p })));
|
|
@@ -510,12 +532,27 @@ async function expandBlobReferences(content, resourceManager, logger, allowedMed
|
|
|
510
532
|
}
|
|
511
533
|
continue;
|
|
512
534
|
}
|
|
535
|
+
if (part.type === "resource") {
|
|
536
|
+
const resolved = await resolveBlobReferenceToParts(
|
|
537
|
+
part.uri,
|
|
538
|
+
resourceManager,
|
|
539
|
+
logger,
|
|
540
|
+
allowedMediaTypes,
|
|
541
|
+
expandMatchingMedia
|
|
542
|
+
);
|
|
543
|
+
expandedParts.push({ type: "text", text: buildResourceAnchorText(part) });
|
|
544
|
+
if (resolved.length > 0) {
|
|
545
|
+
expandedParts.push(...resolved.map((p) => ({ ...p })));
|
|
546
|
+
}
|
|
547
|
+
continue;
|
|
548
|
+
}
|
|
513
549
|
if (part.type === "text" && part.text.includes("@blob:")) {
|
|
514
550
|
const expanded = await expandBlobsInText(
|
|
515
551
|
part.text,
|
|
516
552
|
resourceManager,
|
|
517
553
|
logger,
|
|
518
|
-
allowedMediaTypes
|
|
554
|
+
allowedMediaTypes,
|
|
555
|
+
expandMatchingMedia
|
|
519
556
|
);
|
|
520
557
|
expandedParts.push(...expanded);
|
|
521
558
|
continue;
|
|
@@ -588,6 +625,9 @@ function filterMessagesByLLMCapabilities(messages, config, logger) {
|
|
|
588
625
|
);
|
|
589
626
|
return [part];
|
|
590
627
|
}
|
|
628
|
+
if (part.type === "resource") {
|
|
629
|
+
return [part];
|
|
630
|
+
}
|
|
591
631
|
return [part];
|
|
592
632
|
}
|
|
593
633
|
);
|
|
@@ -674,12 +714,30 @@ function fileTypesToMimePatterns(fileTypes, logger) {
|
|
|
674
714
|
case "video":
|
|
675
715
|
patterns.push("video/*");
|
|
676
716
|
break;
|
|
717
|
+
case "document":
|
|
718
|
+
patterns.push(
|
|
719
|
+
"text/*",
|
|
720
|
+
"application/json",
|
|
721
|
+
"application/xml",
|
|
722
|
+
"application/msword",
|
|
723
|
+
"application/rtf",
|
|
724
|
+
"application/vnd.oasis.opendocument.text",
|
|
725
|
+
"application/vnd.ms-powerpoint",
|
|
726
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
727
|
+
"application/vnd.ms-excel",
|
|
728
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
729
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
730
|
+
);
|
|
731
|
+
break;
|
|
677
732
|
default:
|
|
678
733
|
logger.warn(`Unknown file type in registry: ${fileType}`);
|
|
679
734
|
}
|
|
680
735
|
}
|
|
681
736
|
return patterns;
|
|
682
737
|
}
|
|
738
|
+
function isBinaryMediaMimeType(mimeType) {
|
|
739
|
+
return mimeType.startsWith("image/") || mimeType.startsWith("audio/") || mimeType.startsWith("video/") || mimeType === "application/pdf";
|
|
740
|
+
}
|
|
683
741
|
function generateMediaPlaceholder(metadata) {
|
|
684
742
|
let typeLabel = "File";
|
|
685
743
|
if (metadata.mimeType.startsWith("video/")) typeLabel = "Video";
|
|
@@ -1337,6 +1395,7 @@ export {
|
|
|
1337
1395
|
getImageData,
|
|
1338
1396
|
getImageDataWithBlobSupport,
|
|
1339
1397
|
getResourceKind,
|
|
1398
|
+
isBinaryMediaMimeType,
|
|
1340
1399
|
isLikelyBase64String,
|
|
1341
1400
|
matchesAnyMimePattern,
|
|
1342
1401
|
matchesMimePattern,
|
|
@@ -731,7 +731,7 @@ class TurnExecutor {
|
|
|
731
731
|
* Estimates tokens for tool message content using simple heuristic (length/4).
|
|
732
732
|
* Used for pruning decisions only - actual token counts come from API.
|
|
733
733
|
*
|
|
734
|
-
* Tool message content is always Array<TextPart | ImagePart | FilePart | UIResourcePart>
|
|
734
|
+
* Tool message content is always Array<TextPart | ImagePart | FilePart | ResourcePart | UIResourcePart>
|
|
735
735
|
* after sanitization via SanitizedToolResult.
|
|
736
736
|
*/
|
|
737
737
|
estimateToolTokens(content) {
|
|
@@ -739,7 +739,7 @@ class TurnExecutor {
|
|
|
739
739
|
if (part.type === "text") {
|
|
740
740
|
return sum + Math.ceil(part.text.length / 4);
|
|
741
741
|
}
|
|
742
|
-
if (part.type === "image" || part.type === "file") {
|
|
742
|
+
if (part.type === "image" || part.type === "file" || part.type === "resource") {
|
|
743
743
|
return sum + 1e3;
|
|
744
744
|
}
|
|
745
745
|
return sum;
|
|
@@ -137,7 +137,7 @@ export declare class TurnExecutor {
|
|
|
137
137
|
* Estimates tokens for tool message content using simple heuristic (length/4).
|
|
138
138
|
* Used for pruning decisions only - actual token counts come from API.
|
|
139
139
|
*
|
|
140
|
-
* Tool message content is always Array<TextPart | ImagePart | FilePart | UIResourcePart>
|
|
140
|
+
* Tool message content is always Array<TextPart | ImagePart | FilePart | ResourcePart | UIResourcePart>
|
|
141
141
|
* after sanitization via SanitizedToolResult.
|
|
142
142
|
*/
|
|
143
143
|
private estimateToolTokens;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turn-executor.d.ts","sourceRoot":"","sources":["../../../src/llm/executor/turn-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EAMb,KAAK,YAAY,EAEpB,MAAM,IAAI,CAAC;AAEZ,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"turn-executor.d.ts","sourceRoot":"","sources":["../../../src/llm/executor/turn-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EAMb,KAAK,YAAY,EAEpB,MAAM,IAAI,CAAC;AAEZ,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAQ1D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAI1D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,KAAK,EAER,kBAAkB,EAClB,UAAU,EAGb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM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EAAE,WAAW,YAAA,EACpC,kBAAkB,GAAE,kBAAkB,GAAG,IAAW;IAcxD;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAoBhC;;;;;;OAMG;IACG,OAAO,CACT,kBAAkB,EAAE,yBAAyB,EAC7C,SAAS,GAAE,OAAc,GAC1B,OAAO,CAAC,cAAc,CAAC;IAsV1B;;;OAGG;IACH,KAAK,IAAI,IAAI;IAIb;;;OAGG;YACW,oBAAoB;IAmBlC;;;;;;;;OAQG;YACW,mBAAmB;IAkFjC;;;;;;;OAOG;YACW,WAAW;IAgIzB;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAuF9B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAyBxB;;OAEG;IACH,OAAO,CAAC,eAAe;IAavB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAS5B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAU;IAC/C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAU;IAE/C;;;;;;;;;;;OAWG;YACW,mBAAmB;IAkDjC;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;IAgB1B;;;OAGG;IACH,OAAO,CAAC,OAAO;IAYf;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;IAOrB;;;;;;OAMG;IACH,OAAO,CAAC,uBAAuB;IAO/B;;;;;;;;;;;OAWG;YACW,cAAc;IAwF5B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAoB9B,OAAO,CAAC,qBAAqB;IAK7B;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAyF3B"}
|
|
@@ -663,7 +663,7 @@ class TurnExecutor {
|
|
|
663
663
|
* Estimates tokens for tool message content using simple heuristic (length/4).
|
|
664
664
|
* Used for pruning decisions only - actual token counts come from API.
|
|
665
665
|
*
|
|
666
|
-
* Tool message content is always Array<TextPart | ImagePart | FilePart | UIResourcePart>
|
|
666
|
+
* Tool message content is always Array<TextPart | ImagePart | FilePart | ResourcePart | UIResourcePart>
|
|
667
667
|
* after sanitization via SanitizedToolResult.
|
|
668
668
|
*/
|
|
669
669
|
estimateToolTokens(content) {
|
|
@@ -671,7 +671,7 @@ class TurnExecutor {
|
|
|
671
671
|
if (part.type === "text") {
|
|
672
672
|
return sum + Math.ceil(part.text.length / 4);
|
|
673
673
|
}
|
|
674
|
-
if (part.type === "image" || part.type === "file") {
|
|
674
|
+
if (part.type === "image" || part.type === "file" || part.type === "resource") {
|
|
675
675
|
return sum + 1e3;
|
|
676
676
|
}
|
|
677
677
|
return sum;
|
|
@@ -77,7 +77,9 @@ class VercelMessageFormatter {
|
|
|
77
77
|
switch (msg.role) {
|
|
78
78
|
case "user":
|
|
79
79
|
if (msg.content !== null) {
|
|
80
|
-
const content = typeof msg.content === "string" ? msg.content : msg.content.filter(
|
|
80
|
+
const content = typeof msg.content === "string" ? msg.content : msg.content.filter(
|
|
81
|
+
(part) => part.type !== "ui-resource" && part.type !== "resource"
|
|
82
|
+
).map((part) => {
|
|
81
83
|
if (part.type === "file") {
|
|
82
84
|
return {
|
|
83
85
|
type: "file",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel.d.ts","sourceRoot":"","sources":["../../../src/llm/formatters/vercel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAiD,MAAM,IAAI,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAiC,MAAM,wBAAwB,CAAC;AAE7F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAmBvD;;;;;;;;;;GAUG;AACH,qBAAa,sBAAsB;IAC/B,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM;IAG1B;;;;;;OAMG;IACH,MAAM,CACF,OAAO,EAAE,QAAQ,CAAC,eAAe,EAAE,CAAC,EACpC,OAAO,EAAE,UAAU,EACnB,YAAY,EAAE,MAAM,GAAG,IAAI,GAC5B,YAAY,EAAE;
|
|
1
|
+
{"version":3,"file":"vercel.d.ts","sourceRoot":"","sources":["../../../src/llm/formatters/vercel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAiD,MAAM,IAAI,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAiC,MAAM,wBAAwB,CAAC;AAE7F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAmBvD;;;;;;;;;;GAUG;AACH,qBAAa,sBAAsB;IAC/B,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM;IAG1B;;;;;;OAMG;IACH,MAAM,CACF,OAAO,EAAE,QAAQ,CAAC,eAAe,EAAE,CAAC,EACpC,OAAO,EAAE,UAAU,EACnB,YAAY,EAAE,MAAM,GAAG,IAAI,GAC5B,YAAY,EAAE;IAkKjB;;;;;;OAMG;IACH,kBAAkB,IAAI,IAAI;IAI1B,OAAO,CAAC,wBAAwB;IAUhC,OAAO,CAAC,sBAAsB;IAmG9B,OAAO,CAAC,iBAAiB;CAoE5B"}
|
|
@@ -55,7 +55,9 @@ class VercelMessageFormatter {
|
|
|
55
55
|
switch (msg.role) {
|
|
56
56
|
case "user":
|
|
57
57
|
if (msg.content !== null) {
|
|
58
|
-
const content = typeof msg.content === "string" ? msg.content : msg.content.filter(
|
|
58
|
+
const content = typeof msg.content === "string" ? msg.content : msg.content.filter(
|
|
59
|
+
(part) => part.type !== "ui-resource" && part.type !== "resource"
|
|
60
|
+
).map((part) => {
|
|
59
61
|
if (part.type === "file") {
|
|
60
62
|
return {
|
|
61
63
|
type: "file",
|
|
@@ -102,13 +102,44 @@ const MIME_TYPE_TO_FILE_TYPE = {
|
|
|
102
102
|
"audio/ogg": "audio",
|
|
103
103
|
"audio/m4a": "audio",
|
|
104
104
|
"audio/aac": "audio",
|
|
105
|
+
"video/mp4": "video",
|
|
106
|
+
"video/webm": "video",
|
|
107
|
+
"video/ogg": "video",
|
|
108
|
+
"video/quicktime": "video",
|
|
109
|
+
"video/x-msvideo": "video",
|
|
110
|
+
"video/x-matroska": "video",
|
|
105
111
|
// Common image MIME types
|
|
106
112
|
"image/jpeg": "image",
|
|
107
113
|
"image/jpg": "image",
|
|
108
114
|
"image/png": "image",
|
|
109
115
|
"image/webp": "image",
|
|
110
|
-
"image/gif": "image"
|
|
116
|
+
"image/gif": "image",
|
|
117
|
+
// Common document, presentation, and spreadsheet MIME types
|
|
118
|
+
"text/plain": "document",
|
|
119
|
+
"text/markdown": "document",
|
|
120
|
+
"text/html": "document",
|
|
121
|
+
"text/xml": "document",
|
|
122
|
+
"text/csv": "document",
|
|
123
|
+
"text/tab-separated-values": "document",
|
|
124
|
+
"application/json": "document",
|
|
125
|
+
"application/xml": "document",
|
|
126
|
+
"application/msword": "document",
|
|
127
|
+
"application/rtf": "document",
|
|
128
|
+
"text/rtf": "document",
|
|
129
|
+
"application/vnd.oasis.opendocument.text": "document",
|
|
130
|
+
"application/vnd.ms-powerpoint": "document",
|
|
131
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "document",
|
|
132
|
+
"application/vnd.ms-excel": "document",
|
|
133
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "document",
|
|
134
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "document"
|
|
111
135
|
};
|
|
136
|
+
const GENERIC_UPLOAD_FILE_TYPES = [
|
|
137
|
+
"pdf",
|
|
138
|
+
"image",
|
|
139
|
+
"audio",
|
|
140
|
+
"video",
|
|
141
|
+
"document"
|
|
142
|
+
];
|
|
112
143
|
function getAllowedMimeTypes() {
|
|
113
144
|
return Object.keys(MIME_TYPE_TO_FILE_TYPE);
|
|
114
145
|
}
|
|
@@ -125,8 +156,8 @@ const LLM_REGISTRY = {
|
|
|
125
156
|
models: [],
|
|
126
157
|
// Empty - accepts any model name for custom endpoints
|
|
127
158
|
baseURLSupport: "required",
|
|
128
|
-
supportedFileTypes:
|
|
129
|
-
// Allow all
|
|
159
|
+
supportedFileTypes: GENERIC_UPLOAD_FILE_TYPES,
|
|
160
|
+
// Allow all generic file categories for custom endpoints
|
|
130
161
|
supportsCustomModels: true
|
|
131
162
|
},
|
|
132
163
|
anthropic: {
|
|
@@ -193,8 +224,8 @@ const LLM_REGISTRY = {
|
|
|
193
224
|
models: import_models_generated.MODELS_BY_PROVIDER.openrouter,
|
|
194
225
|
baseURLSupport: "none",
|
|
195
226
|
// Fixed endpoint - baseURL auto-injected in resolver, no user override allowed
|
|
196
|
-
supportedFileTypes:
|
|
197
|
-
// Allow all
|
|
227
|
+
supportedFileTypes: GENERIC_UPLOAD_FILE_TYPES,
|
|
228
|
+
// Allow all generic file categories - user assumes responsibility
|
|
198
229
|
supportsCustomModels: true,
|
|
199
230
|
supportsAllRegistryModels: true,
|
|
200
231
|
// Can serve models from all other providers
|
|
@@ -206,7 +237,7 @@ const LLM_REGISTRY = {
|
|
|
206
237
|
litellm: {
|
|
207
238
|
models: [],
|
|
208
239
|
baseURLSupport: "required",
|
|
209
|
-
supportedFileTypes:
|
|
240
|
+
supportedFileTypes: GENERIC_UPLOAD_FILE_TYPES,
|
|
210
241
|
supportsCustomModels: true
|
|
211
242
|
},
|
|
212
243
|
// https://glama.ai/
|
|
@@ -215,7 +246,7 @@ const LLM_REGISTRY = {
|
|
|
215
246
|
glama: {
|
|
216
247
|
models: [],
|
|
217
248
|
baseURLSupport: "none",
|
|
218
|
-
supportedFileTypes:
|
|
249
|
+
supportedFileTypes: GENERIC_UPLOAD_FILE_TYPES,
|
|
219
250
|
supportsCustomModels: true
|
|
220
251
|
},
|
|
221
252
|
// https://cloud.google.com/vertex-ai
|
|
@@ -307,7 +338,7 @@ const LLM_REGISTRY = {
|
|
|
307
338
|
name: "openai/gpt-5.2",
|
|
308
339
|
displayName: "GPT-5.2",
|
|
309
340
|
maxInputTokens: 4e5,
|
|
310
|
-
supportedFileTypes: ["pdf", "image"],
|
|
341
|
+
supportedFileTypes: ["pdf", "image", "document"],
|
|
311
342
|
pricing: {
|
|
312
343
|
inputPerM: 1.75,
|
|
313
344
|
outputPerM: 14,
|
|
@@ -320,7 +351,7 @@ const LLM_REGISTRY = {
|
|
|
320
351
|
name: "openai/gpt-5.2-codex",
|
|
321
352
|
displayName: "GPT-5.2 Codex",
|
|
322
353
|
maxInputTokens: 4e5,
|
|
323
|
-
supportedFileTypes: ["pdf", "image"],
|
|
354
|
+
supportedFileTypes: ["pdf", "image", "document"],
|
|
324
355
|
pricing: {
|
|
325
356
|
inputPerM: 1.75,
|
|
326
357
|
outputPerM: 14,
|
|
@@ -334,13 +365,13 @@ const LLM_REGISTRY = {
|
|
|
334
365
|
name: "google/gemini-3-pro-preview",
|
|
335
366
|
displayName: "Gemini 3 Pro",
|
|
336
367
|
maxInputTokens: 1048576,
|
|
337
|
-
supportedFileTypes: ["pdf", "image", "audio"]
|
|
368
|
+
supportedFileTypes: ["pdf", "image", "audio", "video", "document"]
|
|
338
369
|
},
|
|
339
370
|
{
|
|
340
371
|
name: "google/gemini-3-flash-preview",
|
|
341
372
|
displayName: "Gemini 3 Flash",
|
|
342
373
|
maxInputTokens: 1048576,
|
|
343
|
-
supportedFileTypes: ["pdf", "image", "audio"]
|
|
374
|
+
supportedFileTypes: ["pdf", "image", "audio", "video", "document"]
|
|
344
375
|
},
|
|
345
376
|
// Free models (via OpenRouter)
|
|
346
377
|
{
|
|
@@ -394,7 +425,7 @@ const LLM_REGISTRY = {
|
|
|
394
425
|
}
|
|
395
426
|
],
|
|
396
427
|
baseURLSupport: "none",
|
|
397
|
-
supportedFileTypes:
|
|
428
|
+
supportedFileTypes: GENERIC_UPLOAD_FILE_TYPES,
|
|
398
429
|
supportsCustomModels: true,
|
|
399
430
|
supportsAllRegistryModels: true
|
|
400
431
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRo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G;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,GAAG,MAAM,CAmBjF;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,GAAG,OAAO,CAkDtF;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,GAAG,MAAM,CAE9E;AAED,wBAAgB,sBAAsB,CAClC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,YAAY,GACtB,uBAAuB,CAuBzB"}
|
|
@@ -60,13 +60,44 @@ const MIME_TYPE_TO_FILE_TYPE = {
|
|
|
60
60
|
"audio/ogg": "audio",
|
|
61
61
|
"audio/m4a": "audio",
|
|
62
62
|
"audio/aac": "audio",
|
|
63
|
+
"video/mp4": "video",
|
|
64
|
+
"video/webm": "video",
|
|
65
|
+
"video/ogg": "video",
|
|
66
|
+
"video/quicktime": "video",
|
|
67
|
+
"video/x-msvideo": "video",
|
|
68
|
+
"video/x-matroska": "video",
|
|
63
69
|
// Common image MIME types
|
|
64
70
|
"image/jpeg": "image",
|
|
65
71
|
"image/jpg": "image",
|
|
66
72
|
"image/png": "image",
|
|
67
73
|
"image/webp": "image",
|
|
68
|
-
"image/gif": "image"
|
|
74
|
+
"image/gif": "image",
|
|
75
|
+
// Common document, presentation, and spreadsheet MIME types
|
|
76
|
+
"text/plain": "document",
|
|
77
|
+
"text/markdown": "document",
|
|
78
|
+
"text/html": "document",
|
|
79
|
+
"text/xml": "document",
|
|
80
|
+
"text/csv": "document",
|
|
81
|
+
"text/tab-separated-values": "document",
|
|
82
|
+
"application/json": "document",
|
|
83
|
+
"application/xml": "document",
|
|
84
|
+
"application/msword": "document",
|
|
85
|
+
"application/rtf": "document",
|
|
86
|
+
"text/rtf": "document",
|
|
87
|
+
"application/vnd.oasis.opendocument.text": "document",
|
|
88
|
+
"application/vnd.ms-powerpoint": "document",
|
|
89
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "document",
|
|
90
|
+
"application/vnd.ms-excel": "document",
|
|
91
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "document",
|
|
92
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "document"
|
|
69
93
|
};
|
|
94
|
+
const GENERIC_UPLOAD_FILE_TYPES = [
|
|
95
|
+
"pdf",
|
|
96
|
+
"image",
|
|
97
|
+
"audio",
|
|
98
|
+
"video",
|
|
99
|
+
"document"
|
|
100
|
+
];
|
|
70
101
|
function getAllowedMimeTypes() {
|
|
71
102
|
return Object.keys(MIME_TYPE_TO_FILE_TYPE);
|
|
72
103
|
}
|
|
@@ -83,8 +114,8 @@ const LLM_REGISTRY = {
|
|
|
83
114
|
models: [],
|
|
84
115
|
// Empty - accepts any model name for custom endpoints
|
|
85
116
|
baseURLSupport: "required",
|
|
86
|
-
supportedFileTypes:
|
|
87
|
-
// Allow all
|
|
117
|
+
supportedFileTypes: GENERIC_UPLOAD_FILE_TYPES,
|
|
118
|
+
// Allow all generic file categories for custom endpoints
|
|
88
119
|
supportsCustomModels: true
|
|
89
120
|
},
|
|
90
121
|
anthropic: {
|
|
@@ -151,8 +182,8 @@ const LLM_REGISTRY = {
|
|
|
151
182
|
models: MODELS_BY_PROVIDER.openrouter,
|
|
152
183
|
baseURLSupport: "none",
|
|
153
184
|
// Fixed endpoint - baseURL auto-injected in resolver, no user override allowed
|
|
154
|
-
supportedFileTypes:
|
|
155
|
-
// Allow all
|
|
185
|
+
supportedFileTypes: GENERIC_UPLOAD_FILE_TYPES,
|
|
186
|
+
// Allow all generic file categories - user assumes responsibility
|
|
156
187
|
supportsCustomModels: true,
|
|
157
188
|
supportsAllRegistryModels: true,
|
|
158
189
|
// Can serve models from all other providers
|
|
@@ -164,7 +195,7 @@ const LLM_REGISTRY = {
|
|
|
164
195
|
litellm: {
|
|
165
196
|
models: [],
|
|
166
197
|
baseURLSupport: "required",
|
|
167
|
-
supportedFileTypes:
|
|
198
|
+
supportedFileTypes: GENERIC_UPLOAD_FILE_TYPES,
|
|
168
199
|
supportsCustomModels: true
|
|
169
200
|
},
|
|
170
201
|
// https://glama.ai/
|
|
@@ -173,7 +204,7 @@ const LLM_REGISTRY = {
|
|
|
173
204
|
glama: {
|
|
174
205
|
models: [],
|
|
175
206
|
baseURLSupport: "none",
|
|
176
|
-
supportedFileTypes:
|
|
207
|
+
supportedFileTypes: GENERIC_UPLOAD_FILE_TYPES,
|
|
177
208
|
supportsCustomModels: true
|
|
178
209
|
},
|
|
179
210
|
// https://cloud.google.com/vertex-ai
|
|
@@ -265,7 +296,7 @@ const LLM_REGISTRY = {
|
|
|
265
296
|
name: "openai/gpt-5.2",
|
|
266
297
|
displayName: "GPT-5.2",
|
|
267
298
|
maxInputTokens: 4e5,
|
|
268
|
-
supportedFileTypes: ["pdf", "image"],
|
|
299
|
+
supportedFileTypes: ["pdf", "image", "document"],
|
|
269
300
|
pricing: {
|
|
270
301
|
inputPerM: 1.75,
|
|
271
302
|
outputPerM: 14,
|
|
@@ -278,7 +309,7 @@ const LLM_REGISTRY = {
|
|
|
278
309
|
name: "openai/gpt-5.2-codex",
|
|
279
310
|
displayName: "GPT-5.2 Codex",
|
|
280
311
|
maxInputTokens: 4e5,
|
|
281
|
-
supportedFileTypes: ["pdf", "image"],
|
|
312
|
+
supportedFileTypes: ["pdf", "image", "document"],
|
|
282
313
|
pricing: {
|
|
283
314
|
inputPerM: 1.75,
|
|
284
315
|
outputPerM: 14,
|
|
@@ -292,13 +323,13 @@ const LLM_REGISTRY = {
|
|
|
292
323
|
name: "google/gemini-3-pro-preview",
|
|
293
324
|
displayName: "Gemini 3 Pro",
|
|
294
325
|
maxInputTokens: 1048576,
|
|
295
|
-
supportedFileTypes: ["pdf", "image", "audio"]
|
|
326
|
+
supportedFileTypes: ["pdf", "image", "audio", "video", "document"]
|
|
296
327
|
},
|
|
297
328
|
{
|
|
298
329
|
name: "google/gemini-3-flash-preview",
|
|
299
330
|
displayName: "Gemini 3 Flash",
|
|
300
331
|
maxInputTokens: 1048576,
|
|
301
|
-
supportedFileTypes: ["pdf", "image", "audio"]
|
|
332
|
+
supportedFileTypes: ["pdf", "image", "audio", "video", "document"]
|
|
302
333
|
},
|
|
303
334
|
// Free models (via OpenRouter)
|
|
304
335
|
{
|
|
@@ -352,7 +383,7 @@ const LLM_REGISTRY = {
|
|
|
352
383
|
}
|
|
353
384
|
],
|
|
354
385
|
baseURLSupport: "none",
|
|
355
|
-
supportedFileTypes:
|
|
386
|
+
supportedFileTypes: GENERIC_UPLOAD_FILE_TYPES,
|
|
356
387
|
supportsCustomModels: true,
|
|
357
388
|
supportsAllRegistryModels: true
|
|
358
389
|
}
|