@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.
Files changed (50) hide show
  1. package/dist/agent/DextoAgent.cjs +159 -51
  2. package/dist/agent/DextoAgent.d.ts +3 -1
  3. package/dist/agent/DextoAgent.d.ts.map +1 -1
  4. package/dist/agent/DextoAgent.js +162 -53
  5. package/dist/agent/types.d.ts +2 -0
  6. package/dist/agent/types.d.ts.map +1 -1
  7. package/dist/context/manager.cjs +144 -35
  8. package/dist/context/manager.d.ts +4 -0
  9. package/dist/context/manager.d.ts.map +1 -1
  10. package/dist/context/manager.js +146 -36
  11. package/dist/context/types.cjs +5 -0
  12. package/dist/context/types.d.ts +21 -1
  13. package/dist/context/types.d.ts.map +1 -1
  14. package/dist/context/types.js +4 -0
  15. package/dist/context/utils.cjs +85 -25
  16. package/dist/context/utils.d.ts +5 -3
  17. package/dist/context/utils.d.ts.map +1 -1
  18. package/dist/context/utils.js +84 -25
  19. package/dist/llm/executor/turn-executor.cjs +2 -2
  20. package/dist/llm/executor/turn-executor.d.ts +1 -1
  21. package/dist/llm/executor/turn-executor.d.ts.map +1 -1
  22. package/dist/llm/executor/turn-executor.js +2 -2
  23. package/dist/llm/formatters/vercel.cjs +3 -1
  24. package/dist/llm/formatters/vercel.d.ts.map +1 -1
  25. package/dist/llm/formatters/vercel.js +3 -1
  26. package/dist/llm/registry/index.cjs +43 -12
  27. package/dist/llm/registry/index.d.ts.map +1 -1
  28. package/dist/llm/registry/index.js +43 -12
  29. package/dist/llm/registry/models.generated.cjs +1270 -1324
  30. package/dist/llm/registry/models.generated.d.ts +617 -210
  31. package/dist/llm/registry/models.generated.d.ts.map +1 -1
  32. package/dist/llm/registry/models.generated.js +1270 -1324
  33. package/dist/llm/registry/sync.cjs +5 -0
  34. package/dist/llm/registry/sync.d.ts.map +1 -1
  35. package/dist/llm/registry/sync.js +5 -0
  36. package/dist/llm/types.cjs +1 -1
  37. package/dist/llm/types.d.ts +1 -1
  38. package/dist/llm/types.d.ts.map +1 -1
  39. package/dist/llm/types.js +1 -1
  40. package/dist/resources/handlers/filesystem-handler.cjs +55 -9
  41. package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -1
  42. package/dist/resources/handlers/filesystem-handler.js +55 -9
  43. package/dist/resources/reference-parser.cjs +47 -12
  44. package/dist/resources/reference-parser.d.ts +6 -3
  45. package/dist/resources/reference-parser.d.ts.map +1 -1
  46. package/dist/resources/reference-parser.js +47 -12
  47. package/dist/utils/api-key-resolver.cjs +25 -0
  48. package/dist/utils/api-key-resolver.d.ts.map +1 -1
  49. package/dist/utils/api-key-resolver.js +25 -0
  50. package/package.json +1 -1
@@ -8,7 +8,7 @@ import { randomUUID } from "crypto";
8
8
  import { setMaxListeners } from "events";
9
9
  import { SkillsContributor } from "../systemPrompt/contributors.js";
10
10
  import { expandMessageReferences } from "../resources/index.js";
11
- import { expandBlobReferences } from "../context/utils.js";
11
+ import { expandBlobReferences, fileTypesToMimePatterns } from "../context/utils.js";
12
12
  import { StorageManager } from "../storage/index.js";
13
13
  import { PromptManager } from "../prompts/index.js";
14
14
  import { SessionError } from "../session/index.js";
