dexto 1.1.1 → 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.
Files changed (114) hide show
  1. package/README.md +270 -160
  2. package/agents/agent-registry.json +16 -2
  3. package/agents/agent-template.yml +6 -12
  4. package/agents/default-agent.yml +6 -16
  5. package/agents/nano-banana-agent/README.md +200 -0
  6. package/agents/nano-banana-agent/nano-banana-agent.yml +68 -0
  7. package/agents/podcast-agent/README.md +168 -0
  8. package/agents/podcast-agent/podcast-agent.yml +167 -0
  9. package/agents/triage-demo/billing-agent.yml +2 -2
  10. package/agents/triage-demo/product-info-agent.yml +2 -3
  11. package/agents/triage-demo/technical-support-agent.yml +2 -3
  12. package/dist/src/app/{chunk-OIBH674O.js → chunk-BKF5BGLX.js} +318 -35
  13. package/dist/src/app/{chunk-FVWAYUL4.js → chunk-N7FUUBGT.js} +1 -1
  14. package/dist/src/app/{chunk-UG5P4DIL.js → chunk-OONTQZRM.js} +2 -2
  15. package/dist/src/app/{cli-confirmation-handler-7BZ6BMSE.js → cli-confirmation-handler-7235V7GL.js} +1 -1
  16. package/dist/src/app/{errors-EYGUMLKB.js → errors-YCS63OK6.js} +1 -1
  17. package/dist/src/app/index.js +33 -13
  18. package/dist/src/app/{loader-LJJQ4NDP.js → loader-PVRMNHST.js} +2 -2
  19. package/dist/src/app/{path-O5L5AW7V.js → path-DJ5C7EUS.js} +1 -1
  20. package/dist/src/app/{registry-HIVAEL5E.js → registry-KOOLQYP4.js} +3 -3
  21. package/dist/src/app/{sqlite-backend-FK7U4D6Z.js → sqlite-backend-NCFS7FN6.js} +1 -1
  22. package/dist/src/app/webui/.next/standalone/.next/static/chunks/122-4d4c8aa883d114a2.js +1 -0
  23. package/dist/src/app/webui/.next/standalone/.next/static/chunks/216-f5dbf2145a48ae92.js +1 -0
  24. package/dist/src/app/webui/.next/standalone/.next/static/chunks/43-4f3d01c7feaf132f.js +1 -0
  25. package/dist/src/app/webui/.next/standalone/.next/static/chunks/app/{layout-43f98b6d34953fcf.js → layout-36c240720861a312.js} +1 -1
  26. package/dist/src/app/webui/.next/standalone/.next/static/chunks/app/page-ca08c66042cb54c8.js +1 -0
  27. package/dist/src/app/webui/.next/standalone/.next/static/chunks/app/playground/{page-c51bb3cc58225dc3.js → page-07a79d22b26d37f4.js} +1 -1
  28. package/dist/src/app/webui/.next/standalone/.next/static/css/c1d26dc78adbeb53.css +3 -0
  29. package/dist/src/app/webui/.next/standalone/package.json +4 -1
  30. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/BUILD_ID +1 -1
  31. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/app-build-manifest.json +9 -9
  32. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/build-manifest.json +2 -2
  33. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/prerender-manifest.json +3 -3
  34. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/required-server-files.json +1 -1
  35. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  36. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/page.js +3 -4
  37. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/page.js.nft.json +1 -1
  38. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/page_client-reference-manifest.js +1 -1
  39. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/playground/page.js +2 -2
  40. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/playground/page.js.nft.json +1 -1
  41. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/playground/page_client-reference-manifest.js +1 -1
  42. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/chunks/213.js +1 -1
  43. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/chunks/489.js +1 -0
  44. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/pages/500.html +1 -1
  45. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/server-reference-manifest.json +1 -1
  46. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/122-4d4c8aa883d114a2.js +1 -0
  47. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/216-f5dbf2145a48ae92.js +1 -0
  48. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/255-e3bf15caf1f1e0f9.js +1 -0
  49. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/43-4f3d01c7feaf132f.js +1 -0
  50. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/4bd1b696-c023c6e3521b1417.js +1 -0
  51. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/537-e9370c6b1caa3c4d.js +1 -0
  52. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/app/_not-found/page-c1f5892714709ca9.js +1 -0
  53. package/dist/src/app/webui/.next/{static/chunks/app/layout-43f98b6d34953fcf.js → standalone/src/app/webui/.next/static/chunks/app/layout-36c240720861a312.js} +1 -1
  54. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/app/page-ca08c66042cb54c8.js +1 -0
  55. package/dist/src/app/webui/.next/{static/chunks/app/playground/page-c51bb3cc58225dc3.js → standalone/src/app/webui/.next/static/chunks/app/playground/page-07a79d22b26d37f4.js} +1 -1
  56. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/framework-b1e5f14688f9ffe6.js +1 -0
  57. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/main-app-d6c11d319efbfbca.js +1 -0
  58. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/main-b51c5c951595aa0b.js +1 -0
  59. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/pages/_app-7d307437aca18ad4.js +1 -0
  60. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/pages/_error-cb2a52f75f2162e2.js +1 -0
  61. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  62. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/webpack-e19b73beaa89095d.js +1 -0
  63. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/css/c1d26dc78adbeb53.css +3 -0
  64. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/media/569ce4b8f30dc480-s.p.woff2 +0 -0
  65. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/media/747892c23ea88013-s.woff2 +0 -0
  66. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/media/8d697b304b401681-s.woff2 +0 -0
  67. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/media/93f479601ee12b01-s.p.woff2 +0 -0
  68. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
  69. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/media/ba015fad6dcf6784-s.woff2 +0 -0
  70. package/dist/src/app/webui/.next/standalone/src/app/webui/public/favicon2.ico +0 -0
  71. package/dist/src/app/webui/.next/standalone/src/app/webui/public/logos/anthropic.svg +1 -0
  72. package/dist/src/app/webui/.next/standalone/src/app/webui/public/logos/claude-color.svg +1 -0
  73. package/dist/src/app/webui/.next/standalone/src/app/webui/public/logos/cohere-color.svg +1 -0
  74. package/dist/src/app/webui/.next/standalone/src/app/webui/public/logos/dexto_logo.svg +1 -0
  75. package/dist/src/app/webui/.next/standalone/src/app/webui/public/logos/dexto_logo_light.svg +18 -0
  76. package/dist/src/app/webui/.next/standalone/src/app/webui/public/logos/dexto_logo_no_text.png +0 -0
  77. package/dist/src/app/webui/.next/standalone/src/app/webui/public/logos/gemini-color.svg +1 -0
  78. package/dist/src/app/webui/.next/standalone/src/app/webui/public/logos/grok.svg +1 -0
  79. package/dist/src/app/webui/.next/standalone/src/app/webui/public/logos/groq.svg +1 -0
  80. package/dist/src/app/webui/.next/standalone/src/app/webui/public/logos/ollama.svg +1 -0
  81. package/dist/src/app/webui/.next/standalone/src/app/webui/public/logos/openai.svg +1 -0
  82. package/dist/src/app/webui/.next/standalone/src/app/webui/server.js +1 -1
  83. package/dist/src/app/webui/.next/static/RkBbxCa0lrWNsf3yPd4rX/_buildManifest.js +1 -0
  84. package/dist/src/app/webui/.next/static/RkBbxCa0lrWNsf3yPd4rX/_ssgManifest.js +1 -0
  85. package/dist/src/app/webui/.next/static/chunks/122-4d4c8aa883d114a2.js +1 -0
  86. package/dist/src/app/webui/.next/static/chunks/216-f5dbf2145a48ae92.js +1 -0
  87. package/dist/src/app/webui/.next/static/chunks/43-4f3d01c7feaf132f.js +1 -0
  88. package/dist/src/app/webui/.next/static/chunks/app/layout-36c240720861a312.js +1 -0
  89. package/dist/src/app/webui/.next/static/chunks/app/page-ca08c66042cb54c8.js +1 -0
  90. package/dist/src/app/webui/.next/static/chunks/app/playground/page-07a79d22b26d37f4.js +1 -0
  91. package/dist/src/app/webui/.next/static/css/c1d26dc78adbeb53.css +3 -0
  92. package/dist/src/app/webui/server.js +25 -12
  93. package/dist/src/core/{chunk-2O5JENNA.js → chunk-XABD32T2.js} +318 -35
  94. package/dist/src/core/index.cjs +320 -35
  95. package/dist/src/core/index.d.cts +3 -0
  96. package/dist/src/core/index.d.ts +3 -0
  97. package/dist/src/core/index.js +1 -1
  98. package/dist/src/core/{sqlite-backend-4KSJRUVL.js → sqlite-backend-3VNBKYIT.js} +1 -1
  99. package/package.json +4 -1
  100. package/dist/src/app/webui/.next/standalone/.next/static/chunks/262-807eb8fa558ce992.js +0 -1
  101. package/dist/src/app/webui/.next/standalone/.next/static/chunks/42-ae0665ff0534f075.js +0 -1
  102. package/dist/src/app/webui/.next/standalone/.next/static/chunks/500-99efaae6ea436094.js +0 -1
  103. package/dist/src/app/webui/.next/standalone/.next/static/chunks/app/page-77c27b87857033eb.js +0 -1
  104. package/dist/src/app/webui/.next/standalone/.next/static/css/3d91ad5ec330296f.css +0 -3
  105. package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/chunks/950.js +0 -1
  106. package/dist/src/app/webui/.next/static/chunks/262-807eb8fa558ce992.js +0 -1
  107. package/dist/src/app/webui/.next/static/chunks/42-ae0665ff0534f075.js +0 -1
  108. package/dist/src/app/webui/.next/static/chunks/500-99efaae6ea436094.js +0 -1
  109. package/dist/src/app/webui/.next/static/chunks/app/page-77c27b87857033eb.js +0 -1
  110. package/dist/src/app/webui/.next/static/css/3d91ad5ec330296f.css +0 -3
  111. /package/dist/src/app/webui/.next/standalone/.next/static/{bJ5SqDBPKFEnZArCs2k9v → RkBbxCa0lrWNsf3yPd4rX}/_buildManifest.js +0 -0
  112. /package/dist/src/app/webui/.next/standalone/.next/static/{bJ5SqDBPKFEnZArCs2k9v → RkBbxCa0lrWNsf3yPd4rX}/_ssgManifest.js +0 -0
  113. /package/dist/src/app/webui/.next/{static/bJ5SqDBPKFEnZArCs2k9v → standalone/src/app/webui/.next/static/RkBbxCa0lrWNsf3yPd4rX}/_buildManifest.js +0 -0
  114. /package/dist/src/app/webui/.next/{static/bJ5SqDBPKFEnZArCs2k9v → standalone/src/app/webui/.next/static/RkBbxCa0lrWNsf3yPd4rX}/_ssgManifest.js +0 -0
