@voltagent/core 1.2.10 → 1.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1030,7 +1030,9 @@ interface VectorItem$1 {
1030
1030
  interface StorageAdapter {
1031
1031
  addMessage(message: UIMessage, userId: string, conversationId: string, context?: OperationContext): Promise<void>;
1032
1032
  addMessages(messages: UIMessage[], userId: string, conversationId: string, context?: OperationContext): Promise<void>;
1033
- getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise<UIMessage[]>;
1033
+ getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise<UIMessage<{
1034
+ createdAt: Date;
1035
+ }>[]>;
1034
1036
  clearMessages(userId: string, conversationId?: string, context?: OperationContext): Promise<void>;
1035
1037
  createConversation(input: CreateConversationInput): Promise<Conversation>;
1036
1038
  getConversation(id: string): Promise<Conversation | null>;
@@ -1292,7 +1294,9 @@ declare class Memory {
1292
1294
  /**
1293
1295
  * Get messages from a conversation
1294
1296
  */
1295
- getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise<UIMessage[]>;
1297
+ getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise<UIMessage<{
1298
+ createdAt: Date;
1299
+ }>[]>;
1296
1300
  /**
1297
1301
  * Save a single message
1298
1302
  */
@@ -1348,7 +1352,9 @@ declare class Memory {
1348
1352
  semanticLimit?: number;
1349
1353
  semanticThreshold?: number;
1350
1354
  mergeStrategy?: "prepend" | "append" | "interleave";
1351
- }): Promise<UIMessage[]>;
1355
+ }): Promise<UIMessage<{
1356
+ createdAt: Date;
1357
+ }>[]>;
1352
1358
  /**
1353
1359
  * Get messages by their IDs
1354
1360
  */
@@ -1472,7 +1478,9 @@ declare class Memory {
1472
1478
  semanticLimit?: number;
1473
1479
  semanticThreshold?: number;
1474
1480
  mergeStrategy?: "prepend" | "append" | "interleave";
1475
- }, operationContext?: OperationContext): Promise<UIMessage[]>;
1481
+ }, operationContext?: OperationContext): Promise<UIMessage<{
1482
+ createdAt: Date;
1483
+ }>[]>;
1476
1484
  /**
1477
1485
  * Internal: Set resource ID (agent ID)
1478
1486
  */
@@ -4831,12 +4839,16 @@ declare class MemoryManager {
4831
4839
  mergeStrategy?: "prepend" | "append" | "interleave";
4832
4840
  traceContext?: AgentTraceContext;
4833
4841
  parentMemorySpan?: Span;
4834
- }): Promise<UIMessage[]>;
4842
+ }): Promise<UIMessage<{
4843
+ createdAt: Date;
4844
+ }>[]>;
4835
4845
  /**
4836
4846
  * Search messages semantically
4837
4847
  * PRESERVED FROM ORIGINAL WITH MEMORY V2 INTEGRATION
4838
4848
  */
4839
- searchMessages(context: OperationContext, _query: string, userId?: string, conversationId?: string, limit?: number): Promise<UIMessage[]>;
4849
+ searchMessages(context: OperationContext, _query: string, userId?: string, conversationId?: string, limit?: number): Promise<UIMessage<{
4850
+ createdAt: Date;
4851
+ }>[]>;
4840
4852
  /**
4841
4853
  * Clear messages from memory
4842
4854
  * PRESERVED FROM ORIGINAL WITH MEMORY V2 INTEGRATION
@@ -4848,7 +4860,9 @@ declare class MemoryManager {
4848
4860
  * PRESERVED FROM ORIGINAL
4849
4861
  */
4850
4862
  prepareConversationContext(context: OperationContext, input: string | UIMessage[], userId?: string, conversationIdParam?: string, contextLimit?: number): Promise<{
4851
- messages: UIMessage[];
4863
+ messages: UIMessage<{
4864
+ createdAt: Date;
4865
+ }>[];
4852
4866
  conversationId: string;
4853
4867
  }>;
