@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.
package/dist/core.esm.js CHANGED
@@ -2020,7 +2020,7 @@ var createWorkflowHandler = function createWorkflowHandler(_ref3) {
2020
2020
  event: 'workflow/run-automations'
2021
2021
  }, /*#__PURE__*/function () {
2022
2022
  var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
2023
- var event, step, _event$data, trigger, payload, connectionId, getBlueprintsDirPath, blueprints, triggeredAndPublishedBlueprints, runs;
2023
+ var event, step, _event$data, trigger, payload, connectionId, getBlueprintsDirPath, blueprints, triggeredAndPublishedBlueprints, runs, data;
2024
2024
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2025
2025
  while (1) switch (_context3.prev = _context3.next) {
2026
2026
  case 0:
@@ -2086,22 +2086,24 @@ var createWorkflowHandler = function createWorkflowHandler(_ref3) {
2086
2086
  _context3.next = 12;
2087
2087
  return Promise.all(runs);
2088
2088
  case 12:
2089
+ data = _context3.sent;
2089
2090
  return _context3.abrupt("return", {
2090
2091
  event: event,
2091
- body: "sync completed"
2092
+ body: "sync completed",
2093
+ data: data
2092
2094
  });
2093
- case 15:
2094
- _context3.prev = 15;
2095
+ case 16:
2096
+ _context3.prev = 16;
2095
2097
  _context3.t0 = _context3["catch"](1);
2096
2098
  return _context3.abrupt("return", {
2097
2099
  event: event,
2098
2100
  body: "error occurred while running sync: " + _context3.t0
2099
2101
  });
2100
- case 18:
2102
+ case 19:
2101
2103
  case "end":
2102
2104
  return _context3.stop();
2103
2105
  }
2104
- }, _callee3, null, [[1, 15]]);
2106
+ }, _callee3, null, [[1, 16]]);
2105
2107
  }));
2106
2108
  return function (_x3) {
2107
2109
  return _ref5.apply(this, arguments);
@@ -4187,11 +4189,11 @@ function runActionsRecursively(_x) {
4187
4189
  }
4188
4190
  function _runActionsRecursively() {
4189
4191
  _runActionsRecursively = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref7) {
4190
- var blueprintActions, frameworkApis, frameworkEvents, dataContext, blueprintId, runId, ctx, blueprintActionKVMap, logger, _loop, _ret, _iterator2, _step2;
4192
+ var blueprintActions, frameworkApis, frameworkEvents, dataContext, blueprintId, runId, ctx, blueprintActionKVMap, logger, order, _loop, _ret, _iterator2, _step2;
4191
4193
  return _regeneratorRuntime().wrap(function _callee$(_context3) {
4192
4194
  while (1) switch (_context3.prev = _context3.next) {
4193
4195
  case 0:
4194
- 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;
4196
+ 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;
4195
4197
  _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
4196
4198
  var _action$subActions;
4197
4199
  var action, concreteAction, hasValidBranch, _loop2, _ret2, _iterator3, _step3, defaultCondition, defaultAction, actionExecutor, _ref9, mastraConnectionId, actionPayload, resolvedPayload, resolvedSchema, data, executorResult, _ctx, subActions;
@@ -4287,7 +4289,8 @@ function _runActionsRecursively() {
4287
4289
  runId: runId,
4288
4290
  ctx: ctx,
4289
4291
  blueprintActionKVMap: blueprintActionKVMap,
4290
- logger: logger
4292
+ logger: logger,
4293
+ order: order + 1
4291
4294
  });
4292
4295
  case 22:
4293
4296
  executorResult = _context.sent;
@@ -4369,7 +4372,8 @@ function _runActionsRecursively() {
4369
4372
  ctx: ctx,
4370
4373
  blueprintId: blueprintId,
4371
4374
  blueprintActionKVMap: blueprintActionKVMap,
4372
- logger: logger
4375
+ logger: logger,
4376
+ order: order + 1
4373
4377
  });
4374
4378
  case 26:
4375
4379
  _context2.t1 = _context2.sent;
@@ -4462,7 +4466,9 @@ function _runActionsRecursively() {
4462
4466
  v: false
4463
4467
  });
4464
4468
  case 57:
4465
- dataContext[action.id] = executorResult;
4469
+ dataContext[action.id] = _extends({}, executorResult, {
4470
+ workflowStepOrder: order
4471
+ });
4466
4472
  if (!(action.type === "CONDITIONS" || (_action$subActions = action.subActions) != null && _action$subActions.length)) {
4467
4473
  _context2.next = 65;
4468
4474
  break;
@@ -4482,7 +4488,8 @@ function _runActionsRecursively() {
4482
4488
  ctx: ctx,
4483
4489
  blueprintId: blueprintId,
4484
4490
  blueprintActionKVMap: blueprintActionKVMap,
4485
- logger: logger
4491
+ logger: logger,
4492
+ order: order + 1
4486
4493
  });
4487
4494
  case 63:
4488
4495
  _context2.t3 = _context2.sent;
@@ -4590,7 +4597,9 @@ function _blueprintRunner() {
4590
4597
  message: 'Workflow run skipped'
4591
4598
  })
4592
4599
  });
