@mastra/core 0.1.27-alpha.66 → 0.1.27-alpha.68
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/agent/index.d.ts +2 -2
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/core.cjs.development.js +116 -101
- package/dist/core.cjs.development.js.map +1 -1
- package/dist/core.cjs.production.min.js +1 -1
- package/dist/core.cjs.production.min.js.map +1 -1
- package/dist/core.esm.js +116 -101
- package/dist/core.esm.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/types.d.ts +9 -2
- package/dist/llm/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CoreAssistantMessage, CoreMessage, CoreToolMessage, CoreUserMessage
|
|
1
|
+
import { CoreAssistantMessage, CoreMessage, CoreToolMessage, CoreUserMessage } from 'ai';
|
|
2
2
|
import { JSONSchema7 } from 'json-schema';
|
|
3
3
|
import { ZodSchema } from 'zod';
|
|
4
4
|
import 'dotenv/config';
|
|
@@ -68,7 +68,7 @@ export declare class Agent<TTools extends Record<string, ToolAction<any, any, an
|
|
|
68
68
|
threadId?: string;
|
|
69
69
|
context?: CoreMessage[];
|
|
70
70
|
runId?: string;
|
|
71
|
-
messages:
|
|
71
|
+
messages: CoreMessage[];
|
|
72
72
|
}): {
|
|
73
73
|
before: () => Promise<{
|
|
74
74
|
messageObjects: CoreMessage[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO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AAQ,EAAE,YAAY,EACtB,UAAU,EACV,QAAY,EACZ,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,MAAe,GAChB,GAAE;QACD,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;QACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACpD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC;KACpB,GACL,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAoF5B"}
|
|
@@ -26,12 +26,12 @@ var resources = require('@opentelemetry/resources');
|
|
|
26
26
|
var sdkNode = require('@opentelemetry/sdk-node');
|
|
27
27
|
var sdkTraceBase = require('@opentelemetry/sdk-trace-base');
|
|
28
28
|
var semanticConventions = require('@opentelemetry/semantic-conventions');
|
|
29
|
+
var dotenv = require('dotenv');
|
|
29
30
|
var voyageAiProvider = require('voyage-ai-provider');
|
|
30
31
|
var cohereAi = require('cohere-ai');
|
|
31
32
|
var radash = require('radash');
|
|
32
33
|
var sift = require('sift');
|
|
33
34
|
var xstate = require('xstate');
|
|
34
|
-
var dotenv = require('dotenv');
|
|
35
35
|
|
|
36
36
|
function _arrayLikeToArray(r, a) {
|
|
37
37
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -1332,7 +1332,8 @@ var LLM = (_model = /*#__PURE__*/_classPrivateFieldLooseKey("model"), /*#__PURE_
|
|
|
1332
1332
|
COHERE: 'cohere',
|
|
1333
1333
|
AZURE: 'azure',
|
|
1334
1334
|
AMAZON: 'amazon',
|
|
1335
|
-
ANTHROPIC_VERTEX: 'anthropic-vertex'
|
|
1335
|
+
ANTHROPIC_VERTEX: 'anthropic-vertex',
|
|
1336
|
+
DEEPSEEK: 'deepseek'
|
|
1336
1337
|
};
|
|
1337
1338
|
var type = (_providerToType$model = providerToType[model.provider]) != null ? _providerToType$model : model.provider;
|
|
1338
1339
|
this.log(LogLevel.DEBUG, "Model type resolved to " + type + " for provider " + model.provider);
|
|
@@ -1481,6 +1482,14 @@ var LLM = (_model = /*#__PURE__*/_classPrivateFieldLooseKey("model"), /*#__PURE_
|
|
|
1481
1482
|
apiKey: (_process$env$ANTHROPI = process.env.ANTHROPIC_API_KEY) != null ? _process$env$ANTHROPI : ''
|
|
1482
1483
|
});
|
|
1483
1484
|
modelDef = anthropicVertex(model.name || 'claude-3-5-sonnet@20240620');
|
|
1485
|
+
} else if (model.type === 'deepseek') {
|
|
1486
|
+
this.log(LogLevel.DEBUG, "Initializing Deepseek model " + (model.name || 'deepseek-chat'));
|
|
1487
|
+
modelDef = this.createOpenAICompatibleModel({
|
|
1488
|
+
baseURL: 'https://api.deepseek.com/v1/',
|
|
1489
|
+
apiKey: (model == null ? void 0 : model.apiKey) || process.env.DEEPSEEK_API_KEY || '',
|
|
1490
|
+
defaultModelName: 'deepseek-chat',
|
|
1491
|
+
modelName: model.name
|
|
1492
|
+
});
|
|
1484
1493
|
} else {
|
|
1485
1494
|
var _error2 = "Invalid model type: " + model.type;
|
|
1486
1495
|
this.logger.error(_error2);
|
|
@@ -2940,7 +2949,7 @@ exports.Agent = (_mastra$1 = /*#__PURE__*/_classPrivateFieldLooseKey("mastra"),
|
|
|
2940
2949
|
before: function () {
|
|
2941
2950
|
var _before = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
2942
2951
|
var _classPrivateFieldLoo6, _classPrivateFieldLoo7, _classPrivateFieldLoo8, _classPrivateFieldLoo9;
|
|
2943
|
-
var systemMessage,
|
|
2952
|
+
var systemMessage, coreMessages, threadIdToUse, preExecuteResult, convertedTools, messageObjects;
|
|
2944
2953
|
return _regeneratorRuntime().wrap(function _callee8$(_context9) {
|
|
2945
2954
|
while (1) switch (_context9.prev = _context9.next) {
|
|
2946
2955
|
case 0:
|
|
@@ -2951,36 +2960,30 @@ exports.Agent = (_mastra$1 = /*#__PURE__*/_classPrivateFieldLooseKey("mastra"),
|
|
|
2951
2960
|
role: 'system',
|
|
2952
2961
|
content: _this4.instructions + ". Today's date is " + new Date().toISOString()
|
|
2953
2962
|
};
|
|
2954
|
-
|
|
2955
|
-
return {
|
|
2956
|
-
role: 'user',
|
|
2957
|
-
content: content
|
|
2958
|
-
};
|
|
2959
|
-
});
|
|
2960
|
-
coreMessages = userMessages;
|
|
2963
|
+
coreMessages = messages;
|
|
2961
2964
|
threadIdToUse = threadId;
|
|
2962
2965
|
if (!((_classPrivateFieldLoo6 = _classPrivateFieldLooseBase(_this4, _mastra$1)[_mastra$1]) != null && _classPrivateFieldLoo6.memory && resourceid)) {
|
|
2963
|
-
_context9.next =
|
|
2966
|
+
_context9.next = 12;
|
|
2964
2967
|
break;
|
|
2965
2968
|
}
|
|
2966
|
-
_context9.next =
|
|
2969
|
+
_context9.next = 7;
|
|
2967
2970
|
return _this4.preExecute({
|
|
2968
2971
|
resourceid: resourceid,
|
|
2969
2972
|
runId: runId,
|
|
2970
2973
|
threadId: threadIdToUse,
|
|
2971
|
-
messages:
|
|
2974
|
+
messages: messages
|
|
2972
2975
|
});
|
|
2973
|
-
case
|
|
2976
|
+
case 7:
|
|
2974
2977
|
preExecuteResult = _context9.sent;
|
|
2975
2978
|
coreMessages = preExecuteResult.coreMessages;
|
|
2976
2979
|
threadIdToUse = preExecuteResult.threadIdToUse;
|
|
2977
|
-
_context9.next =
|
|
2980
|
+
_context9.next = 13;
|
|
2978
2981
|
break;
|
|
2979
|
-
case
|
|
2982
|
+
case 12:
|
|
2980
2983
|
_this4.log(LogLevel.DEBUG, "No memory or resourceid, skipping save to memory for agent " + _this4.name, {
|
|
2981
2984
|
runId: _this4.name
|
|
2982
2985
|
});
|
|
2983
|
-
case
|
|
2986
|
+
case 13:
|
|
2984
2987
|
if (toolsets && Object.keys(toolsets || {}).length > 0 || (_classPrivateFieldLoo7 = _classPrivateFieldLooseBase(_this4, _mastra$1)[_mastra$1]) != null && _classPrivateFieldLoo7.memory && resourceid || (_classPrivateFieldLoo8 = _classPrivateFieldLooseBase(_this4, _mastra$1)[_mastra$1]) != null && _classPrivateFieldLoo8.engine || (_classPrivateFieldLoo9 = _classPrivateFieldLooseBase(_this4, _mastra$1)[_mastra$1]) != null && _classPrivateFieldLoo9.syncs) {
|
|
2985
2988
|
convertedTools = _this4.convertTools({
|
|
2986
2989
|
toolsets: toolsets,
|
|
@@ -2998,7 +3001,7 @@ exports.Agent = (_mastra$1 = /*#__PURE__*/_classPrivateFieldLooseKey("mastra"),
|
|
|
2998
3001
|
convertedTools: convertedTools,
|
|
2999
3002
|
threadId: threadIdToUse
|
|
3000
3003
|
});
|
|
3001
|
-
case
|
|
3004
|
+
case 16:
|
|
3002
3005
|
case "end":
|
|
3003
3006
|
return _context9.stop();
|
|
3004
3007
|
}
|
|
@@ -3071,15 +3074,21 @@ exports.Agent = (_mastra$1 = /*#__PURE__*/_classPrivateFieldLooseKey("mastra"),
|
|
|
3071
3074
|
case 0:
|
|
3072
3075
|
_ref9 = _temp === void 0 ? {} : _temp, context = _ref9.context, threadIdInFn = _ref9.threadId, resourceid = _ref9.resourceid, _ref9$maxSteps = _ref9.maxSteps, maxSteps = _ref9$maxSteps === void 0 ? 5 : _ref9$maxSteps, onStepFinish = _ref9.onStepFinish, runId = _ref9.runId, toolsets = _ref9.toolsets, _ref9$output = _ref9.output, output = _ref9$output === void 0 ? 'text' : _ref9$output;
|
|
3073
3076
|
messagesToUse = [];
|
|
3074
|
-
if (
|
|
3075
|
-
messagesToUse =
|
|
3076
|
-
|
|
3077
|
-
|
|
3077
|
+
if (typeof messages === "string") {
|
|
3078
|
+
messagesToUse = [{
|
|
3079
|
+
role: 'user',
|
|
3080
|
+
content: messages
|
|
3081
|
+
}];
|
|
3082
|
+
} else {
|
|
3083
|
+
messagesToUse = messages.map(function (message) {
|
|
3084
|
+
if (typeof message === "string") {
|
|
3085
|
+
return {
|
|
3086
|
+
role: 'user',
|
|
3087
|
+
content: message
|
|
3088
|
+
};
|
|
3078
3089
|
}
|
|
3079
|
-
return
|
|
3090
|
+
return message;
|
|
3080
3091
|
});
|
|
3081
|
-
} else {
|
|
3082
|
-
messagesToUse = [messages];
|
|
3083
3092
|
}
|
|
3084
3093
|
_this$__primitive = this.__primitive({
|
|
3085
3094
|
messages: messagesToUse,
|
|
@@ -3164,15 +3173,21 @@ exports.Agent = (_mastra$1 = /*#__PURE__*/_classPrivateFieldLooseKey("mastra"),
|
|
|
3164
3173
|
case 0:
|
|
3165
3174
|
_ref10 = _temp2 === void 0 ? {} : _temp2, context = _ref10.context, threadIdInFn = _ref10.threadId, resourceid = _ref10.resourceid, _ref10$maxSteps = _ref10.maxSteps, maxSteps = _ref10$maxSteps === void 0 ? 5 : _ref10$maxSteps, _onFinish = _ref10.onFinish, onStepFinish = _ref10.onStepFinish, runId = _ref10.runId, toolsets = _ref10.toolsets, _ref10$output = _ref10.output, output = _ref10$output === void 0 ? 'text' : _ref10$output;
|
|
3166
3175
|
messagesToUse = [];
|
|
3167
|
-
if (
|
|
3168
|
-
messagesToUse =
|
|
3169
|
-
|
|
3170
|
-
|
|
3176
|
+
if (typeof messages === "string") {
|
|
3177
|
+
messagesToUse = [{
|
|
3178
|
+
role: 'user',
|
|
3179
|
+
content: messages
|
|
3180
|
+
}];
|
|
3181
|
+
} else {
|
|
3182
|
+
messagesToUse = messages.map(function (message) {
|
|
3183
|
+
if (typeof message === "string") {
|
|
3184
|
+
return {
|
|
3185
|
+
role: 'user',
|
|
3186
|
+
content: message
|
|
3187
|
+
};
|
|
3171
3188
|
}
|
|
3172
|
-
return
|
|
3189
|
+
return message;
|
|
3173
3190
|
});
|
|
3174
|
-
} else {
|
|
3175
|
-
messagesToUse = [messages];
|
|
3176
3191
|
}
|
|
3177
3192
|
_this$__primitive2 = this.__primitive({
|
|
3178
3193
|
messages: messagesToUse,
|
|
@@ -3307,6 +3322,75 @@ exports.Agent = /*#__PURE__*/tslib.__decorate([/*#__PURE__*/InstrumentClass({
|
|
|
3307
3322
|
excludeMethods: ['__setTools', '__setLogger', '__setTelemetry', 'log']
|
|
3308
3323
|
}), /*#__PURE__*/tslib.__metadata("design:paramtypes", [Object])], exports.Agent);
|
|
3309
3324
|
|
|
3325
|
+
var MastraDeployer = /*#__PURE__*/function () {
|
|
3326
|
+
function MastraDeployer(_ref) {
|
|
3327
|
+
var scope = _ref.scope,
|
|
3328
|
+
env = _ref.env,
|
|
3329
|
+
projectName = _ref.projectName;
|
|
3330
|
+
this.scope = void 0;
|
|
3331
|
+
this.projectName = void 0;
|
|
3332
|
+
this.env = void 0;
|
|
3333
|
+
this.scope = scope;
|
|
3334
|
+
this.env = env;
|
|
3335
|
+
this.projectName = projectName;
|
|
3336
|
+
}
|
|
3337
|
+
var _proto = MastraDeployer.prototype;
|
|
3338
|
+
_proto.loadEnvVars = function loadEnvVars() {
|
|
3339
|
+
var _this = this;
|
|
3340
|
+
this.getEnvFiles().forEach(function (file) {
|
|
3341
|
+
var content = fs.readFileSync(file, 'utf-8');
|
|
3342
|
+
var config = dotenv.parse(content);
|
|
3343
|
+
_this.env = _extends({}, _this.env, config);
|
|
3344
|
+
});
|
|
3345
|
+
};
|
|
3346
|
+
_proto.getEnvFiles = function getEnvFiles() {
|
|
3347
|
+
var envFiles = ['.env', '.env.production'].map(function (file) {
|
|
3348
|
+
return path.join(process.cwd(), file);
|
|
3349
|
+
}).filter(function (file) {
|
|
3350
|
+
return fs.existsSync(file);
|
|
3351
|
+
});
|
|
3352
|
+
return envFiles;
|
|
3353
|
+
};
|
|
3354
|
+
_proto.parseEnvFile = function parseEnvFile(filePath) {
|
|
3355
|
+
var content = fs.readFileSync(filePath, 'utf-8');
|
|
3356
|
+
return content.split('\n').map(function (line) {
|
|
3357
|
+
return line.trim();
|
|
3358
|
+
}).filter(function (line) {
|
|
3359
|
+
return line && !line.startsWith('#');
|
|
3360
|
+
}).filter(function (line) {
|
|
3361
|
+
return line.includes('=');
|
|
3362
|
+
}); // Only include valid KEY=value pairs
|
|
3363
|
+
};
|
|
3364
|
+
_proto.writeFiles = function writeFiles(_ref2) {
|
|
3365
|
+
var dir = _ref2.dir;
|
|
3366
|
+
console.log('Writing files to', dir);
|
|
3367
|
+
};
|
|
3368
|
+
_proto.writeIndex = function writeIndex(_ref3) {
|
|
3369
|
+
var dir = _ref3.dir;
|
|
3370
|
+
console.log('Writing index to', dir);
|
|
3371
|
+
};
|
|
3372
|
+
_proto.deploy = /*#__PURE__*/function () {
|
|
3373
|
+
var _deploy = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref4) {
|
|
3374
|
+
var dir, siteId;
|
|
3375
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3376
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3377
|
+
case 0:
|
|
3378
|
+
dir = _ref4.dir, siteId = _ref4.siteId;
|
|
3379
|
+
console.log("Deploy command " + this.scope + "..." + (siteId || '') + " to " + dir + " " + (this.projectName || 'mastra-starter'));
|
|
3380
|
+
case 2:
|
|
3381
|
+
case "end":
|
|
3382
|
+
return _context.stop();
|
|
3383
|
+
}
|
|
3384
|
+
}, _callee, this);
|
|
3385
|
+
}));
|
|
3386
|
+
function deploy(_x) {
|
|
3387
|
+
return _deploy.apply(this, arguments);
|
|
3388
|
+
}
|
|
3389
|
+
return deploy;
|
|
3390
|
+
}();
|
|
3391
|
+
return MastraDeployer;
|
|
3392
|
+
}();
|
|
3393
|
+
|
|
3310
3394
|
function embed(_x, _x2) {
|
|
3311
3395
|
return _embed.apply(this, arguments);
|
|
3312
3396
|
}
|
|
@@ -6813,75 +6897,6 @@ function executeHook(hook, data) {
|
|
|
6813
6897
|
});
|
|
6814
6898
|
}
|
|
6815
6899
|
|
|
6816
|
-
var MastraDeployer = /*#__PURE__*/function () {
|
|
6817
|
-
function MastraDeployer(_ref) {
|
|
6818
|
-
var scope = _ref.scope,
|
|
6819
|
-
env = _ref.env,
|
|
6820
|
-
projectName = _ref.projectName;
|
|
6821
|
-
this.scope = void 0;
|
|
6822
|
-
this.projectName = void 0;
|
|
6823
|
-
this.env = void 0;
|
|
6824
|
-
this.scope = scope;
|
|
6825
|
-
this.env = env;
|
|
6826
|
-
this.projectName = projectName;
|
|
6827
|
-
}
|
|
6828
|
-
var _proto = MastraDeployer.prototype;
|
|
6829
|
-
_proto.loadEnvVars = function loadEnvVars() {
|
|
6830
|
-
var _this = this;
|
|
6831
|
-
this.getEnvFiles().forEach(function (file) {
|
|
6832
|
-
var content = fs.readFileSync(file, 'utf-8');
|
|
6833
|
-
var config = dotenv.parse(content);
|
|
6834
|
-
_this.env = _extends({}, _this.env, config);
|
|
6835
|
-
});
|
|
6836
|
-
};
|
|
6837
|
-
_proto.getEnvFiles = function getEnvFiles() {
|
|
6838
|
-
var envFiles = ['.env', '.env.production'].map(function (file) {
|
|
6839
|
-
return path.join(process.cwd(), file);
|
|
6840
|
-
}).filter(function (file) {
|
|
6841
|
-
return fs.existsSync(file);
|
|
6842
|
-
});
|
|
6843
|
-
return envFiles;
|
|
6844
|
-
};
|
|
6845
|
-
_proto.parseEnvFile = function parseEnvFile(filePath) {
|
|
6846
|
-
var content = fs.readFileSync(filePath, 'utf-8');
|
|
6847
|
-
return content.split('\n').map(function (line) {
|
|
6848
|
-
return line.trim();
|
|
6849
|
-
}).filter(function (line) {
|
|
6850
|
-
return line && !line.startsWith('#');
|
|
6851
|
-
}).filter(function (line) {
|
|
6852
|
-
return line.includes('=');
|
|
6853
|
-
}); // Only include valid KEY=value pairs
|
|
6854
|
-
};
|
|
6855
|
-
_proto.writeFiles = function writeFiles(_ref2) {
|
|
6856
|
-
var dir = _ref2.dir;
|
|
6857
|
-
console.log('Writing files to', dir);
|
|
6858
|
-
};
|
|
6859
|
-
_proto.writeIndex = function writeIndex(_ref3) {
|
|
6860
|
-
var dir = _ref3.dir;
|
|
6861
|
-
console.log('Writing index to', dir);
|
|
6862
|
-
};
|
|
6863
|
-
_proto.deploy = /*#__PURE__*/function () {
|
|
6864
|
-
var _deploy = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref4) {
|
|
6865
|
-
var dir, siteId;
|
|
6866
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6867
|
-
while (1) switch (_context.prev = _context.next) {
|
|
6868
|
-
case 0:
|
|
6869
|
-
dir = _ref4.dir, siteId = _ref4.siteId;
|
|
6870
|
-
console.log("Deploy command " + this.scope + "..." + (siteId || '') + " to " + dir + " " + (this.projectName || 'mastra-starter'));
|
|
6871
|
-
case 2:
|
|
6872
|
-
case "end":
|
|
6873
|
-
return _context.stop();
|
|
6874
|
-
}
|
|
6875
|
-
}, _callee, this);
|
|
6876
|
-
}));
|
|
6877
|
-
function deploy(_x) {
|
|
6878
|
-
return _deploy.apply(this, arguments);
|
|
6879
|
-
}
|
|
6880
|
-
return deploy;
|
|
6881
|
-
}();
|
|
6882
|
-
return MastraDeployer;
|
|
6883
|
-
}();
|
|
6884
|
-
|
|
6885
6900
|
exports.BaseLogger = BaseLogger;
|
|
6886
6901
|
exports.CohereRelevanceScorer = CohereRelevanceScorer;
|
|
6887
6902
|
exports.ConsoleLogger = ConsoleLogger;
|