dexto 1.1.2 → 1.1.3
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/README.md +270 -160
- package/agents/agent-registry.json +16 -2
- package/agents/agent-template.yml +6 -12
- package/agents/default-agent.yml +6 -16
- package/agents/nano-banana-agent/README.md +200 -0
- package/agents/nano-banana-agent/nano-banana-agent.yml +68 -0
- package/agents/podcast-agent/README.md +168 -0
- package/agents/podcast-agent/podcast-agent.yml +167 -0
- package/agents/triage-demo/billing-agent.yml +2 -2
- package/agents/triage-demo/product-info-agent.yml +2 -3
- package/agents/triage-demo/technical-support-agent.yml +2 -3
- package/dist/src/app/{chunk-OIBH674O.js → chunk-BKF5BGLX.js} +318 -35
- package/dist/src/app/{chunk-FVWAYUL4.js → chunk-N7FUUBGT.js} +1 -1
- package/dist/src/app/{chunk-UG5P4DIL.js → chunk-OONTQZRM.js} +2 -2
- package/dist/src/app/{cli-confirmation-handler-7BZ6BMSE.js → cli-confirmation-handler-7235V7GL.js} +1 -1
- package/dist/src/app/{errors-EYGUMLKB.js → errors-YCS63OK6.js} +1 -1
- package/dist/src/app/index.js +19 -8
- package/dist/src/app/{loader-LJJQ4NDP.js → loader-PVRMNHST.js} +2 -2
- package/dist/src/app/{path-O5L5AW7V.js → path-DJ5C7EUS.js} +1 -1
- package/dist/src/app/{registry-HIVAEL5E.js → registry-KOOLQYP4.js} +3 -3
- package/dist/src/app/{sqlite-backend-FK7U4D6Z.js → sqlite-backend-NCFS7FN6.js} +1 -1
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/122-4d4c8aa883d114a2.js +1 -0
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/216-f5dbf2145a48ae92.js +1 -0
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/43-4f3d01c7feaf132f.js +1 -0
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/app/{layout-43f98b6d34953fcf.js → layout-36c240720861a312.js} +1 -1
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/app/page-ca08c66042cb54c8.js +1 -0
- package/dist/src/app/webui/.next/{static/chunks/app/playground/page-c51bb3cc58225dc3.js → standalone/.next/static/chunks/app/playground/page-07a79d22b26d37f4.js} +1 -1
- package/dist/src/app/webui/.next/standalone/.next/static/css/c1d26dc78adbeb53.css +3 -0
- package/dist/src/app/webui/.next/standalone/package.json +3 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/BUILD_ID +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/app-build-manifest.json +9 -9
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/build-manifest.json +2 -2
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/prerender-manifest.json +3 -3
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/required-server-files.json +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/page.js +3 -4
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/page.js.nft.json +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/playground/page.js +2 -2
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/playground/page.js.nft.json +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/playground/page_client-reference-manifest.js +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/chunks/213.js +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/chunks/489.js +1 -0
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/pages/500.html +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/server-reference-manifest.json +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/122-4d4c8aa883d114a2.js +1 -0
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/216-f5dbf2145a48ae92.js +1 -0
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/43-4f3d01c7feaf132f.js +1 -0
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/app/{layout-43f98b6d34953fcf.js → layout-36c240720861a312.js} +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/app/page-ca08c66042cb54c8.js +1 -0
- package/dist/src/app/webui/.next/standalone/{.next/static/chunks/app/playground/page-c51bb3cc58225dc3.js → src/app/webui/.next/static/chunks/app/playground/page-07a79d22b26d37f4.js} +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/css/c1d26dc78adbeb53.css +3 -0
- package/dist/src/app/webui/.next/standalone/src/app/webui/server.js +1 -1
- package/dist/src/app/webui/.next/static/chunks/122-4d4c8aa883d114a2.js +1 -0
- package/dist/src/app/webui/.next/static/chunks/216-f5dbf2145a48ae92.js +1 -0
- package/dist/src/app/webui/.next/static/chunks/43-4f3d01c7feaf132f.js +1 -0
- package/dist/src/app/webui/.next/static/chunks/app/{layout-43f98b6d34953fcf.js → layout-36c240720861a312.js} +1 -1
- package/dist/src/app/webui/.next/static/chunks/app/page-ca08c66042cb54c8.js +1 -0
- package/dist/src/app/webui/.next/{standalone/src/app/webui/.next/static/chunks/app/playground/page-c51bb3cc58225dc3.js → static/chunks/app/playground/page-07a79d22b26d37f4.js} +1 -1
- package/dist/src/app/webui/.next/static/css/c1d26dc78adbeb53.css +3 -0
- package/dist/src/core/{chunk-2O5JENNA.js → chunk-XABD32T2.js} +318 -35
- package/dist/src/core/index.cjs +320 -35
- package/dist/src/core/index.d.cts +3 -0
- package/dist/src/core/index.d.ts +3 -0
- package/dist/src/core/index.js +1 -1
- package/dist/src/core/{sqlite-backend-4KSJRUVL.js → sqlite-backend-3VNBKYIT.js} +1 -1
- package/package.json +3 -1
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/262-807eb8fa558ce992.js +0 -1
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/42-ae0665ff0534f075.js +0 -1
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/500-99efaae6ea436094.js +0 -1
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/app/page-77c27b87857033eb.js +0 -1
- package/dist/src/app/webui/.next/standalone/.next/static/css/3d91ad5ec330296f.css +0 -3
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/chunks/950.js +0 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/262-807eb8fa558ce992.js +0 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/42-ae0665ff0534f075.js +0 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/500-99efaae6ea436094.js +0 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/app/page-77c27b87857033eb.js +0 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/css/3d91ad5ec330296f.css +0 -3
- package/dist/src/app/webui/.next/static/chunks/262-807eb8fa558ce992.js +0 -1
- package/dist/src/app/webui/.next/static/chunks/42-ae0665ff0534f075.js +0 -1
- package/dist/src/app/webui/.next/static/chunks/500-99efaae6ea436094.js +0 -1
- package/dist/src/app/webui/.next/static/chunks/app/page-77c27b87857033eb.js +0 -1
- package/dist/src/app/webui/.next/static/css/3d91ad5ec330296f.css +0 -3
- /package/dist/src/app/webui/.next/standalone/.next/static/{sig2NLqxammCphOh8eQRQ → RkBbxCa0lrWNsf3yPd4rX}/_buildManifest.js +0 -0
- /package/dist/src/app/webui/.next/standalone/.next/static/{sig2NLqxammCphOh8eQRQ → RkBbxCa0lrWNsf3yPd4rX}/_ssgManifest.js +0 -0
- /package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/{sig2NLqxammCphOh8eQRQ → RkBbxCa0lrWNsf3yPd4rX}/_buildManifest.js +0 -0
- /package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/{sig2NLqxammCphOh8eQRQ → RkBbxCa0lrWNsf3yPd4rX}/_ssgManifest.js +0 -0
- /package/dist/src/app/webui/.next/static/{sig2NLqxammCphOh8eQRQ → RkBbxCa0lrWNsf3yPd4rX}/_buildManifest.js +0 -0
- /package/dist/src/app/webui/.next/static/{sig2NLqxammCphOh8eQRQ → RkBbxCa0lrWNsf3yPd4rX}/_ssgManifest.js +0 -0
package/dist/src/core/index.cjs
CHANGED
|
@@ -2195,10 +2195,19 @@ ${source_default.white(JSON.stringify(args, null, 2))}`,
|
|
|
2195
2195
|
borderColor = "red";
|
|
2196
2196
|
title = "\u274C Tool Error";
|
|
2197
2197
|
} else if (typeof result === "string") {
|
|
2198
|
-
|
|
2198
|
+
if (result.length > 1e3) {
|
|
2199
|
+
displayText = `${result.slice(0, 500)}... [${result.length - 500} chars omitted]`;
|
|
2200
|
+
} else {
|
|
2201
|
+
displayText = result;
|
|
2202
|
+
}
|
|
2199
2203
|
} else {
|
|
2200
2204
|
try {
|
|
2201
|
-
|
|
2205
|
+
const resultStr = JSON.stringify(result, null, 2);
|
|
2206
|
+
if (resultStr.length > 2e3) {
|
|
2207
|
+
displayText = `${resultStr.slice(0, 1e3)}... [${resultStr.length - 1e3} chars omitted]`;
|
|
2208
|
+
} else {
|
|
2209
|
+
displayText = resultStr;
|
|
2210
|
+
}
|
|
2202
2211
|
} catch {
|
|
2203
2212
|
displayText = `[Unparseable result: ${typeof result}]`;
|
|
2204
2213
|
}
|
|
@@ -2730,7 +2739,17 @@ var init_mcp_client = __esm({
|
|
|
2730
2739
|
{ timeout: this.timeout }
|
|
2731
2740
|
// Use server-specific timeout, default 1 minute
|
|
2732
2741
|
);
|
|
2733
|
-
|
|
2742
|
+
const logResult = JSON.stringify(
|
|
2743
|
+
result,
|
|
2744
|
+
(key, value) => {
|
|
2745
|
+
if (key === "data" && typeof value === "string" && value.length > 100) {
|
|
2746
|
+
return `[Base64 data: ${value.length} chars]`;
|
|
2747
|
+
}
|
|
2748
|
+
return value;
|
|
2749
|
+
},
|
|
2750
|
+
2
|
|
2751
|
+
);
|
|
2752
|
+
logger.debug(`Tool '${name}' result: ${logResult}`);
|
|
2734
2753
|
if (result === null || result === void 0) {
|
|
2735
2754
|
return "Tool executed successfully with no result data.";
|
|
2736
2755
|
}
|
|
@@ -6310,16 +6329,26 @@ function countMessagesTokens(history, tokenizer, overheadPerMessage = DEFAULT_OV
|
|
|
6310
6329
|
total += tokenizer.countTokens(part.text);
|
|
6311
6330
|
} else if (part.type === "image") {
|
|
6312
6331
|
if (typeof part.image === "string") {
|
|
6313
|
-
|
|
6314
|
-
|
|
6332
|
+
if (isDataUri(part.image)) {
|
|
6333
|
+
const base64Payload = extractBase64FromDataUri(part.image);
|
|
6334
|
+
const byteLength = base64LengthToBytes(base64Payload.length);
|
|
6335
|
+
total += Math.ceil(byteLength / 1024);
|
|
6336
|
+
} else {
|
|
6337
|
+
total += estimateTextTokens(part.image);
|
|
6338
|
+
}
|
|
6315
6339
|
} else if (part.image instanceof Uint8Array || part.image instanceof Buffer || part.image instanceof ArrayBuffer) {
|
|
6316
6340
|
const bytes = part.image instanceof ArrayBuffer ? part.image.byteLength : part.image.length;
|
|
6317
6341
|
total += Math.ceil(bytes / 1024);
|
|
6318
6342
|
}
|
|
6319
6343
|
} else if (part.type === "file") {
|
|
6320
6344
|
if (typeof part.data === "string") {
|
|
6321
|
-
|
|
6322
|
-
|
|
6345
|
+
if (isDataUri(part.data)) {
|
|
6346
|
+
const base64Payload = extractBase64FromDataUri(part.data);
|
|
6347
|
+
const byteLength = base64LengthToBytes(base64Payload.length);
|
|
6348
|
+
total += Math.ceil(byteLength / 1024);
|
|
6349
|
+
} else {
|
|
6350
|
+
total += estimateTextTokens(part.data);
|
|
6351
|
+
}
|
|
6323
6352
|
} else if (part.data instanceof Uint8Array || part.data instanceof Buffer || part.data instanceof ArrayBuffer) {
|
|
6324
6353
|
const bytes = part.data instanceof ArrayBuffer ? part.data.byteLength : part.data.length;
|
|
6325
6354
|
total += Math.ceil(bytes / 1024);
|
|
@@ -6361,7 +6390,7 @@ function getImageData(imagePart) {
|
|
|
6361
6390
|
} else if (image instanceof URL) {
|
|
6362
6391
|
return image.toString();
|
|
6363
6392
|
}
|
|
6364
|
-
|
|
6393
|
+
logger.warn(`Unexpected image data type in getImageData: ${typeof image}`);
|
|
6365
6394
|
return "";
|
|
6366
6395
|
}
|
|
6367
6396
|
function getFileData(filePart) {
|
|
@@ -6377,7 +6406,7 @@ function getFileData(filePart) {
|
|
|
6377
6406
|
} else if (data instanceof URL) {
|
|
6378
6407
|
return data.toString();
|
|
6379
6408
|
}
|
|
6380
|
-
|
|
6409
|
+
logger.warn(`Unexpected file data type in getFileData: ${typeof data}`);
|
|
6381
6410
|
return "";
|
|
6382
6411
|
}
|
|
6383
6412
|
function filterMessagesByLLMCapabilities(messages, config) {
|
|
@@ -6412,11 +6441,237 @@ function filterMessagesByLLMCapabilities(messages, config) {
|
|
|
6412
6441
|
};
|
|
6413
6442
|
});
|
|
6414
6443
|
} catch (error) {
|
|
6415
|
-
|
|
6444
|
+
logger.warn(`Failed to filter messages by LLM capabilities: ${String(error)}`);
|
|
6416
6445
|
return messages;
|
|
6417
6446
|
}
|
|
6418
6447
|
}
|
|
6419
|
-
|
|
6448
|
+
function isLikelyBase64String(value, minLength = MIN_BASE64_HEURISTIC_LENGTH) {
|
|
6449
|
+
if (!value || value.length < minLength) return false;
|
|
6450
|
+
if (value.startsWith("data:") && value.includes(";base64,")) return true;
|
|
6451
|
+
const b64Regex = /^[A-Za-z0-9+/=\r\n]+$/;
|
|
6452
|
+
if (!b64Regex.test(value)) return false;
|
|
6453
|
+
const nonWordRatio = (value.match(/[^A-Za-z0-9+/=]/g)?.length || 0) / value.length;
|
|
6454
|
+
return nonWordRatio < 0.01;
|
|
6455
|
+
}
|
|
6456
|
+
function parseDataUri(value) {
|
|
6457
|
+
if (!value.startsWith("data:")) return null;
|
|
6458
|
+
const commaIdx = value.indexOf(",");
|
|
6459
|
+
if (commaIdx === -1) return null;
|
|
6460
|
+
const meta = value.slice(5, commaIdx);
|
|
6461
|
+
if (!/;base64$/i.test(meta)) return null;
|
|
6462
|
+
const mediaType = meta.replace(/;base64$/i, "") || "application/octet-stream";
|
|
6463
|
+
const base64 = value.slice(commaIdx + 1);
|
|
6464
|
+
return { mediaType, base64 };
|
|
6465
|
+
}
|
|
6466
|
+
function sanitizeDeepObject(obj) {
|
|
6467
|
+
if (obj == null) return obj;
|
|
6468
|
+
if (typeof obj === "string") {
|
|
6469
|
+
if (isLikelyBase64String(obj)) {
|
|
6470
|
+
const approxBytes = Math.floor(obj.length * 3 / 4);
|
|
6471
|
+
logger.debug(
|
|
6472
|
+
`sanitizeDeepObject: replaced large base64 string (~${approxBytes} bytes) with placeholder`
|
|
6473
|
+
);
|
|
6474
|
+
return `[binary data omitted ~${approxBytes} bytes]`;
|
|
6475
|
+
}
|
|
6476
|
+
return obj;
|
|
6477
|
+
}
|
|
6478
|
+
if (Array.isArray(obj)) return obj.map((x) => sanitizeDeepObject(x));
|
|
6479
|
+
if (typeof obj === "object") {
|
|
6480
|
+
const out = {};
|
|
6481
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
6482
|
+
out[k] = sanitizeDeepObject(v);
|
|
6483
|
+
}
|
|
6484
|
+
return out;
|
|
6485
|
+
}
|
|
6486
|
+
return obj;
|
|
6487
|
+
}
|
|
6488
|
+
function sanitizeToolResultToContent(result) {
|
|
6489
|
+
try {
|
|
6490
|
+
if (typeof result === "string") {
|
|
6491
|
+
const dataUri = parseDataUri(result);
|
|
6492
|
+
if (dataUri) {
|
|
6493
|
+
const mediaType = dataUri.mediaType;
|
|
6494
|
+
logger.debug(
|
|
6495
|
+
`sanitizeToolResultToContent: detected data URI (${mediaType}), converting to media part`
|
|
6496
|
+
);
|
|
6497
|
+
if (mediaType.startsWith("image/")) {
|
|
6498
|
+
return [{ type: "image", image: dataUri.base64, mimeType: mediaType }];
|
|
6499
|
+
}
|
|
6500
|
+
return [{ type: "file", data: dataUri.base64, mimeType: mediaType }];
|
|
6501
|
+
}
|
|
6502
|
+
if (isLikelyBase64String(result)) {
|
|
6503
|
+
logger.debug(
|
|
6504
|
+
"sanitizeToolResultToContent: detected base64-like string, converting to file part"
|
|
6505
|
+
);
|
|
6506
|
+
return [
|
|
6507
|
+
{
|
|
6508
|
+
type: "file",
|
|
6509
|
+
data: result,
|
|
6510
|
+
mimeType: "application/octet-stream",
|
|
6511
|
+
filename: "tool-output.bin"
|
|
6512
|
+
}
|
|
6513
|
+
];
|
|
6514
|
+
}
|
|
6515
|
+
if (result.length > MAX_TOOL_TEXT_CHARS) {
|
|
6516
|
+
const head = result.slice(0, 4e3);
|
|
6517
|
+
const tail = result.slice(-1e3);
|
|
6518
|
+
logger.debug(
|
|
6519
|
+
`sanitizeToolResultToContent: truncating long text tool output (len=${result.length})`
|
|
6520
|
+
);
|
|
6521
|
+
return `${head}
|
|
6522
|
+
... [${result.length - 5e3} chars omitted] ...
|
|
6523
|
+
${tail}`;
|
|
6524
|
+
}
|
|
6525
|
+
return result;
|
|
6526
|
+
}
|
|
6527
|
+
if (Array.isArray(result)) {
|
|
6528
|
+
const parts = [];
|
|
6529
|
+
for (const item of result) {
|
|
6530
|
+
if (item == null) continue;
|
|
6531
|
+
if (typeof item === "string") {
|
|
6532
|
+
const dataUri = parseDataUri(item);
|
|
6533
|
+
if (dataUri) {
|
|
6534
|
+
const mt = dataUri.mediaType;
|
|
6535
|
+
if (mt.startsWith("image/"))
|
|
6536
|
+
parts.push({ type: "image", image: dataUri.base64, mimeType: mt });
|
|
6537
|
+
else parts.push({ type: "file", data: dataUri.base64, mimeType: mt });
|
|
6538
|
+
continue;
|
|
6539
|
+
}
|
|
6540
|
+
if (isLikelyBase64String(item)) {
|
|
6541
|
+
parts.push({
|
|
6542
|
+
type: "file",
|
|
6543
|
+
data: item,
|
|
6544
|
+
mimeType: "application/octet-stream",
|
|
6545
|
+
filename: "tool-output.bin"
|
|
6546
|
+
});
|
|
6547
|
+
continue;
|
|
6548
|
+
}
|
|
6549
|
+
parts.push({ type: "text", text: item });
|
|
6550
|
+
continue;
|
|
6551
|
+
}
|
|
6552
|
+
if (typeof item === "object") {
|
|
6553
|
+
const obj = item;
|
|
6554
|
+
if (obj.type === "text" && typeof obj.text === "string") {
|
|
6555
|
+
parts.push({ type: "text", text: obj.text });
|
|
6556
|
+
continue;
|
|
6557
|
+
}
|
|
6558
|
+
if (obj.type === "image" && obj.image !== void 0 || "image" in obj) {
|
|
6559
|
+
parts.push({
|
|
6560
|
+
type: "image",
|
|
6561
|
+
image: getImageData({ image: obj.image }),
|
|
6562
|
+
mimeType: obj.mimeType || "image/jpeg"
|
|
6563
|
+
});
|
|
6564
|
+
continue;
|
|
6565
|
+
}
|
|
6566
|
+
if (obj.type === "file" && obj.data !== void 0) {
|
|
6567
|
+
parts.push({
|
|
6568
|
+
type: "file",
|
|
6569
|
+
data: getFileData({ data: obj.data }),
|
|
6570
|
+
mimeType: obj.mimeType || "application/octet-stream",
|
|
6571
|
+
filename: obj.filename
|
|
6572
|
+
});
|
|
6573
|
+
continue;
|
|
6574
|
+
}
|
|
6575
|
+
if ("data" in obj && (typeof obj.mimeType === "string" || obj.filename)) {
|
|
6576
|
+
parts.push({
|
|
6577
|
+
type: "file",
|
|
6578
|
+
data: getFileData({ data: obj.data }),
|
|
6579
|
+
mimeType: obj.mimeType || "application/octet-stream",
|
|
6580
|
+
filename: obj.filename
|
|
6581
|
+
});
|
|
6582
|
+
continue;
|
|
6583
|
+
}
|
|
6584
|
+
const cleaned = sanitizeDeepObject(obj);
|
|
6585
|
+
parts.push({ type: "text", text: safeStringify(cleaned) });
|
|
6586
|
+
continue;
|
|
6587
|
+
}
|
|
6588
|
+
parts.push({ type: "text", text: String(item) });
|
|
6589
|
+
}
|
|
6590
|
+
return parts;
|
|
6591
|
+
}
|
|
6592
|
+
if (result && typeof result === "object") {
|
|
6593
|
+
const anyObj = result;
|
|
6594
|
+
if ("image" in anyObj) {
|
|
6595
|
+
return [
|
|
6596
|
+
{
|
|
6597
|
+
type: "image",
|
|
6598
|
+
image: getImageData({ image: anyObj.image }),
|
|
6599
|
+
mimeType: anyObj.mimeType || "image/jpeg"
|
|
6600
|
+
}
|
|
6601
|
+
];
|
|
6602
|
+
}
|
|
6603
|
+
if ("data" in anyObj && anyObj.mimeType) {
|
|
6604
|
+
return [
|
|
6605
|
+
{
|
|
6606
|
+
type: "file",
|
|
6607
|
+
data: getFileData({ data: anyObj.data }),
|
|
6608
|
+
mimeType: anyObj.mimeType,
|
|
6609
|
+
filename: anyObj.filename
|
|
6610
|
+
}
|
|
6611
|
+
];
|
|
6612
|
+
}
|
|
6613
|
+
const cleaned = sanitizeDeepObject(anyObj);
|
|
6614
|
+
return safeStringify(cleaned);
|
|
6615
|
+
}
|
|
6616
|
+
return safeStringify(result ?? "");
|
|
6617
|
+
} catch (err) {
|
|
6618
|
+
logger.warn(`sanitizeToolResultToContent failed, falling back to string: ${String(err)}`);
|
|
6619
|
+
try {
|
|
6620
|
+
return safeStringify(result ?? "");
|
|
6621
|
+
} catch {
|
|
6622
|
+
return String(result ?? "");
|
|
6623
|
+
}
|
|
6624
|
+
}
|
|
6625
|
+
}
|
|
6626
|
+
function summarizeToolContentForText(content) {
|
|
6627
|
+
if (!Array.isArray(content)) return String(content || "");
|
|
6628
|
+
const parts = [];
|
|
6629
|
+
for (const p of content) {
|
|
6630
|
+
if (p.type === "text") {
|
|
6631
|
+
parts.push(p.text);
|
|
6632
|
+
} else if (p.type === "image") {
|
|
6633
|
+
let bytes = 0;
|
|
6634
|
+
if (typeof p.image === "string") bytes = Math.floor(p.image.length * 3 / 4);
|
|
6635
|
+
else if (p.image instanceof ArrayBuffer) bytes = p.image.byteLength;
|
|
6636
|
+
else if (p.image instanceof Uint8Array) bytes = p.image.length;
|
|
6637
|
+
else if (p.image instanceof Buffer) bytes = p.image.length;
|
|
6638
|
+
parts.push(`[image ${p.mimeType || "image"} ~${Math.ceil(bytes / 1024)}KB]`);
|
|
6639
|
+
} else if (p.type === "file") {
|
|
6640
|
+
let bytes = 0;
|
|
6641
|
+
if (typeof p.data === "string") bytes = Math.floor(p.data.length * 3 / 4);
|
|
6642
|
+
else if (p.data instanceof ArrayBuffer) bytes = p.data.byteLength;
|
|
6643
|
+
else if (p.data instanceof Uint8Array) bytes = p.data.length;
|
|
6644
|
+
else if (p.data instanceof Buffer) bytes = p.data.length;
|
|
6645
|
+
const label = p.filename ? `${p.filename}` : `${p.mimeType || "file"}`;
|
|
6646
|
+
parts.push(`[file ${label} ~${Math.ceil(bytes / 1024)}KB]`);
|
|
6647
|
+
}
|
|
6648
|
+
}
|
|
6649
|
+
const summary = parts.join("\n");
|
|
6650
|
+
return summary.slice(0, 4e3);
|
|
6651
|
+
}
|
|
6652
|
+
function base64LengthToBytes(charLength) {
|
|
6653
|
+
return Math.floor(charLength * 3 / 4);
|
|
6654
|
+
}
|
|
6655
|
+
function isDataUri(str) {
|
|
6656
|
+
return str.startsWith("data:") && str.includes(";base64,");
|
|
6657
|
+
}
|
|
6658
|
+
function extractBase64FromDataUri(dataUri) {
|
|
6659
|
+
const commaIndex = dataUri.indexOf(",");
|
|
6660
|
+
return commaIndex !== -1 ? dataUri.substring(commaIndex + 1) : "";
|
|
6661
|
+
}
|
|
6662
|
+
function estimateTextTokens(text) {
|
|
6663
|
+
return Math.ceil(text.length / 4);
|
|
6664
|
+
}
|
|
6665
|
+
function toTextForToolMessage(content) {
|
|
6666
|
+
if (Array.isArray(content)) {
|
|
6667
|
+
return summarizeToolContentForText(content);
|
|
6668
|
+
}
|
|
6669
|
+
if (typeof content === "string") {
|
|
6670
|
+
return isLikelyBase64String(content) ? "[binary data omitted]" : content;
|
|
6671
|
+
}
|
|
6672
|
+
return String(content ?? "");
|
|
6673
|
+
}
|
|
6674
|
+
var DEFAULT_OVERHEAD_PER_MESSAGE, MIN_BASE64_HEURISTIC_LENGTH, MAX_TOOL_TEXT_CHARS;
|
|
6420
6675
|
var init_utils = __esm({
|
|
6421
6676
|
"src/core/context/utils.ts"() {
|
|
6422
6677
|
"use strict";
|
|
@@ -6424,7 +6679,10 @@ var init_utils = __esm({
|
|
|
6424
6679
|
init_logger2();
|
|
6425
6680
|
init_registry3();
|
|
6426
6681
|
init_errors7();
|
|
6682
|
+
init_safe_stringify();
|
|
6427
6683
|
DEFAULT_OVERHEAD_PER_MESSAGE = 4;
|
|
6684
|
+
MIN_BASE64_HEURISTIC_LENGTH = 512;
|
|
6685
|
+
MAX_TOOL_TEXT_CHARS = 8e3;
|
|
6428
6686
|
}
|
|
6429
6687
|
});
|
|
6430
6688
|
|
|
@@ -6869,21 +7127,17 @@ ${prompt}`);
|
|
|
6869
7127
|
throw ContextError.toolCallIdNameRequired();
|
|
6870
7128
|
}
|
|
6871
7129
|
let content;
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
} else if (Array.isArray(result)) {
|
|
6884
|
-
content = result;
|
|
6885
|
-
} else {
|
|
6886
|
-
content = JSON.stringify(result ?? "");
|
|
7130
|
+
content = sanitizeToolResultToContent(result);
|
|
7131
|
+
if (typeof content === "string") {
|
|
7132
|
+
const preview = content.slice(0, 200);
|
|
7133
|
+
logger.debug(
|
|
7134
|
+
`ContextManager: Storing tool result (text) for ${name} (len=${content.length}): ${preview}${content.length > 200 ? "..." : ""}`
|
|
7135
|
+
);
|
|
7136
|
+
} else if (Array.isArray(content)) {
|
|
7137
|
+
const summary = content.map(
|
|
7138
|
+
(p) => p.type === "text" ? `text(${p.text.length})` : p.type === "image" ? `image(${p.mimeType || "image"})` : `file(${p.mimeType || "file"})`
|
|
7139
|
+
).join(", ");
|
|
7140
|
+
logger.debug(`ContextManager: Storing tool result (parts) for ${name}: [${summary}]`);
|
|
6887
7141
|
}
|
|
6888
7142
|
await this.addMessage({ role: "tool", content, toolCallId, name });
|
|
6889
7143
|
}
|
|
@@ -7698,6 +7952,7 @@ var init_vercel2 = __esm({
|
|
|
7698
7952
|
init_logger2();
|
|
7699
7953
|
import_ai2 = require("ai");
|
|
7700
7954
|
init_manager3();
|
|
7955
|
+
init_utils();
|
|
7701
7956
|
init_registry3();
|
|
7702
7957
|
init_DextoRuntimeError();
|
|
7703
7958
|
init_error_codes5();
|
|
@@ -7714,6 +7969,8 @@ var init_vercel2 = __esm({
|
|
|
7714
7969
|
sessionEventBus;
|
|
7715
7970
|
sessionId;
|
|
7716
7971
|
toolSupportCache = /* @__PURE__ */ new Map();
|
|
7972
|
+
// Map of toolCallId -> queue of raw results to emit with that callId
|
|
7973
|
+
rawResultsByCallId = /* @__PURE__ */ new Map();
|
|
7717
7974
|
/**
|
|
7718
7975
|
* Helper to extract model ID from LanguageModel union type (string | LanguageModelV2)
|
|
7719
7976
|
*/
|
|
@@ -7752,13 +8009,20 @@ var init_vercel2 = __esm({
|
|
|
7752
8009
|
if (tool) {
|
|
7753
8010
|
acc[toolName] = {
|
|
7754
8011
|
inputSchema: (0, import_ai2.jsonSchema)(tool.parameters),
|
|
7755
|
-
execute: async (args) => {
|
|
8012
|
+
execute: async (args, options) => {
|
|
7756
8013
|
try {
|
|
7757
|
-
|
|
8014
|
+
const rawResult = await this.toolManager.executeTool(
|
|
7758
8015
|
toolName,
|
|
7759
8016
|
args,
|
|
7760
8017
|
this.sessionId
|
|
7761
8018
|
);
|
|
8019
|
+
const callId = options.toolCallId;
|
|
8020
|
+
const queue = this.rawResultsByCallId.get(callId) ?? [];
|
|
8021
|
+
queue.push(rawResult);
|
|
8022
|
+
this.rawResultsByCallId.set(callId, queue);
|
|
8023
|
+
const safeContent = sanitizeToolResultToContent(rawResult);
|
|
8024
|
+
const summaryText = summarizeToolContentForText(safeContent);
|
|
8025
|
+
return summaryText;
|
|
7762
8026
|
} catch (err) {
|
|
7763
8027
|
if (err instanceof DextoRuntimeError && err.code === "tools_execution_denied" /* EXECUTION_DENIED */) {
|
|
7764
8028
|
return { error: err.message, denied: true };
|
|
@@ -7912,10 +8176,19 @@ var init_vercel2 = __esm({
|
|
|
7912
8176
|
}
|
|
7913
8177
|
if (step.toolResults && step.toolResults.length > 0) {
|
|
7914
8178
|
for (const toolResult of step.toolResults) {
|
|
8179
|
+
const callId = toolResult.toolCallId;
|
|
8180
|
+
const sanitized = toolResult.output;
|
|
8181
|
+
let raw;
|
|
8182
|
+
if (callId) {
|
|
8183
|
+
const q = this.rawResultsByCallId.get(callId) ?? [];
|
|
8184
|
+
raw = q.shift();
|
|
8185
|
+
if (q.length > 0) this.rawResultsByCallId.set(callId, q);
|
|
8186
|
+
else this.rawResultsByCallId.delete(callId);
|
|
8187
|
+
}
|
|
7915
8188
|
this.sessionEventBus.emit("llmservice:toolResult", {
|
|
7916
8189
|
toolName: toolResult.toolName,
|
|
7917
|
-
result:
|
|
7918
|
-
callId
|
|
8190
|
+
result: raw ?? sanitized,
|
|
8191
|
+
callId,
|
|
7919
8192
|
success: true
|
|
7920
8193
|
});
|
|
7921
8194
|
}
|
|
@@ -8080,10 +8353,19 @@ var init_vercel2 = __esm({
|
|
|
8080
8353
|
}
|
|
8081
8354
|
if (step.toolResults && step.toolResults.length > 0) {
|
|
8082
8355
|
for (const toolResult of step.toolResults) {
|
|
8356
|
+
const callId = toolResult.toolCallId;
|
|
8357
|
+
const sanitized = toolResult.output;
|
|
8358
|
+
let raw;
|
|
8359
|
+
if (callId) {
|
|
8360
|
+
const q = this.rawResultsByCallId.get(callId) ?? [];
|
|
8361
|
+
raw = q.shift();
|
|
8362
|
+
if (q.length > 0) this.rawResultsByCallId.set(callId, q);
|
|
8363
|
+
else this.rawResultsByCallId.delete(callId);
|
|
8364
|
+
}
|
|
8083
8365
|
this.sessionEventBus.emit("llmservice:toolResult", {
|
|
8084
8366
|
toolName: toolResult.toolName,
|
|
8085
|
-
result:
|
|
8086
|
-
callId
|
|
8367
|
+
result: raw ?? sanitized,
|
|
8368
|
+
callId,
|
|
8087
8369
|
success: true
|
|
8088
8370
|
});
|
|
8089
8371
|
}
|
|
@@ -8229,7 +8511,7 @@ var init_openai2 = __esm({
|
|
|
8229
8511
|
case "tool":
|
|
8230
8512
|
formatted.push({
|
|
8231
8513
|
role: "tool",
|
|
8232
|
-
content:
|
|
8514
|
+
content: toTextForToolMessage(msg.content),
|
|
8233
8515
|
tool_call_id: msg.toolCallId || ""
|
|
8234
8516
|
});
|
|
8235
8517
|
break;
|
|
@@ -8818,13 +9100,14 @@ var init_anthropic2 = __esm({
|
|
|
8818
9100
|
formatted.push(pendingCall.assistantMsg);
|
|
8819
9101
|
pendingCall.assistantMsg = null;
|
|
8820
9102
|
}
|
|
9103
|
+
const safeContent = toTextForToolMessage(msg.content);
|
|
8821
9104
|
const toolResultMsg = {
|
|
8822
9105
|
role: "user",
|
|
8823
9106
|
content: [
|
|
8824
9107
|
{
|
|
8825
9108
|
type: "tool_result",
|
|
8826
9109
|
tool_use_id: msg.toolCallId,
|
|
8827
|
-
content:
|
|
9110
|
+
content: safeContent
|
|
8828
9111
|
}
|
|
8829
9112
|
]
|
|
8830
9113
|
};
|
|
@@ -8832,13 +9115,14 @@ var init_anthropic2 = __esm({
|
|
|
8832
9115
|
pendingToolCalls.delete(msg.toolCallId);
|
|
8833
9116
|
} else {
|
|
8834
9117
|
logger.warn(`Tool result found without matching tool call: ${msg.toolCallId}`);
|
|
9118
|
+
const orphanSafe = toTextForToolMessage(msg.content);
|
|
8835
9119
|
const orphanToolResult = {
|
|
8836
9120
|
role: "user",
|
|
8837
9121
|
content: [
|
|
8838
9122
|
{
|
|
8839
9123
|
type: "tool_result",
|
|
8840
9124
|
tool_use_id: msg.toolCallId,
|
|
8841
|
-
content:
|
|
9125
|
+
content: orphanSafe
|
|
8842
9126
|
}
|
|
8843
9127
|
]
|
|
8844
9128
|
};
|
|
@@ -13040,6 +13324,7 @@ var init_schemas7 = __esm({
|
|
|
13040
13324
|
}).strict();
|
|
13041
13325
|
AgentConfigSchema = import_zod10.z.object({
|
|
13042
13326
|
agentCard: AgentCardSchema.describe("Configuration for the agent card").optional(),
|
|
13327
|
+
greeting: import_zod10.z.string().max(500).optional().describe("Default greeting text to show when a chat starts (for UI consumption)"),
|
|
13043
13328
|
systemPrompt: SystemPromptConfigSchema.describe(
|
|
13044
13329
|
"System prompt: string shorthand or structured config"
|
|
13045
13330
|
),
|
|
@@ -2448,6 +2448,7 @@ declare const AgentConfigSchema: z.ZodBranded<z.ZodObject<{
|
|
|
2448
2448
|
outputModes?: string[] | undefined;
|
|
2449
2449
|
}[] | undefined;
|
|
2450
2450
|
}>>;
|
|
2451
|
+
greeting: z.ZodOptional<z.ZodString>;
|
|
2451
2452
|
systemPrompt: z.ZodBranded<z.ZodUnion<[z.ZodEffects<z.ZodString, {
|
|
2452
2453
|
contributors: {
|
|
2453
2454
|
id: string;
|
|
@@ -3497,6 +3498,7 @@ declare const AgentConfigSchema: z.ZodBranded<z.ZodObject<{
|
|
|
3497
3498
|
} | undefined;
|
|
3498
3499
|
documentationUrl?: string | undefined;
|
|
3499
3500
|
} | undefined;
|
|
3501
|
+
greeting?: string | undefined;
|
|
3500
3502
|
}, {
|
|
3501
3503
|
llm: {
|
|
3502
3504
|
apiKey: string;
|
|
@@ -3650,6 +3652,7 @@ declare const AgentConfigSchema: z.ZodBranded<z.ZodObject<{
|
|
|
3650
3652
|
outputModes?: string[] | undefined;
|
|
3651
3653
|
}[] | undefined;
|
|
3652
3654
|
} | undefined;
|
|
3655
|
+
greeting?: string | undefined;
|
|
3653
3656
|
mcpServers?: Record<string, {
|
|
3654
3657
|
type: "stdio";
|
|
3655
3658
|
command: string;
|
package/dist/src/core/index.d.ts
CHANGED
|
@@ -2448,6 +2448,7 @@ declare const AgentConfigSchema: z.ZodBranded<z.ZodObject<{
|
|
|
2448
2448
|
outputModes?: string[] | undefined;
|
|
2449
2449
|
}[] | undefined;
|
|
2450
2450
|
}>>;
|
|
2451
|
+
greeting: z.ZodOptional<z.ZodString>;
|
|
2451
2452
|
systemPrompt: z.ZodBranded<z.ZodUnion<[z.ZodEffects<z.ZodString, {
|
|
2452
2453
|
contributors: {
|
|
2453
2454
|
id: string;
|
|
@@ -3497,6 +3498,7 @@ declare const AgentConfigSchema: z.ZodBranded<z.ZodObject<{
|
|
|
3497
3498
|
} | undefined;
|
|
3498
3499
|
documentationUrl?: string | undefined;
|
|
3499
3500
|
} | undefined;
|
|
3501
|
+
greeting?: string | undefined;
|
|
3500
3502
|
}, {
|
|
3501
3503
|
llm: {
|
|
3502
3504
|
apiKey: string;
|
|
@@ -3650,6 +3652,7 @@ declare const AgentConfigSchema: z.ZodBranded<z.ZodObject<{
|
|
|
3650
3652
|
outputModes?: string[] | undefined;
|
|
3651
3653
|
}[] | undefined;
|
|
3652
3654
|
} | undefined;
|
|
3655
|
+
greeting?: string | undefined;
|
|
3653
3656
|
mcpServers?: Record<string, {
|
|
3654
3657
|
type: "stdio";
|
|
3655
3658
|
command: string;
|
package/dist/src/core/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dexto",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20.0.0",
|
|
6
6
|
"npm": ">=8.3.0"
|
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
"agents/music-agent/",
|
|
73
73
|
"agents/product-name-researcher/",
|
|
74
74
|
"agents/triage-demo/",
|
|
75
|
+
"agents/nano-banana-agent/",
|
|
76
|
+
"agents/podcast-agent/",
|
|
75
77
|
"public/"
|
|
76
78
|
],
|
|
77
79
|
"dependencies": {
|