@@ -26,7 +26,6 @@ systemPrompt:
26
26
  Tools available to you:
27
27
  - Filesystem access for log analysis and configuration checks
28
28
  - Terminal access for system diagnostics and troubleshooting commands
29
- - Browser automation for testing web-based issues
30
29
 
31
30
  You have access to comprehensive technical documentation and troubleshooting guides for TeamFlow's platform, API, mobile apps, and integrations. Use this knowledge to provide accurate, specific solutions.
32
31
 
@@ -58,12 +57,12 @@ mcpServers:
58
57
  - -y
59
58
  - "@modelcontextprotocol/server-filesystem"
60
59
  - .
61
- puppeteer:
60
+ playwright:
62
61
  type: stdio
63
62
  command: npx
64
63
  args:
65
64
  - -y
66
- - "@truffle-ai/puppeteer-server"
65
+ - "@playwright/mcp@latest"
67
66
 
68
67
  llm:
69
68
  provider: openai
@@ -299,10 +299,19 @@ ${chalk.white(JSON.stringify(args, null, 2))}`,
299
299
  borderColor = "red";
300
300
  title = "\u274C Tool Error";
301
301
  } else if (typeof result === "string") {
302
- displayText = result;
302
+ if (result.length > 1e3) {
303
+ displayText = `${result.slice(0, 500)}... [${result.length - 500} chars omitted]`;
304
+ } else {
305
+ displayText = result;
306
+ }
303
307
  } else {
304
308
  try {
305
- displayText = JSON.stringify(result, null, 2);
309
+ const resultStr = JSON.stringify(result, null, 2);
310
+ if (resultStr.length > 2e3) {
311
+ displayText = `${resultStr.slice(0, 1e3)}... [${resultStr.length - 1e3} chars omitted]`;
312
+ } else {
313
+ displayText = resultStr;
314
+ }
306
315
  } catch {
307
316
  displayText = `[Unparseable result: ${typeof result}]`;
308
317
  }
@@ -715,7 +724,17 @@ var MCPClient = class {
715
724
  { timeout: this.timeout }
716
725
  // Use server-specific timeout, default 1 minute
717
726
  );
718
- logger.debug(`Tool '${name}' result: ${JSON.stringify(result, null, 2)}`);
727
+ const logResult = JSON.stringify(
728
+ result,
729
+ (key, value) => {
730
+ if (key === "data" && typeof value === "string" && value.length > 100) {
731
+ return `[Base64 data: ${value.length} chars]`;
732
+ }
733
+ return value;
734
+ },
735
+ 2
736
+ );
737
+ logger.debug(`Tool '${name}' result: ${logResult}`);
719
738
  if (result === null || result === void 0) {
720
739
  return "Tool executed successfully with no result data.";
721
740
  }
@@ -3993,6 +4012,8 @@ var ContextError = class {
3993
4012
 
3994
4013
  // src/core/context/utils.ts
3995
4014
  var DEFAULT_OVERHEAD_PER_MESSAGE = 4;
4015
+ var MIN_BASE64_HEURISTIC_LENGTH = 512;
4016
+ var MAX_TOOL_TEXT_CHARS = 8e3;
3996
4017
  function countMessagesTokens(history, tokenizer, overheadPerMessage = DEFAULT_OVERHEAD_PER_MESSAGE) {
3997
4018
  let total = 0;
3998
4019
  logger.debug(`Counting tokens for ${history.length} messages`);
@@ -4007,16 +4028,26 @@ function countMessagesTokens(history, tokenizer, overheadPerMessage = DEFAULT_OV
4007
4028
  total += tokenizer.countTokens(part.text);
4008
4029
  } else if (part.type === "image") {
4009
4030
  if (typeof part.image === "string") {
4010
- const byteLength = Math.floor(part.image.length * 3 / 4);
4011
- total += Math.ceil(byteLength / 1024);
4031
+ if (isDataUri(part.image)) {
4032
+ const base64Payload = extractBase64FromDataUri(part.image);
4033
+ const byteLength = base64LengthToBytes(base64Payload.length);
4034
+ total += Math.ceil(byteLength / 1024);
4035
+ } else {
4036
+ total += estimateTextTokens(part.image);
4037
+ }
4012
4038
  } else if (part.image instanceof Uint8Array || part.image instanceof Buffer || part.image instanceof ArrayBuffer) {
4013
4039
  const bytes = part.image instanceof ArrayBuffer ? part.image.byteLength : part.image.length;
4014
4040
  total += Math.ceil(bytes / 1024);
4015
4041
  }
4016
4042
  } else if (part.type === "file") {
4017
4043
  if (typeof part.data === "string") {
4018
- const byteLength = Math.floor(part.data.length * 3 / 4);
4019
- total += Math.ceil(byteLength / 1024);
4044
+ if (isDataUri(part.data)) {
4045
+ const base64Payload = extractBase64FromDataUri(part.data);
4046
+ const byteLength = base64LengthToBytes(base64Payload.length);
4047
+ total += Math.ceil(byteLength / 1024);
4048
+ } else {
4049
+ total += estimateTextTokens(part.data);
4050
+ }
4020
4051
  } else if (part.data instanceof Uint8Array || part.data instanceof Buffer || part.data instanceof ArrayBuffer) {
4021
4052
  const bytes = part.data instanceof ArrayBuffer ? part.data.byteLength : part.data.length;
4022
4053
  total += Math.ceil(bytes / 1024);
@@ -4058,7 +4089,7 @@ function getImageData(imagePart) {
4058
4089
  } else if (image instanceof URL) {
4059
4090
  return image.toString();
4060
4091
  }
4061
- console.warn("Unexpected image data type in getImageData:", typeof image);
4092
+ logger.warn(`Unexpected image data type in getImageData: ${typeof image}`);
4062
4093
  return "";
4063
4094
  }
4064
4095
  function getFileData(filePart) {
@@ -4074,7 +4105,7 @@ function getFileData(filePart) {
4074
4105
  } else if (data instanceof URL) {
4075
4106
  return data.toString();
4076
4107
  }
4077
- console.warn("Unexpected file data type in getFileData:", typeof data);
4108
+ logger.warn(`Unexpected file data type in getFileData: ${typeof data}`);
4078
4109
  return "";
4079
4110
  }
4080
4111
  function filterMessagesByLLMCapabilities(messages, config) {
@@ -4109,10 +4140,236 @@ function filterMessagesByLLMCapabilities(messages, config) {
4109
4140
  };
4110
4141
  });
4111
4142
  } catch (error) {
4112
- console.warn("Failed to filter messages by LLM capabilities:", error);
4143
+ logger.warn(`Failed to filter messages by LLM capabilities: ${String(error)}`);
4113
4144
  return messages;
4114
4145
  }
4115
4146
  }
4147
+ function isLikelyBase64String(value, minLength = MIN_BASE64_HEURISTIC_LENGTH) {
4148
+ if (!value || value.length < minLength) return false;
4149
+ if (value.startsWith("data:") && value.includes(";base64,")) return true;
4150
+ const b64Regex = /^[A-Za-z0-9+/=\r\n]+$/;
4151
+ if (!b64Regex.test(value)) return false;
4152
+ const nonWordRatio = (value.match(/[^A-Za-z0-9+/=]/g)?.length || 0) / value.length;
4153
+ return nonWordRatio < 0.01;
4154
+ }
4155
+ function parseDataUri(value) {
4156
+ if (!value.startsWith("data:")) return null;
4157
+ const commaIdx = value.indexOf(",");
4158
+ if (commaIdx === -1) return null;
4159
+ const meta = value.slice(5, commaIdx);
4160
+ if (!/;base64$/i.test(meta)) return null;
4161
+ const mediaType = meta.replace(/;base64$/i, "") || "application/octet-stream";
4162
+ const base64 = value.slice(commaIdx + 1);
4163
+ return { mediaType, base64 };
4164
+ }
4165
+ function sanitizeDeepObject(obj) {
4166
+ if (obj == null) return obj;
4167
+ if (typeof obj === "string") {
4168
+ if (isLikelyBase64String(obj)) {
4169
+ const approxBytes = Math.floor(obj.length * 3 / 4);
4170
+ logger.debug(
4171
+ `sanitizeDeepObject: replaced large base64 string (~${approxBytes} bytes) with placeholder`
4172
+ );
4173
+ return `[binary data omitted ~${approxBytes} bytes]`;
4174
+ }
4175
+ return obj;
4176
+ }
4177
+ if (Array.isArray(obj)) return obj.map((x) => sanitizeDeepObject(x));
4178
+ if (typeof obj === "object") {
4179
+ const out = {};
4180
+ for (const [k, v] of Object.entries(obj)) {
4181
+ out[k] = sanitizeDeepObject(v);
4182
+ }
4183
+ return out;
4184
+ }
4185
+ return obj;
4186
+ }
4187
+ function sanitizeToolResultToContent(result) {
4188
+ try {
4189
+ if (typeof result === "string") {
4190
+ const dataUri = parseDataUri(result);
4191
+ if (dataUri) {
4192
+ const mediaType = dataUri.mediaType;
4193
+ logger.debug(
4194
+ `sanitizeToolResultToContent: detected data URI (${mediaType}), converting to media part`
4195
+ );
4196
+ if (mediaType.startsWith("image/")) {
4197
+ return [{ type: "image", image: dataUri.base64, mimeType: mediaType }];
4198
+ }
4199
+ return [{ type: "file", data: dataUri.base64, mimeType: mediaType }];
4200
+ }
4201
+ if (isLikelyBase64String(result)) {
4202
+ logger.debug(
4203
+ "sanitizeToolResultToContent: detected base64-like string, converting to file part"
4204
+ );
4205
+ return [
4206
+ {
4207
+ type: "file",
4208
+ data: result,
4209
+ mimeType: "application/octet-stream",
4210
+ filename: "tool-output.bin"
4211
+ }
4212
+ ];
4213
+ }
4214
+ if (result.length > MAX_TOOL_TEXT_CHARS) {
4215
+ const head = result.slice(0, 4e3);
4216
+ const tail = result.slice(-1e3);
4217
+ logger.debug(
4218
+ `sanitizeToolResultToContent: truncating long text tool output (len=${result.length})`
4219
+ );
4220
+ return `${head}
4221
+ ... [${result.length - 5e3} chars omitted] ...
4222
+ ${tail}`;
4223
+ }
4224
+ return result;
4225
+ }
4226
+ if (Array.isArray(result)) {
4227
+ const parts = [];
4228
+ for (const item of result) {
4229
+ if (item == null) continue;
4230
+ if (typeof item === "string") {
4231
+ const dataUri = parseDataUri(item);
4232
+ if (dataUri) {
4233
+ const mt = dataUri.mediaType;
4234
+ if (mt.startsWith("image/"))
4235
+ parts.push({ type: "image", image: dataUri.base64, mimeType: mt });
4236
+ else parts.push({ type: "file", data: dataUri.base64, mimeType: mt });
4237
+ continue;
4238
+ }
4239
+ if (isLikelyBase64String(item)) {
4240
+ parts.push({
4241
+ type: "file",
4242
+ data: item,
4243
+ mimeType: "application/octet-stream",
4244
+ filename: "tool-output.bin"
4245
+ });
4246
+ continue;
4247
+ }
4248
+ parts.push({ type: "text", text: item });
4249
+ continue;
4250
+ }
4251
+ if (typeof item === "object") {
4252
+ const obj = item;
4253
+ if (obj.type === "text" && typeof obj.text === "string") {
4254
+ parts.push({ type: "text", text: obj.text });
4255
+ continue;
4256
+ }
4257
+ if (obj.type === "image" && obj.image !== void 0 || "image" in obj) {
4258
+ parts.push({
4259
+ type: "image",
4260
+ image: getImageData({ image: obj.image }),
4261
+ mimeType: obj.mimeType || "image/jpeg"
4262
+ });
4263
+ continue;
4264
+ }
4265
+ if (obj.type === "file" && obj.data !== void 0) {
4266
+ parts.push({
4267
+ type: "file",
4268
+ data: getFileData({ data: obj.data }),
4269
+ mimeType: obj.mimeType || "application/octet-stream",
4270
+ filename: obj.filename
4271
+ });
4272
+ continue;
4273
+ }
4274
+ if ("data" in obj && (typeof obj.mimeType === "string" || obj.filename)) {
4275
+ parts.push({
4276
+ type: "file",
4277
+ data: getFileData({ data: obj.data }),
4278
+ mimeType: obj.mimeType || "application/octet-stream",
4279
+ filename: obj.filename
4280
+ });
4281
+ continue;
4282
+ }
4283
+ const cleaned = sanitizeDeepObject(obj);
4284
+ parts.push({ type: "text", text: safeStringify(cleaned) });
4285
+ continue;
4286
+ }
4287
+ parts.push({ type: "text", text: String(item) });
4288
+ }
4289
+ return parts;
4290
+ }
4291
+ if (result && typeof result === "object") {
4292
+ const anyObj = result;
4293
+ if ("image" in anyObj) {
4294
+ return [
4295
+ {
4296
+ type: "image",
4297
+ image: getImageData({ image: anyObj.image }),
4298
+ mimeType: anyObj.mimeType || "image/jpeg"
4299
+ }
4300
+ ];
4301
+ }
4302
+ if ("data" in anyObj && anyObj.mimeType) {
4303
+ return [
4304
+ {
4305
+ type: "file",
4306
+ data: getFileData({ data: anyObj.data }),
4307
+ mimeType: anyObj.mimeType,
4308
+ filename: anyObj.filename
4309
+ }
4310
+ ];
4311
+ }
4312
+ const cleaned = sanitizeDeepObject(anyObj);
4313
+ return safeStringify(cleaned);
4314
+ }
4315
+ return safeStringify(result ?? "");
4316
+ } catch (err) {
4317
+ logger.warn(`sanitizeToolResultToContent failed, falling back to string: ${String(err)}`);
4318
+ try {
4319
+ return safeStringify(result ?? "");
4320
+ } catch {
4321
+ return String(result ?? "");
4322
+ }
4323
+ }
4324
+ }
4325
+ function summarizeToolContentForText(content) {
4326
+ if (!Array.isArray(content)) return String(content || "");
4327
+ const parts = [];
4328
+ for (const p of content) {
4329
+ if (p.type === "text") {
4330
+ parts.push(p.text);
4331
+ } else if (p.type === "image") {
4332
+ let bytes = 0;
4333
+ if (typeof p.image === "string") bytes = Math.floor(p.image.length * 3 / 4);
4334
+ else if (p.image instanceof ArrayBuffer) bytes = p.image.byteLength;
4335
+ else if (p.image instanceof Uint8Array) bytes = p.image.length;
4336
+ else if (p.image instanceof Buffer) bytes = p.image.length;
4337
+ parts.push(`[image ${p.mimeType || "image"} ~${Math.ceil(bytes / 1024)}KB]`);
4338
+ } else if (p.type === "file") {
4339
+ let bytes = 0;
4340
+ if (typeof p.data === "string") bytes = Math.floor(p.data.length * 3 / 4);
4341
+ else if (p.data instanceof ArrayBuffer) bytes = p.data.byteLength;
4342
+ else if (p.data instanceof Uint8Array) bytes = p.data.length;
4343
+ else if (p.data instanceof Buffer) bytes = p.data.length;
4344
+ const label = p.filename ? `${p.filename}` : `${p.mimeType || "file"}`;
4345
+ parts.push(`[file ${label} ~${Math.ceil(bytes / 1024)}KB]`);
4346
+ }
4347
+ }
4348
+ const summary = parts.join("\n");
4349
+ return summary.slice(0, 4e3);
4350
+ }
4351
+ function base64LengthToBytes(charLength) {
4352
+ return Math.floor(charLength * 3 / 4);
4353
+ }
4354
+ function isDataUri(str) {
4355
+ return str.startsWith("data:") && str.includes(";base64,");
4356
+ }
4357
+ function extractBase64FromDataUri(dataUri) {
4358
+ const commaIndex = dataUri.indexOf(",");
4359
+ return commaIndex !== -1 ? dataUri.substring(commaIndex + 1) : "";
4360
+ }
4361
+ function estimateTextTokens(text) {
4362
+ return Math.ceil(text.length / 4);
4363
+ }
4364
+ function toTextForToolMessage(content) {
4365
+ if (Array.isArray(content)) {
4366
+ return summarizeToolContentForText(content);
4367
+ }
4368
+ if (typeof content === "string") {
4369
+ return isLikelyBase64String(content) ? "[binary data omitted]" : content;
4370
+ }
4371
+ return String(content ?? "");
4372
+ }
4116
4373
 
4117
4374
  // src/core/context/compression/middle-removal.ts
4118
4375
  var MiddleRemovalStrategy = class {
@@ -4527,21 +4784,17 @@ ${prompt}`);
4527
4784
  throw ContextError.toolCallIdNameRequired();
