@mastra/core 0.1.21 → 0.1.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.
@@ -2041,7 +2041,7 @@ var createWorkflowHandler = function createWorkflowHandler(_ref3) {
2041
2041
  event: 'workflow/run-automations'
2042
2042
  }, /*#__PURE__*/function () {
2043
2043
  var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
2044
- var event, step, _event$data, trigger, payload, connectionId, getBlueprintsDirPath, blueprints, triggeredAndPublishedBlueprints, runs;
2044
+ var event, step, _event$data, trigger, payload, connectionId, getBlueprintsDirPath, blueprints, triggeredAndPublishedBlueprints, runs, data;
2045
2045
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2046
2046
  while (1) switch (_context3.prev = _context3.next) {
2047
2047
  case 0:
@@ -2107,22 +2107,24 @@ var createWorkflowHandler = function createWorkflowHandler(_ref3) {
2107
2107
  _context3.next = 12;
2108
2108
  return Promise.all(runs);
2109
2109
  case 12:
2110
+ data = _context3.sent;
2110
2111
  return _context3.abrupt("return", {
2111
2112
  event: event,
2112
- body: "sync completed"
2113
+ body: "sync completed",
2114
+ data: data
2113
2115
  });
2114
- case 15:
2115
- _context3.prev = 15;
2116
+ case 16:
2117
+ _context3.prev = 16;
2116
2118
  _context3.t0 = _context3["catch"](1);
2117
2119
  return _context3.abrupt("return", {
2118
2120
  event: event,
2119
2121
  body: "error occurred while running sync: " + _context3.t0
2120
2122
  });
2121
- case 18:
2123
+ case 19:
2122
2124
  case "end":
2123
2125
  return _context3.stop();
2124
2126
  }
2125
- }, _callee3, null, [[1, 15]]);
2127
+ }, _callee3, null, [[1, 16]]);
2126
2128
  }));
2127
2129
  return function (_x3) {
2128
2130
  return _ref5.apply(this, arguments);
@@ -4208,11 +4210,11 @@ function runActionsRecursively(_x) {
4208
4210
  }
4209
4211
  function _runActionsRecursively() {
4210
4212
  _runActionsRecursively = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref7) {
4211
- var blueprintActions, frameworkApis, frameworkEvents, dataContext, blueprintId, runId, ctx, blueprintActionKVMap, logger, _loop, _ret, _iterator2, _step2;
4213
+ var blueprintActions, frameworkApis, frameworkEvents, dataContext, blueprintId, runId, ctx, blueprintActionKVMap, logger, order, _loop, _ret, _iterator2, _step2;
4212
4214
  return _regeneratorRuntime().wrap(function _callee$(_context3) {
4213
4215
  while (1) switch (_context3.prev = _context3.next) {
4214
4216
  case 0:
4215
- blueprintActions = _ref7.blueprintActions, frameworkApis = _ref7.frameworkApis, frameworkEvents = _ref7.frameworkEvents, dataContext = _ref7.dataContext, blueprintId = _ref7.blueprintId, runId = _ref7.runId, ctx = _ref7.ctx, blueprintActionKVMap = _ref7.blueprintActionKVMap, logger = _ref7.logger;
4217
+ blueprintActions = _ref7.blueprintActions, frameworkApis = _ref7.frameworkApis, frameworkEvents = _ref7.frameworkEvents, dataContext = _ref7.dataContext, blueprintId = _ref7.blueprintId, runId = _ref7.runId, ctx = _ref7.ctx, blueprintActionKVMap = _ref7.blueprintActionKVMap, logger = _ref7.logger, order = _ref7.order;
4216
4218
  _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
4217
4219
  var _action$subActions;
4218
4220
  var action, concreteAction, hasValidBranch, _loop2, _ret2, _iterator3, _step3, defaultCondition, defaultAction, actionExecutor, _ref9, mastraConnectionId, actionPayload, resolvedPayload, resolvedSchema, data, executorResult, _ctx, subActions;
@@ -4308,7 +4310,8 @@ function _runActionsRecursively() {
4308
4310
  runId: runId,
4309
4311
  ctx: ctx,
4310
4312
  blueprintActionKVMap: blueprintActionKVMap,
4311
- logger: logger
4313
+ logger: logger,
4314
+ order: order + 1
4312
4315
  });
4313
4316
  case 22:
4314
4317
  executorResult = _context.sent;
@@ -4390,7 +4393,8 @@ function _runActionsRecursively() {
4390
4393
  ctx: ctx,
4391
4394
  blueprintId: blueprintId,
4392
4395
  blueprintActionKVMap: blueprintActionKVMap,
4393
- logger: logger
4396
+ logger: logger,
4397
+ order: order + 1
4394
4398
  });
4395
4399
  case 26:
4396
4400
  _context2.t1 = _context2.sent;
@@ -4483,7 +4487,9 @@ function _runActionsRecursively() {
4483
4487
  v: false
4484
4488
  });
4485
4489
  case 57:
4486
- dataContext[action.id] = executorResult;
4490
+ dataContext[action.id] = _extends({}, executorResult, {
4491
+ workflowStepOrder: order
4492
+ });
4487
4493
  if (!(action.type === "CONDITIONS" || (_action$subActions = action.subActions) != null && _action$subActions.length)) {
4488
4494
  _context2.next = 65;
4489
4495
  break;
@@ -4503,7 +4509,8 @@ function _runActionsRecursively() {
4503
4509
  ctx: ctx,
4504
4510
  blueprintId: blueprintId,
4505
4511
  blueprintActionKVMap: blueprintActionKVMap,
4506
- logger: logger
4512
+ logger: logger,
4513
+ order: order + 1
4507
4514
  });
4508
4515
  case 63:
4509
4516
  _context2.t3 = _context2.sent;
@@ -4611,7 +4618,9 @@ function _blueprintRunner() {
4611
4618
  message: 'Workflow run skipped'
4612
4619
  })
4613
4620
  });