4593
- return _context4.abrupt("return");
4600
+ return _context4.abrupt("return", {
4601
+ fullCtx: null
4602
+ });
4594
4603
  case 16:
4595
4604
  blueprintActionKVMap = constructWorkflowContextBluePrint(blueprint);
4596
4605
  _context4.next = 19;
@@ -4603,28 +4612,40 @@ function _blueprintRunner() {
4603
4612
  blueprintActionKVMap: blueprintActionKVMap,
4604
4613
  blueprintId: blueprint.id,
4605
4614
  runId: '',
4606
- logger: logger
4615
+ logger: logger,
4616
+ order: 0
4607
4617
  });
4608
4618
  case 19:
4609
4619
  ranSuccessfully = _context4.sent;
4610
- if (ranSuccessfully) {
4611
- logger.info({
4612
- type: RegisteredLogger.WORKFLOW,
4613
- destinationPath: "" + blueprint.id,
4614
- message: JSON.stringify({
4615
- message: 'Workflow run completed'
4616
- })
4617
- });
4618
- } else {
4619
- logger.error({
4620
- type: RegisteredLogger.WORKFLOW,
4621
- destinationPath: "" + blueprint.id,
4622
- message: JSON.stringify({
4623
- message: 'Workflow run failed'
4624
- })
4625
- });
4620
+ console.log('====Full context====', {
4621
+ fullCtx: fullCtx
4622
+ });
4623
+ if (!ranSuccessfully) {
4624
+ _context4.next = 26;
4625
+ break;
4626
4626
  }
4627
- case 21:
4627
+ logger.info({
4628
+ type: RegisteredLogger.WORKFLOW,
4629
+ destinationPath: "" + blueprint.id,
4630
+ message: JSON.stringify({
4631
+ message: 'Workflow run completed'
4632
+ })
4633
+ });
4634
+ return _context4.abrupt("return", {
4635
+ fullCtx: fullCtx
4636
+ });
4637
+ case 26:
4638
+ logger.error({
4639
+ type: RegisteredLogger.WORKFLOW,
4640
+ destinationPath: "" + blueprint.id,
4641
+ message: JSON.stringify({
4642
+ message: 'Workflow run failed'
4643
+ })
4644
+ });
4645
+ return _context4.abrupt("return", {
4646
+ fullCtx: null
4647
+ });
4648
+ case 28:
4628
4649
  case "end":
4629
4650
  return _context4.stop();
4630
4651
  }
@@ -6887,7 +6908,7 @@ var Mastra = /*#__PURE__*/function () {
6887
6908
  this.runBlueprint = /*#__PURE__*/function () {
6888
6909
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
6889
6910
  var _this$availableIntegr;
6890
- var blueprint, _ref2$dataCtx, dataCtx, ctx, systemApis, systemEvents, availableIntegrations, availableIntegrationApis, availableIntegrationEvents, frameworkApis, frameworkEvents;
6911
+ var blueprint, _ref2$dataCtx, dataCtx, ctx, systemApis, systemEvents, availableIntegrations, availableIntegrationApis, availableIntegrationEvents, frameworkApis, frameworkEvents, blueprintResult;
6891
6912
  return _regeneratorRuntime().wrap(function _callee$(_context) {
6892
6913
  while (1) switch (_context.prev = _context.next) {
6893
6914
  case 0:
@@ -6920,6 +6941,9 @@ var Mastra = /*#__PURE__*/function () {
6920
6941
  logger: _this.logger.get('WORKFLOW')
6921
6942
  });
6922
6943
  case 10:
6944
+ blueprintResult = _context.sent;
6945
+ return _context.abrupt("return", blueprintResult);
6946
+ case 12:
6923
6947
  case "end":
6924
6948
  return _context.stop();
6925
6949
  }
@@ -7571,6 +7595,7 @@ var Mastra = /*#__PURE__*/function () {
7571
7595
  case 27:
7572
7596
  return _context8.abrupt("return", {
7573
7597
  status: lastRun.status,
7598
+ output: lastRun.output,
7574
7599
  startedAt: lastRun.run_started_at,
7575
7600
  endedAt: lastRun.ended_at
7576
7601
  });
@@ -7837,7 +7862,9 @@ var Mastra = /*#__PURE__*/function () {
7837
7862
  var v = _ref30[1];
7838
7863
  return _extends({}, acc, v);
7839
7864
  }, {});
7840
- console.log('got finalApis===');
7865
+ console.log('got finalApis===', {
7866
+ finalApis: finalApis
7867
+ });
7841
7868
  return _context14.abrupt("return", getAgent({
7842
7869
  connectionId: connectionId,
7843
7870
  agent: agentBlueprint,