4528
4785
  }
4529
4786
  let content;
4530
- if (result && typeof result === "object" && "image" in result) {
4531
- const imagePart = result;
4532
- content = [
4533
- {
4534
- type: "image",
4535
- image: getImageData(imagePart),
4536
- mimeType: imagePart.mimeType || "image/jpeg"
4537
- }
4538
- ];
4539
- } else if (typeof result === "string") {
4540
- content = result;
4541
- } else if (Array.isArray(result)) {
4542
- content = result;
4543
- } else {
4544
- content = JSON.stringify(result ?? "");
4787
+ content = sanitizeToolResultToContent(result);
4788
+ if (typeof content === "string") {
4789
+ const preview = content.slice(0, 200);
4790
+ logger.debug(
4791
+ `ContextManager: Storing tool result (text) for ${name} (len=${content.length}): ${preview}${content.length > 200 ? "..." : ""}`
4792
+ );
4793
+ } else if (Array.isArray(content)) {
4794
+ const summary = content.map(
4795
+ (p) => p.type === "text" ? `text(${p.text.length})` : p.type === "image" ? `image(${p.mimeType || "image"})` : `file(${p.mimeType || "file"})`
4796
+ ).join(", ");
4797
+ logger.debug(`ContextManager: Storing tool result (parts) for ${name}: [${summary}]`);
4545
4798
  }
4546
4799
  await this.addMessage({ role: "tool", content, toolCallId, name });
4547
4800
  }
