@voltagent/core 2.4.2 → 2.4.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/dist/index.js CHANGED
@@ -505,7 +505,7 @@ function convertWorkflowStateToParam(state, executionContext, signal) {
505
505
  executionId: state.executionId,
506
506
  conversationId: state.conversationId,
507
507
  userId: state.userId,
508
- context: state.context,
508
+ context: executionContext?.context ?? state.context,
509
509
  workflowState: state.workflowState,
510
510
  active: state.active,
511
511
  startAt: state.startAt,
@@ -9813,7 +9813,7 @@ function createWorkflow({
9813
9813
  workflowName: name,
9814
9814
  status: "running",
9815
9815
  input: input2,
9816
- context: options?.context ? Array.from(options.context.entries()) : void 0,
9816
+ context: options?.context ? Array.from(contextMap.entries()) : void 0,
9817
9817
  workflowState: workflowStateStore,
9818
9818
  userId: options?.userId,
9819
9819
  conversationId: options?.conversationId,
@@ -9834,7 +9834,7 @@ function createWorkflow({
9834
9834
  );
9835
9835
  }
9836
9836
  }
9837
- const streamWriter = streamController ? new WorkflowStreamWriterImpl(streamController, executionId, id, name, 0, options?.context) : new NoOpWorkflowStreamWriter();
9837
+ const streamWriter = streamController ? new WorkflowStreamWriterImpl(streamController, executionId, id, name, 0, contextMap) : new NoOpWorkflowStreamWriter();
9838
9838
  const executionContext = {
9839
9839
  workflowId: id,
9840
9840
  executionId,
@@ -9888,7 +9888,7 @@ function createWorkflow({
9888
9888
  from: name,
9889
9889
  input: input2,
9890
9890
  status: "running",
9891
- context: options?.context,
9891
+ context: contextMap,
9892
9892
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
9893
9893
  });
9894
9894
  runLogger.debug(
@@ -9901,6 +9901,7 @@ function createWorkflow({
9901
9901
  if (options?.resumeFrom?.executionId) {
9902
9902
  stateManager.start(input2, {
9903
9903
  ...options,
9904
+ context: contextMap,
9904
9905
  executionId,
9905
9906
  // Use the resumed execution ID
9906
9907
  active: options.resumeFrom.resumeStepIndex,
@@ -9909,6 +9910,7 @@ function createWorkflow({
9909
9910
  } else {
9910
9911
  stateManager.start(input2, {
9911
9912
  ...options,
9913
+ context: contextMap,
9912
9914
  executionId,
9913
9915
  // Use the created execution ID
9914
9916
  workflowState: workflowStateStore
@@ -10022,7 +10024,7 @@ function createWorkflow({
10022
10024
  input: stateManager.state.data,
10023
10025
  output: void 0,
10024
10026
  status: "cancelled",
10025
- context: options?.context,
10027
+ context: contextMap,
10026
10028
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10027
10029
  stepIndex: index,
10028
10030
  stepType: step.type,
@@ -10058,7 +10060,7 @@ function createWorkflow({
10058
10060
  executionId,
10059
10061
  from: name,
10060
10062
  status: "cancelled",
10061
- context: options?.context,
10063
+ context: contextMap,
10062
10064
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10063
10065
  metadata: { reason }
10064
10066
  });
@@ -10190,7 +10192,7 @@ function createWorkflow({
10190
10192
  step.id,
10191
10193
  step.name || step.id,
10192
10194
  index,
10193
- options?.context
10195
+ contextMap
10194
10196
  ) : new NoOpWorkflowStreamWriter();
10195
10197
  executionContext.streamWriter = stepWriter;
10196
10198
  emitAndCollectEvent({
@@ -10199,7 +10201,7 @@ function createWorkflow({
10199
10201
  from: step.name || step.id,
10200
10202
  input: stateManager.state.data,
10201
10203
  status: "running",
10202
- context: options?.context,
10204
+ context: contextMap,
10203
10205
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10204
10206
  stepIndex: index,
10205
10207
  stepType: step.type,
@@ -10269,7 +10271,7 @@ function createWorkflow({
10269
10271
  input: stateManager.state.data,
10270
10272
  output: void 0,
10271
10273
  status: "suspended",
10272
- context: options?.context,
10274
+ context: contextMap,
10273
10275
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10274
10276
  stepIndex: index,
10275
10277
  metadata: {
@@ -10337,7 +10339,7 @@ function createWorkflow({
10337
10339
  step.id,
10338
10340
  step.name || step.id,
10339
10341
  index,
10340
- options?.context
10342
+ contextMap
10341
10343
  ) : new NoOpWorkflowStreamWriter();
10342
10344
  const stepExecutionContext = {
10343
10345
  ...executionContext,
@@ -10414,7 +10416,7 @@ function createWorkflow({
10414
10416
  input: stateManager.state.data,
10415
10417
  output: result2,
10416
10418
  status: isSkipped ? "skipped" : "success",
10417
- context: options?.context,
10419
+ context: contextMap,
10418
10420
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10419
10421
  stepIndex: index,
10420
10422
  stepType: step.type,
@@ -10539,7 +10541,7 @@ function createWorkflow({
10539
10541
  from: name,
10540
10542
  output: finalState.result,
10541
10543
  status: "success",
10542
- context: options?.context,
10544
+ context: contextMap,
10543
10545
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
10544
10546
  });
10545
10547
  streamController?.close();
@@ -10569,7 +10571,7 @@ function createWorkflow({
10569
10571
  executionId,
10570
10572
  from: name,
10571
10573
  status: "cancelled",
10572
- context: options?.context,
10574
+ context: contextMap,
10573
10575
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10574
10576
  metadata: cancellationReason ? { reason: cancellationReason } : void 0
10575
10577
  });
@@ -10645,7 +10647,7 @@ function createWorkflow({
10645
10647
  from: name,
10646
10648
  status: "error",
10647
10649
  error,
10648
- context: options?.context,
10650
+ context: contextMap,
10649
10651
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
10650
10652
  });
10651
10653
  if (stateManager.state.status !== "completed" && stateManager.state.status !== "failed") {