@mastra/core 0.1.27-alpha.5 → 0.1.27-alpha.6
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 +40 -52
- 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 +41 -52
- package/dist/core.esm.js.map +1 -1
- package/dist/integration/index.d.ts +1 -12
- package/dist/integration/index.d.ts.map +1 -1
- package/dist/llm/index.d.ts +1 -1
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/mastra/index.d.ts +13 -7
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/sync/types.d.ts +11 -11
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/tools/index.d.ts +1 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/types.d.ts +9 -10
- package/dist/tools/types.d.ts.map +1 -1
- package/package.json +13 -13
package/dist/agent/index.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ import { Logger } from '../logger';
|
|
|
4
4
|
import { AllTools, ToolApi } from '../tools/types';
|
|
5
5
|
import { LLM } from '../llm';
|
|
6
6
|
import { ModelConfig } from '../llm/types';
|
|
7
|
-
export declare class Agent<TIntegrations extends Integration[] | undefined = undefined,
|
|
7
|
+
export declare class Agent<TTools, TIntegrations extends Integration[] | undefined = undefined, TKeys extends keyof AllTools<TTools, TIntegrations> = keyof AllTools<TTools, TIntegrations>> {
|
|
8
8
|
name: string;
|
|
9
|
-
readonly llm: LLM<
|
|
9
|
+
readonly llm: LLM<TTools, TIntegrations, TKeys>;
|
|
10
10
|
readonly instructions: string;
|
|
11
11
|
readonly model: ModelConfig;
|
|
12
12
|
readonly enabledTools: Partial<Record<TKeys, boolean>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","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5B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IACvD,MAAM,EAAE,MAAM,CAAC;gBAEH,MAAM,EAAE;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,WAAW,CAAC;QACnB,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;KAChD;IAcD;;;OAGG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC;IAKxC;;;OAGG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM;IAKpB,IAAI,CAAC,EACT,QAAQ,EACR,YAAY,EACZ,QAAY,GACb,EAAE;QACD,QAAQ,EAAE,WAAW,EAAE,CAAC;QACxB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;IAsBK,MAAM,CAAC,EACX,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,QAAY,GACb,EAAE;QACD,QAAQ,EAAE,WAAW,EAAE,CAAC;QACxB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QACtC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;CAsBF"}
|
|
@@ -1191,16 +1191,7 @@ function createTool(opts) {
|
|
|
1191
1191
|
var _excluded = ["client"];
|
|
1192
1192
|
var Integration = /*#__PURE__*/function () {
|
|
1193
1193
|
function Integration() {
|
|
1194
|
-
var _this = this;
|
|
1195
1194
|
this.authType = 'API_KEY';
|
|
1196
|
-
this.executeTool = function (tool, params) {
|
|
1197
|
-
var toolExecutor = _this.tools[tool];
|
|
1198
|
-
return toolExecutor.executor(_extends({}, params, {
|
|
1199
|
-
getIntegration: function getIntegration() {
|
|
1200
|
-
return _this;
|
|
1201
|
-
}
|
|
1202
|
-
}));
|
|
1203
|
-
};
|
|
1204
1195
|
}
|
|
1205
1196
|
var _proto = Integration.prototype;
|
|
1206
1197
|
_proto.getApiClient = /*#__PURE__*/function () {
|
|
@@ -1221,7 +1212,7 @@ var Integration = /*#__PURE__*/function () {
|
|
|
1221
1212
|
return getApiClient;
|
|
1222
1213
|
}();
|
|
1223
1214
|
_proto._generateIntegrationTools = function _generateIntegrationTools() {
|
|
1224
|
-
var
|
|
1215
|
+
var _this = this;
|
|
1225
1216
|
var _this$baseClient = this.baseClient,
|
|
1226
1217
|
clientMethods = _objectWithoutPropertiesLoose(_this$baseClient, _excluded);
|
|
1227
1218
|
var schemas = this.toolSchemas;
|
|
@@ -1244,7 +1235,7 @@ var Integration = /*#__PURE__*/function () {
|
|
|
1244
1235
|
case 0:
|
|
1245
1236
|
data = _ref.data;
|
|
1246
1237
|
_context2.next = 3;
|
|
1247
|
-
return
|
|
1238
|
+
return _this.getApiClient();
|
|
1248
1239
|
case 3:
|
|
1249
1240
|
client = _context2.sent;
|
|
1250
1241
|
value = client[key];
|
|
@@ -1282,43 +1273,6 @@ var Integration = /*#__PURE__*/function () {
|
|
|
1282
1273
|
}
|
|
1283
1274
|
}]);
|
|
1284
1275
|
}();
|
|
1285
|
-
var GmailIntegration = /*#__PURE__*/function (_Integration2) {
|
|
1286
|
-
function GmailIntegration(config) {
|
|
1287
|
-
var _this3;
|
|
1288
|
-
_this3 = _Integration2.call(this) || this;
|
|
1289
|
-
_this3.name = 'GMAIL';
|
|
1290
|
-
_this3.logoUrl = '';
|
|
1291
|
-
_this3.tools = {
|
|
1292
|
-
gmailGetProfile: createTool({
|
|
1293
|
-
label: 'Get Gmail Profile',
|
|
1294
|
-
schema: zod.z.object({}),
|
|
1295
|
-
description: 'Get the profile of the authenticated user',
|
|
1296
|
-
executor: function () {
|
|
1297
|
-
var _executor2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
1298
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1299
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
1300
|
-
case 0:
|
|
1301
|
-
return _context3.abrupt("return", {
|
|
1302
|
-
email: ''
|
|
1303
|
-
});
|
|
1304
|
-
case 1:
|
|
1305
|
-
case "end":
|
|
1306
|
-
return _context3.stop();
|
|
1307
|
-
}
|
|
1308
|
-
}, _callee3);
|
|
1309
|
-
}));
|
|
1310
|
-
function executor() {
|
|
1311
|
-
return _executor2.apply(this, arguments);
|
|
1312
|
-
}
|
|
1313
|
-
return executor;
|
|
1314
|
-
}()
|
|
1315
|
-
})
|
|
1316
|
-
};
|
|
1317
|
-
return _this3;
|
|
1318
|
-
}
|
|
1319
|
-
_inheritsLoose(GmailIntegration, _Integration2);
|
|
1320
|
-
return GmailIntegration;
|
|
1321
|
-
}(Integration);
|
|
1322
1276
|
|
|
1323
1277
|
exports.PropertyType = void 0;
|
|
1324
1278
|
(function (PropertyType) {
|
|
@@ -1501,7 +1455,7 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
1501
1455
|
// Merge custom tools with integration tools
|
|
1502
1456
|
var allTools = _extends({}, configuredTools, integrationTools);
|
|
1503
1457
|
// Hydrate tools with integration tools
|
|
1504
|
-
var hydratedTools = Object.entries(allTools).reduce(function (memo, _ref) {
|
|
1458
|
+
var hydratedTools = Object.entries(allTools != null ? allTools : {}).reduce(function (memo, _ref) {
|
|
1505
1459
|
var key = _ref[0],
|
|
1506
1460
|
val = _ref[1];
|
|
1507
1461
|
memo[key] = _extends({}, val, {
|
|
@@ -1599,12 +1553,47 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
1599
1553
|
return agent;
|
|
1600
1554
|
};
|
|
1601
1555
|
_proto.getIntegration = function getIntegration(name) {
|
|
1602
|
-
var
|
|
1556
|
+
var stringifiedName = String(name);
|
|
1557
|
+
var integration = this.integrations.get(stringifiedName.toUpperCase());
|
|
1603
1558
|
if (!integration) {
|
|
1604
|
-
throw new Error("Integration with name " +
|
|
1559
|
+
throw new Error("Integration with name " + stringifiedName + " not found");
|
|
1605
1560
|
}
|
|
1606
1561
|
return integration;
|
|
1607
1562
|
};
|
|
1563
|
+
_proto.getTool = function getTool(name) {
|
|
1564
|
+
var _this2 = this;
|
|
1565
|
+
var tool = this.tools[name];
|
|
1566
|
+
if (!tool) {
|
|
1567
|
+
throw new Error("Tool with name " + String(name) + " not found");
|
|
1568
|
+
}
|
|
1569
|
+
return _extends({}, tool, {
|
|
1570
|
+
execute: function () {
|
|
1571
|
+
var _execute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
1572
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1573
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1574
|
+
case 0:
|
|
1575
|
+
return _context2.abrupt("return", tool.executor({
|
|
1576
|
+
data: params,
|
|
1577
|
+
getIntegration: function getIntegration(name) {
|
|
1578
|
+
return _this2.getIntegration(name);
|
|
1579
|
+
},
|
|
1580
|
+
agents: _this2.agents,
|
|
1581
|
+
llm: _this2.llm,
|
|
1582
|
+
engine: _this2.engine
|
|
1583
|
+
}));
|
|
1584
|
+
case 1:
|
|
1585
|
+
case "end":
|
|
1586
|
+
return _context2.stop();
|
|
1587
|
+
}
|
|
1588
|
+
}, _callee2);
|
|
1589
|
+
}));
|
|
1590
|
+
function execute(_x3) {
|
|
1591
|
+
return _execute.apply(this, arguments);
|
|
1592
|
+
}
|
|
1593
|
+
return execute;
|
|
1594
|
+
}()
|
|
1595
|
+
});
|
|
1596
|
+
};
|
|
1608
1597
|
_proto.availableIntegrations = function availableIntegrations() {
|
|
1609
1598
|
return Array.from(this.integrations.entries()).map(function (_ref2) {
|
|
1610
1599
|
var name = _ref2[0],
|
|
@@ -2389,7 +2378,6 @@ function _detectUnreachableSteps2() {
|
|
|
2389
2378
|
exports.Agent = Agent;
|
|
2390
2379
|
exports.BaseLogger = BaseLogger;
|
|
2391
2380
|
exports.FieldTypePrimitiveMap = FieldTypePrimitiveMap;
|
|
2392
|
-
exports.GmailIntegration = GmailIntegration;
|
|
2393
2381
|
exports.Integration = Integration;
|
|
2394
2382
|
exports.LogLevel = LogLevel;
|
|
2395
2383
|
exports.Mastra = Mastra;
|