@@ -29,7 +29,8 @@ import {
29
29
  getSupportedProviders,
30
30
  getDefaultModelForProvider,
31
31
  getProviderFromModel,
32
- getAllModelsForProvider
32
+ getAllModelsForProvider,
33
+ getSupportedFileTypesForModel
33
34
  } from "../llm/registry/index.js";
34
35
  import { createAgentServices } from "../utils/service-initializer.js";
35
36
  import { LLMConfigSchema, LLMUpdatesSchema } from "../llm/schemas.js";
@@ -648,6 +649,7 @@ Either:
648
649
  throw AgentError.apiValidationError("sessionId is required");
649
650
  }
650
651
  const signal = options?.signal;
652
+ const disconnectSignal = options?.disconnectSignal ?? signal;
651
653
  let contentParts = typeof content === "string" ? [{ type: "text", text: content }] : [...content];
652
654
  const eventQueue = [];
653
655
  let completed = false;
@@ -656,7 +658,10 @@ Either:
656
658
  this.activeStreamControllers.set(sessionId, controller);
657
659
  setMaxListeners(30, cleanupSignal);
658
660
  const listeners = [];
661
+ let detachDisconnectAbortListener;
659
662
  const cleanupListeners = () => {
663
+ detachDisconnectAbortListener?.();
664
+ detachDisconnectAbortListener = void 0;
660
665
  if (listeners.length === 0) {
661
666
  return;
662
667
  }
@@ -669,12 +674,13 @@ Either:
669
674
  listeners.length = 0;
670
675
  this.activeStreamControllers.delete(sessionId);
671
676
  };