4854
4868
  /**
@@ -9096,7 +9110,9 @@ declare class InMemoryStorageAdapter implements StorageAdapter {
9096
9110
  /**
9097
9111
  * Get messages with optional filtering
9098
9112
  */
9099
- getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, _context?: OperationContext): Promise<UIMessage[]>;
9113
+ getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, _context?: OperationContext): Promise<UIMessage<{
9114
+ createdAt: Date;
9115
+ }>[]>;
9100
9116
  saveConversationSteps(steps: ConversationStepRecord[]): Promise<void>;
9101
9117
  getConversationSteps(userId: string, conversationId: string, options?: GetConversationStepsOptions): Promise<ConversationStepRecord[]>;
9102
9118
  /**
package/dist/index.d.ts CHANGED
@@ -1030,7 +1030,9 @@ interface VectorItem$1 {
1030
1030
  interface StorageAdapter {
1031
1031
  addMessage(message: UIMessage, userId: string, conversationId: string, context?: OperationContext): Promise<void>;
1032
1032
  addMessages(messages: UIMessage[], userId: string, conversationId: string, context?: OperationContext): Promise<void>;
1033
- getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise<UIMessage[]>;
1033
+ getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise<UIMessage<{
1034
+ createdAt: Date;
1035
+ }>[]>;
1034
1036
  clearMessages(userId: string, conversationId?: string, context?: OperationContext): Promise<void>;
1035
1037
  createConversation(input: CreateConversationInput): Promise<Conversation>;
1036
1038
  getConversation(id: string): Promise<Conversation | null>;
@@ -1292,7 +1294,9 @@ declare class Memory {
1292
1294
  /**
1293
1295
  * Get messages from a conversation
1294
1296
  */
1295
- getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise<UIMessage[]>;
1297
+ getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise<UIMessage<{
1298
+ createdAt: Date;
1299
+ }>[]>;
1296
1300
  /**
1297
1301
  * Save a single message
1298
1302
  */
@@ -1348,7 +1352,9 @@ declare class Memory {
1348
1352
  semanticLimit?: number;
1349
1353
  semanticThreshold?: number;
1350
1354
  mergeStrategy?: "prepend" | "append" | "interleave";
1351
- }): Promise<UIMessage[]>;
1355
+ }): Promise<UIMessage<{
1356
+ createdAt: Date;
1357
+ }>[]>;
1352
1358
  /**
1353
1359
  * Get messages by their IDs
1354
1360
  */
@@ -1472,7 +1478,9 @@ declare class Memory {
1472
1478
  semanticLimit?: number;
1473
1479
  semanticThreshold?: number;
1474
1480
  mergeStrategy?: "prepend" | "append" | "interleave";
1475
- }, operationContext?: OperationContext): Promise<UIMessage[]>;
1481
+ }, operationContext?: OperationContext): Promise<UIMessage<{
1482
+ createdAt: Date;
1483
+ }>[]>;
1476
1484
  /**
1477
1485
  * Internal: Set resource ID (agent ID)
1478
1486
  */
@@ -4831,12 +4839,16 @@ declare class MemoryManager {
4831
4839
  mergeStrategy?: "prepend" | "append" | "interleave";
4832
4840
  traceContext?: AgentTraceContext;
4833
4841
  parentMemorySpan?: Span;
4834
- }): Promise<UIMessage[]>;
4842
+ }): Promise<UIMessage<{
4843
+ createdAt: Date;
4844
+ }>[]>;
4835
4845
  /**
4836
4846
  * Search messages semantically
4837
4847
  * PRESERVED FROM ORIGINAL WITH MEMORY V2 INTEGRATION
4838
4848
  */