@@ -5290,6 +5543,8 @@ var VercelLLMService = class {
5290
5543
  sessionEventBus;
5291
5544
  sessionId;
5292
5545
  toolSupportCache = /* @__PURE__ */ new Map();
5546
+ // Map of toolCallId -> queue of raw results to emit with that callId
5547
+ rawResultsByCallId = /* @__PURE__ */ new Map();
5293
5548
  /**
5294
5549
  * Helper to extract model ID from LanguageModel union type (string | LanguageModelV2)
5295
5550
  */
@@ -5328,13 +5583,20 @@ var VercelLLMService = class {
5328
5583
  if (tool) {
5329
5584
  acc[toolName] = {
5330
5585
  inputSchema: jsonSchema(tool.parameters),
5331
- execute: async (args) => {
5586
+ execute: async (args, options) => {
5332
5587
  try {
5333
- return await this.toolManager.executeTool(
5588
+ const rawResult = await this.toolManager.executeTool(
5334
5589
  toolName,
5335
5590
  args,
5336
5591
  this.sessionId
5337
5592
  );
5593
+ const callId = options.toolCallId;
5594
+ const queue = this.rawResultsByCallId.get(callId) ?? [];
5595
+ queue.push(rawResult);
5596
+ this.rawResultsByCallId.set(callId, queue);
5597
+ const safeContent = sanitizeToolResultToContent(rawResult);
5598
+ const summaryText = summarizeToolContentForText(safeContent);
5599
+ return summaryText;
5338
5600
  } catch (err) {
5339
5601
  if (err instanceof DextoRuntimeError && err.code === "tools_execution_denied" /* EXECUTION_DENIED */) {
5340
5602
  return { error: err.message, denied: true };
@@ -5488,10 +5750,19 @@ var VercelLLMService = class {
5488
5750
  }
5489
5751
  if (step.toolResults && step.toolResults.length > 0) {
5490
5752
  for (const toolResult of step.toolResults) {
5753
+ const callId = toolResult.toolCallId;
5754
+ const sanitized = toolResult.output;
5755
+ let raw;
5756
+ if (callId) {
5757
+ const q = this.rawResultsByCallId.get(callId) ?? [];
5758
+ raw = q.shift();
5759
+ if (q.length > 0) this.rawResultsByCallId.set(callId, q);
5760
+ else this.rawResultsByCallId.delete(callId);
5761
+ }
5491
5762
  this.sessionEventBus.emit("llmservice:toolResult", {
5492
5763
  toolName: toolResult.toolName,
5493
- result: toolResult.output,
5494
- callId: toolResult.toolCallId,
5764
+ result: raw ?? sanitized,
5765
+ callId,
5495
5766
  success: true
5496
5767
  });
5497
5768
  }
@@ -5656,10 +5927,19 @@ var VercelLLMService = class {
5656
5927
  }
5657
5928
  if (step.toolResults && step.toolResults.length > 0) {
5658
5929
  for (const toolResult of step.toolResults) {
5930
+ const callId = toolResult.toolCallId;
5931
+ const sanitized = toolResult.output;
5932
+ let raw;
5933
+ if (callId) {
5934
+ const q = this.rawResultsByCallId.get(callId) ?? [];
5935
+ raw = q.shift();
5936
+ if (q.length > 0) this.rawResultsByCallId.set(callId, q);
5937
+ else this.rawResultsByCallId.delete(callId);
5938
+ }
5659
5939
  this.sessionEventBus.emit("llmservice:toolResult", {
5660
5940
  toolName: toolResult.toolName,
5661
- result: toolResult.output,
5662
- callId: toolResult.toolCallId,
5941
+ result: raw ?? sanitized,
5942
+ callId,
5663
5943
  success: true
5664
5944
  });
5665
5945
  }
@@ -5796,7 +6076,7 @@ var OpenAIMessageFormatter = class {
5796
6076
  case "tool":
5797
6077
  formatted.push({
5798
6078
  role: "tool",
5799
- content: String(msg.content || ""),
6079
+ content: toTextForToolMessage(msg.content),
5800
6080
  tool_call_id: msg.toolCallId || ""
5801
6081
  });
5802
6082
  break;
@@ -6362,13 +6642,14 @@ var AnthropicMessageFormatter = class {
6362
6642
  formatted.push(pendingCall.assistantMsg);
6363
6643
  pendingCall.assistantMsg = null;
6364
6644
  }
6645
+ const safeContent = toTextForToolMessage(msg.content);
6365
6646
  const toolResultMsg = {
6366
6647
  role: "user",
6367
6648
  content: [
6368
6649
  {
6369
6650
  type: "tool_result",
6370
6651
  tool_use_id: msg.toolCallId,
6371
- content: String(msg.content || "")
6652
+ content: safeContent
6372
6653
  }
6373
6654
  ]
6374
6655
  };
@@ -6376,13 +6657,14 @@ var AnthropicMessageFormatter = class {
6376
6657
  pendingToolCalls.delete(msg.toolCallId);
6377
6658
  } else {
6378
6659
  logger.warn(`Tool result found without matching tool call: ${msg.toolCallId}`);
6660
+ const orphanSafe = toTextForToolMessage(msg.content);
6379
6661
  const orphanToolResult = {
6380
6662
  role: "user",
6381
6663
  content: [
6382
6664
  {
6383
6665
  type: "tool_result",
6384
6666
  tool_use_id: msg.toolCallId,
6385
- content: String(msg.content || "")
6667
+ content: orphanSafe
6386
6668
  }
6387
6669
  ]
6388
6670
  };
@@ -8362,7 +8644,7 @@ var StorageManager = class {
8362
8644
  async createSQLiteBackend(config) {
8363
8645
  try {
8364
8646
  if (!SQLiteBackend) {
8365
- const module = await import("./sqlite-backend-FK7U4D6Z.js");
8647
+ const module = await import("./sqlite-backend-NCFS7FN6.js");
8366
8648
  SQLiteBackend = module.SQLiteBackend;
8367
8649
  }
8368
8650
  logger.info(`Using SQLite database at ${config.path}`);
@@ -9442,6 +9724,7 @@ var AgentCardSchema = z8.object({
9442
9724
  }).strict();
9443
9725
  var AgentConfigSchema = z8.object({
9444
9726
  agentCard: AgentCardSchema.describe("Configuration for the agent card").optional(),
9727
+ greeting: z8.string().max(500).optional().describe("Default greeting text to show when a chat starts (for UI consumption)"),
9445
9728
  systemPrompt: SystemPromptConfigSchema.describe(
9446
9729
  "System prompt: string shorthand or structured config"
9447
9730
  ),
@@ -5,7 +5,7 @@ import {
5
5
  getSupportedModels,
6
6
  isValidProviderModel,
7
7
  logger
8
- } from "./chunk-OIBH674O.js";
8
+ } from "./chunk-BKF5BGLX.js";
9
9
  import {
10
10
  DextoRuntimeError
11
11
  } from "./chunk-CX5GDY3D.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadGlobalPreferences
3
- } from "./chunk-FVWAYUL4.js";
3
+ } from "./chunk-N7FUUBGT.js";
4
4
  import {
5
5
  RegistryError
6
6
  } from "./chunk-DEQAEC4S.js";
@@ -10,7 +10,7 @@ import {
10
10
  logger,
11
11
  resolveBundledScript,
12
12
  writePreferencesToAgent
13
- } from "./chunk-OIBH674O.js";
13
+ } from "./chunk-BKF5BGLX.js";
14
14
 
15
15
  // src/core/agent/registry/registry.ts
16
16
  import { existsSync, readFileSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-OIBH674O.js";
3
+ } from "./chunk-BKF5BGLX.js";
4
4
  import "./chunk-CX5GDY3D.js";
5
5
  import "./chunk-VUXMBRHF.js";
6
6
  import "./chunk-BYXBJQAS.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  RegistryError
3
3
  } from "./chunk-DEQAEC4S.js";
4
- import "./chunk-OIBH674O.js";
4
+ import "./chunk-BKF5BGLX.js";
5
5
  import "./chunk-CX5GDY3D.js";
6
6
  import "./chunk-VUXMBRHF.js";
7
7
  import "./chunk-BYXBJQAS.js";