672
- if (signal) {
677
+ if (disconnectSignal) {
673
678
  const abortHandler = () => {
674
679
  cleanupListeners();
675
680
  controller.abort();
676
681
  };
677
- signal.addEventListener("abort", abortHandler, { once: true });
682
+ disconnectSignal.addEventListener("abort", abortHandler, { once: true });
683
+ detachDisconnectAbortListener = () => disconnectSignal.removeEventListener("abort", abortHandler);
678
684
  }
679
685
  const thinkingListener = (data) => {
680
686
  if (data.sessionId !== sessionId) return;
@@ -846,37 +852,64 @@ Either:
846
852
  this.logger.debug(
847
853
  `DextoAgent.stream: sessionId=${sessionId}, textLength=${textContent?.length ?? 0}, imageCount=${imageParts.length}, fileCount=${fileParts.length}`
848
854
  );
849
- const textValidation = validateInputForLLM(
850
- { text: textContent },
851
- { provider: llmConfig.provider, model: llmConfig.model },
852
- this.logger
853
- );
854
- ensureOk(textValidation, this.logger);
855
- for (const imagePart of imageParts) {
856
- const imageValidation = validateInputForLLM(
857
- {
858
- imageData: {
859
- image: typeof imagePart.image === "string" ? imagePart.image : imagePart.image.toString(),
860
- mimeType: imagePart.mimeType || "image/png"
861
- }
862
- },
855
+ const validatePromptContentParts = (parts) => {
856
+ const currentTextParts = parts.filter(
857
+ (part) => part.type === "text"
858
+ );
859
+ const currentText = currentTextParts.map((part) => part.text).join("\n");
860
+ const currentImageParts = parts.filter(
861
+ (part) => part.type === "image"
862
+ );
863
+ const currentFileParts = parts.filter(
864
+ (part) => part.type === "file"
865
+ );
866
+ const textValidation = validateInputForLLM(
867
+ { text: currentText },
863
868
  { provider: llmConfig.provider, model: llmConfig.model },
864
869
  this.logger
865
870
  );
866
- ensureOk(imageValidation, this.logger);
867
- }
868
- for (const filePart of fileParts) {
869
- const fileValidation = validateInputForLLM(
870
- {
871
- fileData: {
872
- data: typeof filePart.data === "string" ? filePart.data : filePart.data.toString(),
873
- mimeType: filePart.mimeType
874
- }
875
- },
876
- { provider: llmConfig.provider, model: llmConfig.model },
871
+ ensureOk(textValidation, this.logger);
872
+ for (const imagePart of currentImageParts) {
873
+ const imageValidation = validateInputForLLM(
874
+ {
875
+ imageData: {
876
+ image: typeof imagePart.image === "string" ? imagePart.image : imagePart.image.toString(),
877
+ mimeType: imagePart.mimeType || "image/png"
878
+ }
879
+ },
880
+ { provider: llmConfig.provider, model: llmConfig.model },
881
+ this.logger
882
+ );
883
+ ensureOk(imageValidation, this.logger);
884
+ }
885
+ for (const filePart of currentFileParts) {
886
+ const fileValidation = validateInputForLLM(
887
+ {
888
+ fileData: {
889
+ data: typeof filePart.data === "string" ? filePart.data : filePart.data.toString(),
890
+ mimeType: filePart.mimeType
891
+ }
892
+ },
893
+ { provider: llmConfig.provider, model: llmConfig.model },
894
+ this.logger
895
+ );
896
+ ensureOk(fileValidation, this.logger);
897
+ }
898
+ };
899
+ let allowedMediaTypes = llmConfig.allowedMediaTypes;
900
+ if (!allowedMediaTypes) {
901
+ allowedMediaTypes = fileTypesToMimePatterns(
902
+ getSupportedFileTypesForModel(llmConfig.provider, llmConfig.model),
877
903
  this.logger
878
904
  );
879
- ensureOk(fileValidation, this.logger);
905
+ }
906
+ if (contentParts.some((part) => part.type === "resource")) {
907
+ contentParts = await expandBlobReferences(
908
+ contentParts,
909
+ this.resourceManager,
910
+ this.logger,
911
+ allowedMediaTypes
912
+ );
880
913
  }
881
914
  if (textContent.includes("@")) {
882
915
  try {
@@ -884,7 +917,8 @@ Either:
884
917
  const expansion = await expandMessageReferences(
885
918
  textContent,
886
919
  resources,
887
- (uri) => this.resourceManager.read(uri)
920
+ (uri) => this.resourceManager.read(uri),
921
+ allowedMediaTypes
888
922
  );
889
923
  if (expansion.unresolvedReferences.length > 0) {
890
924
  const unresolvedNames = expansion.unresolvedReferences.map((ref) => ref.originalRef).join(", ");
@@ -909,14 +943,23 @@ Either:
909
943
  text: expansion.expandedMessage
910
944
  });
911
945
  }
912
- for (const img of expansion.extractedImages) {
913
- contentParts.push({
914
- type: "image",
915
- image: img.image,
916
- mimeType: img.mimeType
917
- });
946
+ for (const resource of expansion.extractedResources) {
947
+ if (resource.kind === "image") {
948
+ contentParts.push({
949
+ type: "image",
950
+ image: resource.data,
951
+ mimeType: resource.mimeType
952
+ });
953
+ } else {
954
+ contentParts.push({
955
+ type: "file",
956
+ data: resource.data,
957
+ mimeType: resource.mimeType,
958
+ filename: resource.name
959
+ });
960
+ }
918
961
  this.logger.debug(
919
- `Added extracted image: ${img.name} (${img.mimeType})`
962
+ `Added extracted resource: ${resource.name} (${resource.mimeType})`
920
963
  );
921
964
  }
922
965
  } catch (error) {
@@ -929,7 +972,7 @@ Either:
929
972
  (p) => p.type === "text" && p.text.trim()
930
973
  );
931
974
  const hasMediaContent = contentParts.some(
932
- (p) => p.type === "image" || p.type === "file"
975
+ (p) => p.type === "image" || p.type === "file" || p.type === "resource"
933
976
  );
934
977
  if (!hasTextContent && !hasMediaContent) {
935
978
  this.logger.warn(
@@ -937,6 +980,7 @@ Either:
937
980
  );
938
981
  contentParts = [{ type: "text", text: textContent }];
939
982
  }
983
+ validatePromptContentParts(contentParts);
940
984
  const session = await this.sessionManager.getSession(sessionId) || await this.sessionManager.createSession(sessionId);
941
985
  const _streamResult = await session.stream(
942
986
  contentParts,
@@ -966,7 +1010,7 @@ Either:
966
1010
  async next() {
967
1011
  while (!completed && eventQueue.length === 0) {
968
1012
  await new Promise((resolve) => setTimeout(resolve, 0));
969
- if (signal?.aborted || cleanupSignal.aborted) {
1013
+ if (disconnectSignal?.aborted || cleanupSignal.aborted) {
970
1014
  cleanupListeners();
971
1015
  controller.abort();
972
1016
  return { done: true, value: void 0 };
@@ -1279,30 +1323,93 @@ Either:
1279
1323
  * @returns Promise that resolves to the session's conversation history
1280
1324
  * @throws Error if session doesn't exist
1281
1325
  */
1282
- async getSessionHistory(sessionId) {
1326
+ async getSessionHistory(sessionId, options) {
1283
1327
  this.ensureStarted();
1284
1328
  const session = await this.sessionManager.getSession(sessionId);
1285
1329
  if (!session) {
1286
1330
  throw SessionError.notFound(sessionId);
1287
1331
  }
1288
1332
  const history = await session.getHistory();
1289
- if (!this.resourceManager) {
1333
+ const expandBlobReferencesByDefault = options?.expandBlobReferences ?? true;
1334
+ if (!this.resourceManager || !expandBlobReferencesByDefault) {
1290
1335
  return history;
1291
1336
  }
1292
1337
  return await Promise.all(
1293
- history.map(async (message) => ({
1294
- ...message,
1295
- content: await expandBlobReferences(
1296
- message.content,
1297
- this.resourceManager,
1298
- this.logger
1299
- ).catch((error) => {
1338
+ history.map(async (message) => {
1339
+ if (!Array.isArray(message.content)) {
1340
+ return message;
1341
+ }
1342
+ try {
1343
+ const expandedContent = (await Promise.all(
1344
+ message.content.map(async (part) => {
1345
+ try {
1346
+ if (part.type === "text" && typeof part.text === "string" && part.text.includes("@blob:")) {
1347
+ return await expandBlobReferences(
1348
+ [part],
1349
+ this.resourceManager,
1350
+ this.logger
1351
+ );
1352
+ }
1353
+ if (part.type === "image" && typeof part.image === "string" && part.image.startsWith("@blob:")) {
1354
+ const result = await this.resourceManager.read(
1355
+ part.image.slice(1)
1356
+ );
1357
+ for (const item of result.contents) {
1358
+ if (typeof item === "object" && item !== null && "blob" in item && typeof item.blob === "string") {
1359
+ return [
1360
+ {
1361
+ type: "image",
1362
+ image: item.blob,
1363
+ ...typeof item.mimeType === "string" ? { mimeType: item.mimeType } : part.mimeType !== void 0 ? { mimeType: part.mimeType } : {}
1364
+ }
1365
+ ];
1366
+ }
1367
+ }
1368
+ }
1369
+ if (part.type === "file" && typeof part.data === "string" && part.data.startsWith("@blob:")) {
1370
+ const result = await this.resourceManager.read(
1371
+ part.data.slice(1)
1372
+ );
1373
+ for (const item of result.contents) {
1374
+ if (typeof item === "object" && item !== null && "blob" in item && typeof item.blob === "string") {
1375
+ return [
1376
+ {
1377
+ type: "file",
1378
+ data: item.blob,
1379
+ mimeType: typeof item.mimeType === "string" ? item.mimeType : part.mimeType,
1380
+ ..."filename" in item && typeof item.filename === "string" ? { filename: item.filename } : part.filename !== void 0 ? { filename: part.filename } : {}
1381
+ }
1382
+ ];
1383
+ }
1384
+ }
1385
+ }
1386
+ if (part.type === "resource" && typeof part.uri === "string" && part.uri.startsWith("blob:")) {
1387
+ return await expandBlobReferences(
1388
+ [part],
1389
+ this.resourceManager,
1390
+ this.logger
1391
+ );
1392
+ }
1393
+ return [part];
1394
+ } catch (error) {
1395
+ this.logger.warn(
1396
+ `Failed to expand blob content part in message: ${error instanceof Error ? error.message : String(error)}`
1397
+ );
1398
+ return [part];
1399
+ }
1400
+ })
1401
+ )).flat();
1402
+ return {
1403
+ ...message,
1404
+ content: expandedContent
1405
+ };
1406
+ } catch (error) {
1300
1407
  this.logger.warn(
1301
1408
  `Failed to expand blob references in message: ${error instanceof Error ? error.message : String(error)}`
1302
1409
  );
1303
- return message.content;
1304
- })
1305
- }))
1410
+ return message;
1411
+ }
1412
+ })
1306
1413
  );
1307
1414
  }
1308
1415
  async getSessionUsageSummary(sessionId, usageScopeId) {
@@ -1640,16 +1747,18 @@ Either:
1640
1747
  * @param sessionScope - Session ID, '*' for all sessions, or undefined for default session
1641
1748
  */
1642
1749
  async performLLMSwitch(validatedConfig, sessionScope) {
1643
- this.stateManager.updateLLM(validatedConfig, sessionScope);
1644
1750
  if (sessionScope === "*") {
1751
+ this.stateManager.updateLLM(validatedConfig, sessionScope);
1645
1752
  await this.sessionManager.switchLLMForAllSessions(validatedConfig);
1646
1753
  } else if (sessionScope) {
1647
1754
  const session = await this.sessionManager.getSession(sessionScope);
1648
1755
  if (!session) {
1649
1756
  throw SessionError.notFound(sessionScope);
1650
1757
  }
1758
+ this.stateManager.updateLLM(validatedConfig, sessionScope);
1651
1759
  await this.sessionManager.switchLLMForSpecificSession(validatedConfig, sessionScope);
1652
1760
  } else {
1761
+ this.stateManager.updateLLM(validatedConfig, sessionScope);
1653
1762
  this.logger.debug("LLM config updated at agent level (no active session switches)");
1654
1763
  }
1655
1764
  }
@@ -47,6 +47,8 @@ export type ContentInput = string | ContentPart[];
47
47
  export interface GenerateOptions {
48
48
  /** AbortSignal for cancellation */
49
49
  signal?: AbortSignal;
50
+ /** Optional signal to stop streaming to the caller without cancelling the run itself */
51
+ disconnectSignal?: AbortSignal;
50
52
  }
51
53
  /**
52
54
  * Complete response from generate() method
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAErE;;GAEG;AACH,YAAY,EACR,WAAW,EACX,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,SAAS,EACT,QAAQ,GACX,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,aAAa,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE5E;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EACD;QACI,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,EAAE,GAAG,CAAC;KACb,GACD,SAAS,CAAC;CACnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,WAAW,EAAE,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC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AAE,GAAG,CAAC;KACb,GACD,SAAS,CAAC;CACnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,WAAW,EAAE,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,mCAAmC;IACnC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,wFAAwF;IACxF,gBAAgB,CAAC,EAAE,WAAW,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,gBAAgB,CAAC;CACpC;AAED;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,eAAe,CAAC"}
@@ -36,7 +36,9 @@ var import_types2 = require("./types.js");
36
36
  var import_types3 = require("../logger/v2/types.js");
37
37
  var import_utils = require("./utils.js");
38
38
  var import_errors = require("./errors.js");
39
+ var import_media_helpers = require("./media-helpers.js");
39
40
  class ContextManager {
41
+ static PROMPT_MEDIA_RETENTION_MESSAGES = 2;
40
42
  /**
41
43
  * The validated LLM configuration.
42
44
  */
@@ -79,6 +81,114 @@ class ContextManager {
79
81
  */
80
82
  resourceManager;
81
83
  logger;
84
+ static deriveResourceKind(mimeType) {
85
+ if (mimeType.startsWith("text/") || mimeType === "application/json" || mimeType === "application/xml") {
86
+ return "text";
87
+ }
88
+ return (0, import_media_helpers.getResourceKind)(mimeType);
89
+ }
90
+ static hasRetainableMedia(message) {
91
+ if (!Array.isArray(message.content)) {
92
+ return false;
93
+ }
94
+ return message.content.some((part) => {
95
+ if (part.type === "resource") {
96
+ return (0, import_utils.isBinaryMediaMimeType)(part.mimeType);
97
+ }
98
+ if (part.type === "image") {
99
+ return typeof part.image === "string" && part.image.startsWith("@blob:");
100
+ }
101
+ if (part.type === "file") {
102
+ return typeof part.data === "string" && part.data.startsWith("@blob:") && (0, import_utils.isBinaryMediaMimeType)(part.mimeType);
103
+ }
104
+ return false;
105
+ });
106
+ }
107
+ async persistContentPart(part, source) {
108
+ if (part.type === "text") {
109
+ return part.text.trim() ? { type: "text", text: part.text } : null;
110
+ }
111
+ if (part.type === "ui-resource") {
112
+ return part;
113
+ }
114
+ if (part.type === "resource") {
115
+ return {
116
+ ...part,
117
+ uri: part.uri.startsWith("@blob:") ? part.uri.substring(1) : part.uri
118
+ };
119
+ }
120
+ if (part.type === "image") {
121
+ const mimeType = part.mimeType || "image/jpeg";
122
+ if (typeof part.image === "string" && part.image.startsWith("@blob:")) {
123
+ return {
124
+ type: "resource",
125
+ uri: part.image.substring(1),
126
+ name: "image",
127
+ mimeType,
128
+ kind: ContextManager.deriveResourceKind(mimeType),
129
+ metadata: { source: source === "user" ? "upload" : "tool" }
130
+ };
131
+ }
132
+ const processedImage = await this.processUserInput(part.image, {
133
+ mimeType,
134
+ source
135
+ });
136
+ if (typeof processedImage === "string" && processedImage.startsWith("@blob:")) {
137
+ return {
138
+ type: "resource",
139
+ uri: processedImage.substring(1),
140
+ name: "image",
141
+ mimeType,
142
+ kind: ContextManager.deriveResourceKind(mimeType),
143
+ metadata: { source: source === "user" ? "upload" : "tool" }
144
+ };
145
+ }
146
+ return {
147
+ type: "image",
148
+ image: processedImage,
149
+ mimeType
150
+ };
151
+ }
152
+ const metadata = {
153
+ mimeType: part.mimeType,
154
+ source
155
+ };
156
+ if (part.filename) {
157
+ metadata.originalName = part.filename;
158
+ }
159
+ if (typeof part.data === "string" && part.data.startsWith("@blob:")) {
160
+ return {
161
+ type: "resource",
162
+ uri: part.data.substring(1),
163
+ name: part.filename ?? "file",
164
+ mimeType: part.mimeType,
165
+ kind: ContextManager.deriveResourceKind(part.mimeType),
166
+ metadata: {
167
+ source: source === "user" ? "upload" : "tool"
168
+ }
169
+ };
170
+ }
171
+ const processedData = await this.processUserInput(part.data, metadata);
172
+ if (typeof processedData === "string" && processedData.startsWith("@blob:")) {
173
+ return {
174
+ type: "resource",
175
+ uri: processedData.substring(1),
176
+ name: part.filename ?? "file",
177
+ mimeType: part.mimeType,
178
+ kind: ContextManager.deriveResourceKind(part.mimeType),
179
+ metadata: {
180
+ source: source === "user" ? "upload" : "tool"
181
+ },
182
+ ...part.filename ? {} : {}
183
+ };
184
+ }
185
+ return {
186
+ type: "file",
187
+ data: processedData,
188
+ mimeType: part.mimeType,
189
+ ...part.filename && { filename: part.filename }
190
+ };
191
+ }
82
192
  /**
83
193
  * Creates a new ContextManager instance
84
194
  * @param llmConfig The validated LLM configuration.
@@ -519,50 +629,28 @@ ${prompt}`);
519
629
  throw import_errors.ContextError.userMessageContentEmpty();
520
630
  }
521
631
  const hasText = content.some((p) => p.type === "text" && p.text.trim() !== "");
522
- const hasAttachment = content.some((p) => p.type === "image" || p.type === "file");
632
+ const hasAttachment = content.some(
633
+ (p) => p.type === "image" || p.type === "file" || p.type === "resource"
634
+ );
523
635
  if (!hasText && !hasAttachment) {
524
636
  throw import_errors.ContextError.userMessageContentEmpty();
525
637
  }
526
638
  const processedParts = [];
527
639
  for (const part of content) {
528
- if (part.type === "text") {
529
- if (part.text.trim()) {
530
- processedParts.push({ type: "text", text: part.text });
531
- }
532
- } else if (part.type === "image") {
533
- const processedImage = await this.processUserInput(part.image, {
534
- mimeType: part.mimeType || "image/jpeg",
535
- source: "user"
536
- });
537
- processedParts.push({
538
- type: "image",
539
- image: processedImage,
540
- mimeType: part.mimeType || "image/jpeg"
541
- });
542
- } else if (part.type === "file") {
543
- const metadata = {
544
- mimeType: part.mimeType,
545
- source: "user"
546
- };
547
- if (part.filename) {
548
- metadata.originalName = part.filename;
549
- }
550
- const processedData = await this.processUserInput(part.data, metadata);
551
- processedParts.push({
552
- type: "file",
553
- data: processedData,
554
- mimeType: part.mimeType,
555
- ...part.filename && { filename: part.filename }
556
- });
640
+ const persisted = await this.persistContentPart(part, "user");
641
+ if (persisted) {
642
+ processedParts.push(persisted);
557
643
  }
558
644
  }
559
645
  const textParts = processedParts.filter((p) => p.type === "text");
560
646
  const imageParts = processedParts.filter((p) => p.type === "image");
561
647
  const fileParts = processedParts.filter((p) => p.type === "file");
648
+ const resourceParts = processedParts.filter((p) => p.type === "resource");
562
649
  this.logger.info("User message received", {
563
650
  textParts: textParts.length,
564
651
  imageParts: imageParts.length,
565
652
  fileParts: fileParts.length,
653
+ resourceParts: resourceParts.length,
566
654
  totalParts: processedParts.length
567
655
  });
568
656
  await this.addMessage({ role: "user", content: processedParts });
@@ -611,12 +699,19 @@ ${prompt}`);
611
699
  throw import_errors.ContextError.toolCallIdNameRequired();
612
700
  }
613
701
  const summary = sanitizedResult.content.map(
614
- (p) => p.type === "text" ? `text(${p.text.length})` : p.type === "image" ? `image(${p.mimeType || "image"})` : p.type === "ui-resource" ? `ui-resource(${p.uri})` : `file(${p.mimeType || "file"})`
702
+ (p) => p.type === "text" ? `text(${p.text.length})` : p.type === "image" ? `image(${p.mimeType || "image"})` : p.type === "resource" ? `resource(${p.uri})` : p.type === "ui-resource" ? `ui-resource(${p.uri})` : `file(${p.mimeType || "file"})`
615
703
  ).join(", ");
616
704
  this.logger.debug(`ContextManager: Storing tool result (parts) for ${name}: [${summary}]`);
705
+ const persistedContent = [];
706
+ for (const part of sanitizedResult.content) {
707
+ const persisted = await this.persistContentPart(part, "system");
708
+ if (persisted) {
709
+ persistedContent.push(persisted);
710
+ }
711
+ }
617
712
  await this.addMessage({
618
713
  role: "tool",
619
- content: sanitizedResult.content,
714
+ content: persistedContent,
620
715
  toolCallId,
621
716
  name,
622
717
  ...metadata?.presentationSnapshot !== void 0 && {
@@ -677,17 +772,30 @@ ${prompt}`);
677
772
  );
678
773
  }
679
774
  this.logger.debug("Resolving blob references in message history before formatting");
775
+ const retainedMediaMessageIndexes = /* @__PURE__ */ new Set();
776
+ let retainedMediaMessages = 0;
777
+ for (let index = messageHistory.length - 1; index >= 0; index--) {
778
+ if (retainedMediaMessages >= ContextManager.PROMPT_MEDIA_RETENTION_MESSAGES) {
779
+ break;
780
+ }
781
+ if (ContextManager.hasRetainableMedia(messageHistory[index])) {
782
+ retainedMediaMessageIndexes.add(index);
783
+ retainedMediaMessages += 1;
784
+ }
785
+ }
680
786
  messageHistory = await Promise.all(
681
- messageHistory.map(async (message) => {
787
+ messageHistory.map(async (message, index) => {
682
788
  if ((0, import_types2.isSystemMessage)(message) || (0, import_types2.isAssistantMessage)(message)) {
683
789
  return message;
684
790
  }
791
+ const expandMatchingMedia = retainedMediaMessageIndexes.has(index);
685
792
  if ((0, import_types2.isUserMessage)(message)) {
686
793
  const expandedContent = await (0, import_utils.expandBlobReferences)(
687
794
  message.content,
688
795
  this.resourceManager,
689
796
  this.logger,
690
- allowedMediaTypes
797
+ allowedMediaTypes,
798
+ expandMatchingMedia
691
799
  );
692
800
  return { ...message, content: expandedContent };
693
801
  }
@@ -696,7 +804,8 @@ ${prompt}`);
696
804
  message.content,
697
805
  this.resourceManager,
698
806
  this.logger,
699
- allowedMediaTypes
807
+ allowedMediaTypes,
808
+ expandMatchingMedia
700
809
  );
701
810
  return { ...message, content: expandedContent };
702
811
  }
@@ -23,6 +23,7 @@ import type { ToolPresentationSnapshotV1 } from '../tools/types.js';
23
23
  * @template TMessage The message type for the specific LLM provider (e.g., MessageParam, ChatCompletionMessageParam, ModelMessage)
24
24
  */
25
25
  export declare class ContextManager<TMessage = unknown> {
26
+ private static readonly PROMPT_MEDIA_RETENTION_MESSAGES;
26
27
  /**
27
28
  * The validated LLM configuration.
28
29
  */
@@ -65,6 +66,9 @@ export declare class ContextManager<TMessage = unknown> {
65
66
  */
66
67
  private resourceManager;
67
68
  private logger;
69
+ private static deriveResourceKind;
70
+ private static hasRetainableMedia;
71
+ private persistContentPart;
68
72
  /**
69
73
  * Creates a new ContextManager instance
70
74
  * @param llmConfig The validated LLM configuration.
@@ -1 +1 @@
1
- {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/context/manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AASpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAE/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAEpE;;;;;;;;;;;;;GAaG;AACH,qBAAa,cAAc,CAAC,QAAQ,GAAG,OAAO;IAC1C;;OAEG;IACH,OAAO,CAAC,SAAS,CAAqB;IAEtC;;OAEG;IACH,OAAO,CAAC,mBAAmB,CAAsB;IAEjD;;OAEG;IACH,OAAO,CAAC,SAAS,CAAyB;IAE1C;;OAEG;IACH,OAAO,CAAC,cAAc,CAAS;IAE/B;;;OAGG;IACH,OAAO,CAAC,qBAAqB,CAAuB;IAEpD;;;;OAIG;IACH,OAAO,CAAC,sBAAsB,CAAuB;IAErD;;;;OAIG;IACH,OAAO,CAAC,oBAAoB,CAAuB;IAEnD,OAAO,CAAC,eAAe,CA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