@voltagent/core 0.1.49 → 0.1.50

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.js CHANGED
@@ -401,7 +401,6 @@ var _AgentEventEmitter = class extends import_node_events.EventEmitter {
401
401
  const { agentId, historyId, event, skipPropagation = false, parentHistoryEntryId } = params;
402
402
  const agent = AgentRegistry.getInstance().getAgent(agentId);
403
403
  if (!agent) {
404
- import_dev2.devLogger.warn("Agent not found: ", agentId);
405
404
  return void 0;
406
405
  }
407
406
  const historyManager = agent.getHistoryManager();
@@ -3502,9 +3501,7 @@ var LibSQLStorage = class {
3502
3501
  }
3503
3502
  try {
3504
3503
  const migrationResult = await this.migrateAgentHistorySchema();
3505
- if (migrationResult.success) {
3506
- import_dev6.devLogger.info("Agent history schema migration completed successfully");
3507
- } else {
3504
+ if (!migrationResult.success) {
3508
3505
  import_dev6.devLogger.error("Agent history schema migration error:", migrationResult.error);
3509
3506
  }
3510
3507
  } catch (error) {
@@ -8922,17 +8919,21 @@ ${retrieverContext}`;
8922
8919
  status: "completed"
8923
8920
  });
8924
8921
  operationContext.isActive = false;
8925
- const extendedResponse = {
8922
+ const initialResponse = {
8926
8923
  ...response,
8927
8924
  userContext: new Map(operationContext.userContext)
8928
8925
  };
8929
8926
  await this.hooks.onEnd?.({
8930
8927
  conversationId: finalConversationId,
8931
8928
  agent: this,
8932
- output: extendedResponse,
8929
+ output: initialResponse,
8933
8930
  error: void 0,
8934
8931
  context: operationContext
8935
8932
  });
8933
+ const extendedResponse = {
8934
+ ...response,
8935
+ userContext: new Map(operationContext.userContext)
8936
+ };
8936
8937
  this.updateHistoryEntry(operationContext, {
8937
8938
  output: response.text,
8938
8939
  usage: response.usage,
@@ -9325,17 +9326,21 @@ ${retrieverContext}`;
9325
9326
  }
9326
9327
  });
9327
9328
  operationContext.isActive = false;
9328
- const resultWithContext = {
9329
+ const initialResult = {
9329
9330
  ...result,
9330
9331
  userContext: new Map(operationContext.userContext)
9331
9332
  };
9332
9333
  await this.hooks.onEnd?.({
9333
9334
  agent: this,
9334
- output: resultWithContext,
9335
+ output: initialResult,
9335
9336
  error: void 0,
9336
9337
  conversationId: finalConversationId,
9337
9338
  context: operationContext
9338
9339
  });
9340
+ const resultWithContext = {
9341
+ ...result,
9342
+ userContext: new Map(operationContext.userContext)
9343
+ };
9339
9344
  if (internalOptions.provider?.onFinish) {
9340
9345
  await internalOptions.provider.onFinish(
9341
9346
  resultWithContext
@@ -9620,17 +9625,21 @@ ${retrieverContext}`;
9620
9625
  endTime: /* @__PURE__ */ new Date(),
9621
9626
  status: "completed"
9622
9627
  });
9623
- const extendedResponse = {
9628
+ const initialResponse = {
9624
9629
  ...response,
9625
9630
  userContext: new Map(operationContext.userContext)
9626
9631
  };
9627
9632
  await this.hooks.onEnd?.({
9628
9633
  agent: this,
9629
- output: extendedResponse,
9634
+ output: initialResponse,
9630
9635
  error: void 0,
9631
9636
  conversationId: finalConversationId,
9632
9637
  context: operationContext
9633
9638
  });
9639
+ const extendedResponse = {
9640
+ ...response,
9641
+ userContext: new Map(operationContext.userContext)
9642
+ };
9634
9643
  return extendedResponse;
9635
9644
  } catch (error) {
9636
9645
  const voltagentError = error;
@@ -9864,17 +9873,21 @@ ${retrieverContext}`;
9864
9873
  status: "completed"
9865
9874
  });
9866
9875
  operationContext.isActive = false;
9867
- const resultWithContext = {
9876
+ const initialResult = {
9868
9877
  ...result,
9869
9878
  userContext: new Map(operationContext.userContext)
9870
9879
  };
9871
9880
  await this.hooks.onEnd?.({
9872
9881
  agent: this,
9873
- output: resultWithContext,
9882
+ output: initialResult,
9874
9883
  error: void 0,
9875
9884
  conversationId: finalConversationId,
9876
9885
  context: operationContext
9877
9886
  });
9887
+ const resultWithContext = {
9888
+ ...result,
9889
+ userContext: new Map(operationContext.userContext)
9890
+ };
9878
9891
  if (provider?.onFinish) {
9879
9892
  await provider.onFinish(
9880
9893
  resultWithContext