@mastra/core 0.1.14 → 0.1.16

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
@@ -2431,6 +2431,10 @@ function mergeWithDefinedOnly(base, overrides) {
2431
2431
  return result;
2432
2432
  }
2433
2433
 
2434
+ var RegisteredLogger = {
2435
+ AGENT: 'AGENT',
2436
+ WORKFLOW: 'WORKFLOW'
2437
+ };
2434
2438
  var LogProvider = {
2435
2439
  CONSOLE: 'CONSOLE',
2436
2440
  FILE: 'FILE',
@@ -2593,8 +2597,7 @@ var UpstashRedisLogger = /*#__PURE__*/function (_BaseLogger4) {
2593
2597
  _inheritsLoose(UpstashRedisLogger, _BaseLogger4);
2594
2598
  var _proto4 = UpstashRedisLogger.prototype;
2595
2599
  _proto4.log = function log(level, message) {
2596
- var fullKey = path.join(_classPrivateFieldLooseBase(this, _key6)[_key6], "" + message.destinationPath);
2597
- _classPrivateFieldLooseBase(this, _redisClient)[_redisClient].lpush(fullKey, JSON.stringify(_extends({}, message, {
2600
+ _classPrivateFieldLooseBase(this, _redisClient)[_redisClient].lpush(_classPrivateFieldLooseBase(this, _key6)[_key6], JSON.stringify(_extends({}, message, {
2598
2601
  level: level,
2599
2602
  createdAt: new Date()
2600
2603
  })));
@@ -2605,9 +2608,9 @@ var UpstashRedisLogger = /*#__PURE__*/function (_BaseLogger4) {
2605
2608
  return UpstashRedisLogger;
2606
2609
  }(BaseLogger);
2607
2610
  function createLogger(_ref4) {
2608
- var type = _ref4.type,
2611
+ var provider = _ref4.provider,
2609
2612
  options = _ref4.options;
2610
- switch (type) {
2613
+ switch (provider) {
2611
2614
  case 'CONSOLE':
2612
2615
  return new ConsoleLogger({
2613
2616
  level: options == null ? void 0 : options.level
@@ -2624,7 +2627,7 @@ function createLogger(_ref4) {
2624
2627
  level: options.level
2625
2628
  });
2626
2629
  default:
2627
- throw new Error("Unsupported logger type: " + type);
2630
+ throw new Error("Unsupported logger type: " + provider);
2628
2631
  }
2629
2632
  }
2630
2633
 
@@ -4197,6 +4200,7 @@ function _runActionsRecursively() {
4197
4200
  action = _step2.value;
4198
4201
  concreteAction = frameworkApis[action.type];
4199
4202
  logger.info({
4203
+ type: RegisteredLogger.WORKFLOW,
4200
4204
  destinationPath: "" + blueprintId,
4201
4205
  message: JSON.stringify({
4202
4206
  message: "Running action " + action.type,
@@ -4330,6 +4334,7 @@ function _runActionsRecursively() {
4330
4334
  break;
4331
4335
  }
4332
4336
  logger.debug({
4337
+ type: RegisteredLogger.WORKFLOW,
4333
4338
  destinationPath: "" + blueprintId,
4334
4339
  message: JSON.stringify({
4335
4340
  message: "No valid branch found for action: " + action.type + ":" + action.id
@@ -4347,6 +4352,7 @@ function _runActionsRecursively() {
4347
4352
  break;
4348
4353
  }
4349
4354
  logger.debug({
4355
+ type: RegisteredLogger.WORKFLOW,
4350
4356
  destinationPath: "" + blueprintId,
4351
4357
  message: JSON.stringify({
4352
4358
  message: "Running default action: " + defaultAction.type + ":" + defaultAction.id
@@ -4371,6 +4377,7 @@ function _runActionsRecursively() {
4371
4377
  });
4372
4378
  case 30:
4373
4379
  logger.debug({
4380
+ type: RegisteredLogger.WORKFLOW,
4374
4381
  destinationPath: "" + blueprintId,
4375
4382
  message: JSON.stringify({
4376
4383
  message: "No default action found for action: " + action.type + ":" + action.id
@@ -4386,6 +4393,7 @@ function _runActionsRecursively() {
4386
4393
  break;
4387
4394
  }
4388
4395
  logger.debug({
4396
+ type: RegisteredLogger.WORKFLOW,
4389
4397
  destinationPath: "" + blueprintId,
4390
4398
  message: JSON.stringify({
4391
4399
  message: "No executor found for " + action.type + ":" + action.id
@@ -4428,6 +4436,7 @@ function _runActionsRecursively() {
4428
4436
  case 49:
4429
4437
  executorResult = _context2.sent;
4430
4438
  logger.info({
4439
+ type: RegisteredLogger.WORKFLOW,
4431
4440
  destinationPath: "" + blueprintId,
4432
4441
  message: JSON.stringify({
4433
4442
  message: "Action " + action.type + ":" + action.id + " completed",
@@ -4440,6 +4449,7 @@ function _runActionsRecursively() {
4440
4449
  _context2.prev = 53;
4441
4450
  _context2.t2 = _context2["catch"](46);
4442
4451
  logger.error({
4452
+ type: RegisteredLogger.WORKFLOW,
4443
4453
  destinationPath: "" + blueprintId,
4444
4454
  message: JSON.stringify({
4445
4455
  message: "Action " + action.type + ":" + action.id + " failed",
@@ -4530,6 +4540,7 @@ function _blueprintRunner() {
4530
4540
  ctx = _ref8.ctx, dataCtx = _ref8.dataCtx, blueprint = _ref8.blueprint, frameworkEvents = _ref8.frameworkEvents, frameworkApis = _ref8.frameworkApis, logger = _ref8.logger;
4531
4541
  console.log("Running blueprint " + blueprint.id);
4532
4542
  logger.info({
4543
+ type: RegisteredLogger.WORKFLOW,
4533
4544
  destinationPath: "" + blueprint.id,
4534
4545
  message: JSON.stringify({
4535
4546
  message: 'Started workflow run',
@@ -4572,6 +4583,7 @@ function _blueprintRunner() {
4572
4583
  break;
4573
4584
  }
4574
4585
  logger.info({
4586
+ type: RegisteredLogger.WORKFLOW,
4575
4587
  destinationPath: "" + blueprint.id,
4576
4588
  message: JSON.stringify({
4577
4589
  message: 'Workflow run skipped'
@@ -4596,6 +4608,7 @@ function _blueprintRunner() {
4596
4608
  ranSuccessfully = _context4.sent;
4597
4609
  if (ranSuccessfully) {
4598
4610
  logger.info({
4611
+ type: RegisteredLogger.WORKFLOW,
4599
4612
  destinationPath: "" + blueprint.id,
4600
4613
  message: JSON.stringify({
4601
4614
  message: 'Workflow run completed'
@@ -4603,6 +4616,7 @@ function _blueprintRunner() {
4603
4616
  });
4604
4617
  } else {
4605
4618
  logger.error({
4619
+ type: RegisteredLogger.WORKFLOW,
4606
4620
  destinationPath: "" + blueprint.id,
4607
4621
  message: JSON.stringify({
4608
4622
  message: 'Workflow run failed'
@@ -5861,6 +5875,7 @@ function createAssistantAgentHandler(logger) {
5861
5875
  logger == null || logger.info({
5862
5876
  destinationPath: "" + assistant.id,
5863
5877
  statusCode: 201,
5878
+ type: RegisteredLogger.AGENT,
5864
5879
  message: JSON.stringify({
5865
5880
  message: 'Created assistant',
5866
5881
  metadata: {
@@ -5905,6 +5920,7 @@ function updateAssistantAgentHandler(logger) {
5905
5920
  logger == null || logger.info({
5906
5921
  destinationPath: "" + assistant.id,
5907
5922
  statusCode: 200,
5923
+ type: RegisteredLogger.AGENT,
5908
5924
  message: JSON.stringify({
5909
5925
  message: 'Updated assistant',
5910
5926
  metadata: {
@@ -5973,6 +5989,7 @@ function getAssistantAgentHandler(logger) {
5973
5989
  logger == null || logger.error({
5974
5990
  destinationPath: "" + id,
5975
5991
  statusCode: 400,
5992
+ type: RegisteredLogger.AGENT,
5976
5993
  message: JSON.stringify({
5977
5994
  message: "Run did not complete",
5978
5995
  event_type: 'run_error',
@@ -6021,6 +6038,7 @@ function getAssistantAgentHandler(logger) {
6021
6038
  logger == null || logger.info({
6022
6039
  destinationPath: "" + id,
6023
6040
  statusCode: 100,
6041
+ type: RegisteredLogger.AGENT,
6024
6042
  message: JSON.stringify({
6025
6043
  message: "[local] Starting tool call " + callInfo + ": " + tool["function"].name,
6026
6044
  metadata: {
@@ -6036,6 +6054,7 @@ function getAssistantAgentHandler(logger) {
6036
6054
  logger == null || logger.error({
6037
6055
  destinationPath: "" + id,
6038
6056
  statusCode: 404,
6057
+ type: RegisteredLogger.AGENT,
6039
6058
  message: JSON.stringify({
6040
6059
  message: "[local] No tool fn found: " + tool["function"].name,
6041
6060
  metadata: {
@@ -6053,6 +6072,7 @@ function getAssistantAgentHandler(logger) {
6053
6072
  logger == null || logger.info({
6054
6073
  destinationPath: "" + id,
6055
6074
  statusCode: 200,
6075
+ type: RegisteredLogger.AGENT,
6056
6076
  message: JSON.stringify({
6057
6077
  message: "[local] Passing args to tool call: " + tool["function"].name,
6058
6078
  metadata: {
@@ -6072,6 +6092,7 @@ function getAssistantAgentHandler(logger) {
6072
6092
  logger == null || logger.info({
6073
6093
  destinationPath: "" + id,
6074
6094
  statusCode: 200,
6095
+ type: RegisteredLogger.AGENT,
6075
6096
  message: JSON.stringify({
6076
6097
  message: "[local] Completed tool call " + callInfo + ": " + tool["function"].name,
6077
6098
  metadata: {
@@ -6105,6 +6126,7 @@ function getAssistantAgentHandler(logger) {
6105
6126
  logger == null || logger.error({
6106
6127
  destinationPath: "" + id,
6107
6128
  statusCode: 404,
6129
+ type: RegisteredLogger.AGENT,
6108
6130
  message: JSON.stringify({
6109
6131
  message: "No tool outputs submitted",
6110
6132
  metadata: {}
@@ -6129,6 +6151,7 @@ function getAssistantAgentHandler(logger) {
6129
6151
  logger == null || logger.info({
6130
6152
  destinationPath: "" + id,
6131
6153
  statusCode: 200,
6154
+ type: RegisteredLogger.AGENT,
6132
6155
  message: JSON.stringify({
6133
6156
  message: "Tool outputs submitted",
6134
6157
  metadata: {
@@ -6143,6 +6166,7 @@ function getAssistantAgentHandler(logger) {
6143
6166
  logger == null || logger.info({
6144
6167
  destinationPath: "" + id,
6145
6168
  statusCode: 404,
6169
+ type: RegisteredLogger.AGENT,
6146
6170
  message: JSON.stringify({
6147
6171
  message: "No tool outputs to submit",
6148
6172
  metadata: {}
@@ -6293,6 +6317,7 @@ function getAssistantAgentHandler(logger) {
6293
6317
  logger == null || logger.info({
6294
6318
  destinationPath: "" + id,
6295
6319
  statusCode: 202,
6320
+ type: RegisteredLogger.AGENT,
6296
6321
  message: JSON.stringify({
6297
6322
  message: "Creating and polling run, tool choice required",
6298
6323
  metadata: {
@@ -6913,14 +6938,14 @@ var Mastra = /*#__PURE__*/function () {
6913
6938
  var MASTRA_APP_DIR = process.env.MASTRA_APP_DIR || process.cwd();
6914
6939
  var basePath = path.join(MASTRA_APP_DIR, '/mastra/logs/');
6915
6940
  agentLogger = createLogger({
6916
- type: 'FILE',
6941
+ provider: 'FILE',
6917
6942
  options: {
6918
6943
  dirPath: path.join(basePath, 'agent'),
6919
6944
  level: (_config$logs2 = config.logs) == null ? void 0 : _config$logs2.level
6920
6945
  }
6921
6946
  });
6922
6947
  workflowLogger = createLogger({
6923
- type: 'FILE',
6948
+ provider: 'FILE',
6924
6949
  options: {
6925
6950
  dirPath: path.join(basePath, 'workflow'),
6926
6951
  level: (_config$logs3 = config.logs) == null ? void 0 : _config$logs3.level
@@ -6933,42 +6958,42 @@ var Mastra = /*#__PURE__*/function () {
6933
6958
  token: (_config$logs$config2 = config.logs.config) == null ? void 0 : _config$logs$config2.token
6934
6959
  });
6935
6960
  agentLogger = createLogger({
6936
- type: 'UPSTASH',
6961
+ provider: 'UPSTASH',
6937
6962
  options: {
6938
6963
  redisClient: redisClient,
6939
- key: "mastra-logs/agent",
6964
+ key: "mastra/logs/agent",
6940
6965
  level: (_config$logs5 = config.logs) == null ? void 0 : _config$logs5.level
6941
6966
  }
6942
6967
  });
6943
6968
  workflowLogger = createLogger({
6944
- type: 'UPSTASH',
6969
+ provider: 'UPSTASH',
6945
6970
  options: {
6946
6971
  redisClient: redisClient,
6947
- key: "mastra-logs/workflow",
6972
+ key: "mastra/logs/workflow",
6948
6973
  level: (_config$logs6 = config.logs) == null ? void 0 : _config$logs6.level
6949
6974
  }
6950
6975
  });
6951
6976
  } else {
6952
6977
  var _config$logs7, _config$logs8;
6953
6978
  agentLogger = createLogger({
6954
- type: 'CONSOLE',
6979
+ provider: 'CONSOLE',
6955
6980
  options: {
6956
6981
  level: (_config$logs7 = config.logs) == null ? void 0 : _config$logs7.level
6957
6982
  }
6958
6983
  });
6959
6984
  workflowLogger = createLogger({
6960
- type: 'CONSOLE',
6985
+ provider: 'CONSOLE',
6961
6986
  options: {
6962
6987
  level: (_config$logs8 = config.logs) == null ? void 0 : _config$logs8.level
6963
6988
  }
6964
6989
  });
6965
6990
  }
6966
6991
  framework.attachLogger({
6967
- key: 'AGENT',
6992
+ key: RegisteredLogger.AGENT,
6968
6993
  logger: agentLogger
6969
6994
  });
6970
6995
  framework.attachLogger({
6971
- key: 'WORKFLOW',
6996
+ key: RegisteredLogger.WORKFLOW,
6972
6997
  logger: workflowLogger
6973
6998
  });
6974
6999
  // Register integrations
@@ -7855,9 +7880,9 @@ var Mastra = /*#__PURE__*/function () {
7855
7880
  key: "openAIAssistant",
7856
7881
  get: function get() {
7857
7882
  return {
7858
- createAssistantAgent: createAssistantAgentHandler(this.logger.get('AGENT')),
7859
- getAssistantAgent: getAssistantAgentHandler(this.logger.get('AGENT')),
7860
- updateAssistantAgent: updateAssistantAgentHandler(this.logger.get('AGENT'))
7883
+ createAssistantAgent: createAssistantAgentHandler(this.logger.get(RegisteredLogger.AGENT)),
7884
+ getAssistantAgent: getAssistantAgentHandler(this.logger.get(RegisteredLogger.AGENT)),
7885
+ updateAssistantAgent: updateAssistantAgentHandler(this.logger.get(RegisteredLogger.AGENT))
7861
7886
  };
7862
7887
  }
7863
7888
  }]);
@@ -7887,5 +7912,5 @@ function _getUpstashLogs() {
7887
7912
  return _getUpstashLogs.apply(this, arguments);
7888
7913
  }
7889
7914
 
7890
- export { DataLayer, FieldTypePrimitiveMap, FilterOperatorToSQL, FilterOperators, Integration, IntegrationAuth, IntegrationCredentialType, IntegrationError, IntegrationErrors, IntegrationFieldTypeEnum, LogLevel, LogProvider, Mastra, RunStatus, SORT_MODE_TO_ABBR, WorkflowStatusEnum, allowedKey, apiKeyConnectionOptions, buildQueryString, callbackParams, connectParams, constructObjFromStringPath, createLogger, cronQueryParams, delay$1 as delay, extractSchemaOptions, fieldsWithCommaSeparatedValues, filterQuerySchema, flattenObject, generateSyncs, getEntityKey, getJSONField, getPath, getPineconeIndices, getResponseDataKey, getUpstashLogs, isLiteralObject, isObjectEmpty, mergeWithDefinedOnly, nextHeaders, oauthState, parseQueryParams, recordHasData, registerRoutes, sortQuerySchema, splitAndStripQuotes, splitMarkdownIntoChunks, transformFilterValueArray, transformFilterValueBoolean, webhookQueryParams };
7915
+ export { DataLayer, FieldTypePrimitiveMap, FilterOperatorToSQL, FilterOperators, Integration, IntegrationAuth, IntegrationCredentialType, IntegrationError, IntegrationErrors, IntegrationFieldTypeEnum, LogLevel, LogProvider, Mastra, RegisteredLogger, RunStatus, SORT_MODE_TO_ABBR, WorkflowStatusEnum, allowedKey, apiKeyConnectionOptions, buildQueryString, callbackParams, connectParams, constructObjFromStringPath, createLogger, cronQueryParams, delay$1 as delay, extractSchemaOptions, fieldsWithCommaSeparatedValues, filterQuerySchema, flattenObject, generateSyncs, getEntityKey, getJSONField, getPath, getPineconeIndices, getResponseDataKey, getUpstashLogs, isLiteralObject, isObjectEmpty, mergeWithDefinedOnly, nextHeaders, oauthState, parseQueryParams, recordHasData, registerRoutes, sortQuerySchema, splitAndStripQuotes, splitMarkdownIntoChunks, transformFilterValueArray, transformFilterValueBoolean, webhookQueryParams };
7891
7916
  //# sourceMappingURL=core.esm.js.map