4839
- searchMessages(context: OperationContext, _query: string, userId?: string, conversationId?: string, limit?: number): Promise<UIMessage[]>;
4849
+ searchMessages(context: OperationContext, _query: string, userId?: string, conversationId?: string, limit?: number): Promise<UIMessage<{
4850
+ createdAt: Date;
4851
+ }>[]>;
4840
4852
  /**
4841
4853
  * Clear messages from memory
4842
4854
  * PRESERVED FROM ORIGINAL WITH MEMORY V2 INTEGRATION
@@ -4848,7 +4860,9 @@ declare class MemoryManager {
4848
4860
  * PRESERVED FROM ORIGINAL
4849
4861
  */
4850
4862
  prepareConversationContext(context: OperationContext, input: string | UIMessage[], userId?: string, conversationIdParam?: string, contextLimit?: number): Promise<{
4851
- messages: UIMessage[];
4863
+ messages: UIMessage<{
4864
+ createdAt: Date;
4865
+ }>[];
4852
4866
  conversationId: string;
4853
4867
  }>;
4854
4868
  /**
@@ -9096,7 +9110,9 @@ declare class InMemoryStorageAdapter implements StorageAdapter {
9096
9110
  /**
9097
9111
  * Get messages with optional filtering
9098
9112
  */
9099
- getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, _context?: OperationContext): Promise<UIMessage[]>;
9113
+ getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, _context?: OperationContext): Promise<UIMessage<{
9114
+ createdAt: Date;
9115
+ }>[]>;
9100
9116
  saveConversationSteps(steps: ConversationStepRecord[]): Promise<void>;
9101
9117
  getConversationSteps(userId: string, conversationId: string, options?: GetConversationStepsOptions): Promise<ConversationStepRecord[]>;
9102
9118
  /**
package/dist/index.js CHANGED
@@ -2717,7 +2717,11 @@ var InMemoryStorageAdapter = class {
2717
2717
  }
2718
2718
  return messages.map((msg) => {
2719
2719
  const cloned = (0, import_utils8.deepClone)(msg);
2720
- const { createdAt, userId: msgUserId, conversationId: msgConvId, ...uiMessage } = cloned;
2720
+ const { userId: msgUserId, conversationId: msgConvId, ...uiMessage } = cloned;
2721
+ if (!uiMessage.metadata) {
2722
+ uiMessage.metadata = {};
2723
+ }
2724
+ uiMessage.metadata.createdAt = cloned.createdAt;
2721
2725
  return uiMessage;
2722
2726
  });
2723
2727
  }
@@ -8085,7 +8089,7 @@ var MemoryManager = class {
8085
8089
  async performSemanticSearch(userId, conversationId, query, limit, semanticLimit, semanticThreshold, mergeStrategy, logger, traceContext, parentMemorySpan) {
8086
8090
  if (!this.conversationMemory?.hasVectorSupport?.()) {
8087
8091
  logger.debug("Vector support not available, falling back to regular retrieval");
8088
- return this.conversationMemory?.getMessages(userId, conversationId, { limit }) || [];
8092
+ return await this.conversationMemory?.getMessages(userId, conversationId, { limit }) || [];
8089
8093
  }
8090
8094
  const embeddingAdapter = this.conversationMemory.getEmbeddingAdapter?.();
8091
8095
  const vectorAdapter = this.conversationMemory.getVectorAdapter?.();
@@ -10390,7 +10394,7 @@ var VoltOpsClient = class {
10390
10394
  evals;
10391
10395
  logger;
10392
10396
  get fetchImpl() {
10393
- return this.options.fetch ?? fetch;
10397
+ return this.options.fetch ?? fetch.bind(globalThis);
10394
10398
  }
10395
10399
  constructor(options) {
10396
10400
  const defaultPromptCache = {
@@ -18197,7 +18201,7 @@ ${retrieverContext}`;
18197
18201
  const retrievedContent = await oc.traceContext.withSpan(retrieverSpan, async () => {
18198
18202
  if (!this.retriever) return null;
18199
18203
  return await this.retriever.retrieve(retrieverInput, {
18200
- context: oc.context,
18204
+ ...oc,
18201
18205
  logger: retrieverLogger
18202
18206
  });
18203
18207
  });