@mastra/core 0.1.27-alpha.43 → 0.1.27-alpha.45

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.
@@ -4253,7 +4253,7 @@ var Workflow = /*#__PURE__*/function (_MastraBase) {
4253
4253
  var allStatesComplete = _classPrivateFieldLooseBase(_this2, _recursivelyCheckForFinalState)[_recursivelyCheckForFinalState](allStatesValue);
4254
4254
  if (allStatesComplete) {
4255
4255
  // Check if any steps failed
4256
- var hasFailures = Object.values(state.context.stepResults).some(function (result) {
4256
+ var allStepsFailed = Object.values(state.context.stepResults).every(function (result) {
4257
4257
  return result.status === 'failed';
4258
4258
  });
4259
4259
  var hasSuspended = Object.values(state.context.stepResults).some(function (result) {
@@ -4262,7 +4262,7 @@ var Workflow = /*#__PURE__*/function (_MastraBase) {
4262
4262
  if (hasSuspended) {
4263
4263
  _classPrivateFieldLooseBase(_this2, _persistWorkflowSnapshot)[_persistWorkflowSnapshot]();
4264
4264
  }
4265
- if (hasFailures) {
4265
+ if (allStepsFailed) {
4266
4266
  _this2.log(LogLevel.ERROR, 'Workflow failed', {
4267
4267
  results: state.context.stepResults,
4268
4268
  runId: _classPrivateFieldLooseBase(_this2, _runId)[_runId]
@@ -4660,21 +4660,30 @@ function _getDefaultActors2() {
4660
4660
  injectables = _classPrivateFieldLooseBase(_this7, _getInjectables)[_getInjectables]();
4661
4661
  resolvedData = _classPrivateFieldLooseBase(_this7, _resolveVariables)[_resolveVariables]({
4662
4662
  stepConfig: stepNode.config,
4663
- context: context
4663
+ context: context,
4664
+ stepId: stepNode.step.id
4664
4665
  });
4665
- _context2.next = 6;
4666
+ _this7.log(LogLevel.DEBUG, "Resolved variables for " + stepNode.step.id, {
4667
+ resolvedData: resolvedData,
4668
+ runId: _classPrivateFieldLooseBase(_this7, _runId)[_runId]
4669
+ });
4670
+ _context2.next = 7;
4666
4671
  return stepNode.config.handler(_extends({
4667
4672
  context: _extends({
4668
4673
  machineContext: context
4669
4674
  }, resolvedData)
4670
4675
  }, injectables));
4671
- case 6:
4676
+ case 7:
4672
4677
  result = _context2.sent;
4678
+ _this7.log(LogLevel.DEBUG, "Step " + stepNode.step.id + " result", {
4679
+ result: result,
4680
+ runId: _classPrivateFieldLooseBase(_this7, _runId)[_runId]
4681
+ });
4673
4682
  return _context2.abrupt("return", {
4674
4683
  stepId: stepNode.step.id,
4675
4684
  result: result
4676
4685
  });
4677
- case 8:
4686
+ case 10:
4678
4687
  case "end":
4679
4688
  return _context2.stop();
4680
4689
  }
@@ -4921,20 +4930,33 @@ function _loadWorkflowSnapshot3() {
4921
4930
  }
4922
4931
  function _resolveVariables2(_ref30) {
4923
4932
  var stepConfig = _ref30.stepConfig,
4924
- context = _ref30.context;
4933
+ context = _ref30.context,
4934
+ stepId = _ref30.stepId;
4925
4935
  var resolvedData = {};
4936
+ this.log(LogLevel.DEBUG, "Resolving variables for " + stepId, {
4937
+ runId: _classPrivateFieldLooseBase(this, _runId)[_runId]
4938
+ });
4926
4939
  for (var _i3 = 0, _Object$entries3 = Object.entries(stepConfig.data); _i3 < _Object$entries3.length; _i3++) {
4927
4940
  var _Object$entries3$_i = _Object$entries3[_i3],
4928
4941
  key = _Object$entries3$_i[0],
4929
4942
  variable = _Object$entries3$_i[1];
4930
4943
  // Check if variable comes from trigger data or a previous step's result
4931
4944
  var sourceData = variable.step === 'trigger' ? context.triggerData : getStepResult(context.stepResults[variable.step.id]);
4945
+ this.log(LogLevel.DEBUG, "Got source data for " + key + " variable from " + (variable.step === 'trigger' ? 'trigger' : variable.step.id), {
4946
+ sourceData: sourceData,
4947
+ path: variable.path,
4948
+ runId: _classPrivateFieldLooseBase(this, _runId)[_runId]
4949
+ });
4932
4950
  if (!sourceData && variable.step !== 'trigger') {
4933
4951
  resolvedData[key] = undefined;
4934
4952
  continue;
4935
4953
  }
4936
4954
  // If path is empty or '.', return the entire source data
4937
4955
  var value = variable.path === '' || variable.path === '.' ? sourceData[key] : radash.get(sourceData, variable.path);
4956
+ this.log(LogLevel.DEBUG, "Resolved variable " + key, {
4957
+ value: value,
4958
+ runId: _classPrivateFieldLooseBase(this, _runId)[_runId]
4959
+ });
4938
4960
  resolvedData[key] = value;
4939
4961
  }
4940
4962
  return resolvedData;
@@ -4949,6 +4971,10 @@ function _evaluateCondition2(condition, context) {
4949
4971
  var ref = condition.ref,
4950
4972
  query = condition.query;
4951
4973
  var sourceData = ref.step === 'trigger' ? context.triggerData : getStepResult(context.stepResults[ref.step.id]);
4974
+ this.log(LogLevel.DEBUG, "Got condition data from " + (ref.step === 'trigger' ? 'trigger' : ref.step.id), {
4975
+ sourceData: sourceData,
4976
+ runId: _classPrivateFieldLooseBase(this, _runId)[_runId]
4977
+ });
4952
4978
  if (!sourceData) {
4953
4979
  return false;
4954
4980
  }
@@ -4960,14 +4986,26 @@ function _evaluateCondition2(condition, context) {
4960
4986
  andBranchResult = condition.and.every(function (cond) {
4961
4987
  return _classPrivateFieldLooseBase(_this8, _evaluateCondition)[_evaluateCondition](cond, context);
4962
4988
  });
4989
+ this.log(LogLevel.DEBUG, "Evaluated AND condition", {
4990
+ andBranchResult: andBranchResult,
4991
+ runId: _classPrivateFieldLooseBase(this, _runId)[_runId]
4992
+ });
4963
4993
  }
4964
4994
  // OR condition
4965
4995
  if ('or' in condition) {
4966
4996
  orBranchResult = condition.or.some(function (cond) {
4967
4997
  return _classPrivateFieldLooseBase(_this8, _evaluateCondition)[_evaluateCondition](cond, context);
4968
4998
  });
4999
+ this.log(LogLevel.DEBUG, "Evaluated OR condition", {
5000
+ orBranchResult: orBranchResult,
5001
+ runId: _classPrivateFieldLooseBase(this, _runId)[_runId]
5002
+ });
4969
5003
  }
4970
5004
  var finalResult = baseResult && andBranchResult && orBranchResult;
5005
+ this.log(LogLevel.DEBUG, "Evaluated condition", {
5006
+ finalResult: finalResult,
5007
+ runId: _classPrivateFieldLooseBase(this, _runId)[_runId]
5008
+ });
4971
5009
  return finalResult;
4972
5010
  }
4973
5011
  function _makeStepDef2(stepId) {