4614
- return _context4.abrupt("return");
4621
+ return _context4.abrupt("return", {
4622
+ fullCtx: null
4623
+ });
4615
4624
  case 16:
4616
4625
  blueprintActionKVMap = constructWorkflowContextBluePrint(blueprint);
4617
4626
  _context4.next = 19;
@@ -4624,28 +4633,40 @@ function _blueprintRunner() {
4624
4633
  blueprintActionKVMap: blueprintActionKVMap,
4625
4634
  blueprintId: blueprint.id,
4626
4635
  runId: '',
4627
- logger: logger
4636
+ logger: logger,
4637
+ order: 0
4628
4638
  });
4629
4639
  case 19:
4630
4640
  ranSuccessfully = _context4.sent;
4631
- if (ranSuccessfully) {
4632
- logger.info({
4633
- type: RegisteredLogger.WORKFLOW,
4634
- destinationPath: "" + blueprint.id,
4635
- message: JSON.stringify({
4636
- message: 'Workflow run completed'
4637
- })
4638
- });
4639
- } else {
4640
- logger.error({
4641
- type: RegisteredLogger.WORKFLOW,
4642
- destinationPath: "" + blueprint.id,
4643
- message: JSON.stringify({
4644
- message: 'Workflow run failed'
4645
- })
4646
- });
4641
+ console.log('====Full context====', {
4642
+ fullCtx: fullCtx
4643
+ });
4644
+ if (!ranSuccessfully) {
4645
+ _context4.next = 26;
4646
+ break;
4647
4647
  }
4648
- case 21:
4648
+ logger.info({
4649
+ type: RegisteredLogger.WORKFLOW,
4650
+ destinationPath: "" + blueprint.id,
4651
+ message: JSON.stringify({
4652
+ message: 'Workflow run completed'
4653
+ })
4654
+ });
4655
+ return _context4.abrupt("return", {
4656
+ fullCtx: fullCtx
4657
+ });
4658
+ case 26:
4659
+ logger.error({
4660
+ type: RegisteredLogger.WORKFLOW,
4661
+ destinationPath: "" + blueprint.id,
4662
+ message: JSON.stringify({
4663
+ message: 'Workflow run failed'
4664
+ })
4665
+ });
4666
+ return _context4.abrupt("return", {
4667
+ fullCtx: null
4668
+ });
4669
+ case 28:
4649
4670
  case "end":
4650
4671
  return _context4.stop();
4651
4672
  }
@@ -6908,7 +6929,7 @@ var Mastra = /*#__PURE__*/function () {
6908
6929
  this.runBlueprint = /*#__PURE__*/function () {
6909
6930
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
6910
6931
  var _this$availableIntegr;
6911
- var blueprint, _ref2$dataCtx, dataCtx, ctx, systemApis, systemEvents, availableIntegrations, availableIntegrationApis, availableIntegrationEvents, frameworkApis, frameworkEvents;
6932
+ var blueprint, _ref2$dataCtx, dataCtx, ctx, systemApis, systemEvents, availableIntegrations, availableIntegrationApis, availableIntegrationEvents, frameworkApis, frameworkEvents, blueprintResult;
6912
6933
  return _regeneratorRuntime().wrap(function _callee$(_context) {
6913
6934
  while (1) switch (_context.prev = _context.next) {
6914
6935
  case 0:
@@ -6941,6 +6962,9 @@ var Mastra = /*#__PURE__*/function () {
6941
6962
  logger: _this.logger.get('WORKFLOW')
6942
6963
  });
6943
6964
  case 10:
6965
+ blueprintResult = _context.sent;
6966
+ return _context.abrupt("return", blueprintResult);
6967
+ case 12:
6944
6968
  case "end":
6945
6969
  return _context.stop();
6946
6970
  }
@@ -7592,6 +7616,7 @@ var Mastra = /*#__PURE__*/function () {
7592
7616
  case 27:
7593
7617
  return _context8.abrupt("return", {
7594
7618
  status: lastRun.status,
7619
+ output: lastRun.output,
7595
7620
  startedAt: lastRun.run_started_at,
7596
7621
  endedAt: lastRun.ended_at
7597
7622
  });
@@ -7858,7 +7883,9 @@ var Mastra = /*#__PURE__*/function () {
7858
7883
  var v = _ref30[1];
7859
7884
  return _extends({}, acc, v);
7860
7885
  }, {});
7861
- console.log('got finalApis===');
7886
+ console.log('got finalApis===', {
7887
+ finalApis: finalApis
7888
+ });
7862
7889
  return _context14.abrupt("return", getAgent({
7863
7890
  connectionId: connectionId,
7864
7891
  agent: agentBlueprint,