@mastra/core 0.1.19 → 0.1.21
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/agents/agent-apis.d.ts +1 -0
- package/dist/agents/agent-apis.d.ts.map +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/vercel/index.d.ts.map +1 -1
- package/dist/core.cjs.development.js +35 -25
- 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 +35 -25
- package/dist/core.esm.js.map +1 -1
- package/dist/prisma/gen.js +1 -1
- package/dist/prisma/schema.prisma +1 -1
- package/package.json +1 -1
package/dist/core.esm.js
CHANGED
|
@@ -5790,7 +5790,7 @@ function getAgentSystemApis(_ref) {
|
|
|
5790
5790
|
}),
|
|
5791
5791
|
executor: function () {
|
|
5792
5792
|
var _executor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
|
|
5793
|
-
var data, ctx, executor, result, _run$content, thread, run;
|
|
5793
|
+
var data, ctx, executor, _answer, result, answer, _result$toolCalls, _run$content, _run$content2, thread, run, message, _answer2;
|
|
5794
5794
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5795
5795
|
while (1) switch (_context.prev = _context.next) {
|
|
5796
5796
|
case 0:
|
|
@@ -5802,27 +5802,31 @@ function getAgentSystemApis(_ref) {
|
|
|
5802
5802
|
});
|
|
5803
5803
|
case 3:
|
|
5804
5804
|
executor = _context.sent;
|
|
5805
|
-
console.log('executor====', {
|
|
5806
|
-
executor: executor
|
|
5807
|
-
});
|
|
5808
5805
|
if (executor) {
|
|
5809
|
-
_context.next =
|
|
5806
|
+
_context.next = 6;
|
|
5810
5807
|
break;
|
|
5811
5808
|
}
|
|
5812
5809
|
throw new Error('Could not create agent executor');
|
|
5813
|
-
case
|
|
5810
|
+
case 6:
|
|
5814
5811
|
if (!(typeof executor === 'function')) {
|
|
5815
5812
|
_context.next = 14;
|
|
5816
5813
|
break;
|
|
5817
5814
|
}
|
|
5818
|
-
_context.next =
|
|
5815
|
+
_context.next = 9;
|
|
5819
5816
|
return executor({
|
|
5820
5817
|
prompt: data == null ? void 0 : data.message
|
|
5821
5818
|
});
|
|
5822
|
-
case
|
|
5819
|
+
case 9:
|
|
5823
5820
|
result = _context.sent;
|
|
5821
|
+
if (Array.isArray(result.toolCalls)) {
|
|
5822
|
+
answer = (_result$toolCalls = result.toolCalls) == null ? void 0 : _result$toolCalls.find(function (_ref3) {
|
|
5823
|
+
var toolName = _ref3.toolName;
|
|
5824
|
+
return toolName === 'answer';
|
|
5825
|
+
});
|
|
5826
|
+
}
|
|
5824
5827
|
return _context.abrupt("return", {
|
|
5825
|
-
message: result == null ? void 0 : result.text
|
|
5828
|
+
message: result == null ? void 0 : result.text,
|
|
5829
|
+
answer: (_answer = answer) == null ? void 0 : _answer.args
|
|
5826
5830
|
});
|
|
5827
5831
|
case 14:
|
|
5828
5832
|
_context.next = 16;
|
|
@@ -5838,10 +5842,15 @@ function getAgentSystemApis(_ref) {
|
|
|
5838
5842
|
});
|
|
5839
5843
|
case 19:
|
|
5840
5844
|
run = _context.sent;
|
|
5845
|
+
message = run == null || (_run$content = run.content) == null || (_run$content = _run$content[0]) == null || (_run$content = _run$content.text) == null ? void 0 : _run$content.value;
|
|
5846
|
+
_answer2 = run == null || (_run$content2 = run.content) == null ? void 0 : _run$content2.find(function (m) {
|
|
5847
|
+
return m.toolName === 'answer';
|
|
5848
|
+
}).args;
|
|
5841
5849
|
return _context.abrupt("return", {
|
|
5842
|
-
message:
|
|
5850
|
+
message: message,
|
|
5851
|
+
answer: _answer2
|
|
5843
5852
|
});
|
|
5844
|
-
case
|
|
5853
|
+
case 23:
|
|
5845
5854
|
case "end":
|
|
5846
5855
|
return _context.stop();
|
|
5847
5856
|
}
|
|
@@ -6516,7 +6525,7 @@ function createAgent(_ref6) {
|
|
|
6516
6525
|
});
|
|
6517
6526
|
return /*#__PURE__*/function () {
|
|
6518
6527
|
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref7) {
|
|
6519
|
-
var prompt, argsForExecute;
|
|
6528
|
+
var prompt, argsForExecute, messages;
|
|
6520
6529
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
6521
6530
|
while (1) switch (_context4.prev = _context4.next) {
|
|
6522
6531
|
case 0:
|
|
@@ -6553,19 +6562,20 @@ function createAgent(_ref6) {
|
|
|
6553
6562
|
return onStepFinish;
|
|
6554
6563
|
}()
|
|
6555
6564
|
};
|
|
6556
|
-
|
|
6565
|
+
messages = [].concat(context, [{
|
|
6566
|
+
role: 'user',
|
|
6567
|
+
content: prompt
|
|
6568
|
+
}, {
|
|
6569
|
+
role: 'system',
|
|
6570
|
+
content: agent_instructions
|
|
6571
|
+
}]);
|
|
6572
|
+
_context4.next = 5;
|
|
6557
6573
|
return generateText(_extends({
|
|
6558
|
-
messages:
|
|
6559
|
-
role: 'user',
|
|
6560
|
-
content: prompt
|
|
6561
|
-
}, {
|
|
6562
|
-
role: 'system',
|
|
6563
|
-
content: agent_instructions
|
|
6564
|
-
}])
|
|
6574
|
+
messages: messages
|
|
6565
6575
|
}, argsForExecute));
|
|
6566
|
-
case 4:
|
|
6567
|
-
return _context4.abrupt("return", _context4.sent);
|
|
6568
6576
|
case 5:
|
|
6577
|
+
return _context4.abrupt("return", _context4.sent);
|
|
6578
|
+
case 6:
|
|
6569
6579
|
case "end":
|
|
6570
6580
|
return _context4.stop();
|
|
6571
6581
|
}
|
|
@@ -6590,7 +6600,7 @@ function getAgent(_x) {
|
|
|
6590
6600
|
function _getAgent() {
|
|
6591
6601
|
_getAgent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
|
|
6592
6602
|
var _agent$model$provider, _agent$model$provider2;
|
|
6593
|
-
var connectionId, agent, apis, logger, tools, toolMap, getAssistantAgent, assistant, _agent$model2, keyToModel, _tools, _toolMap, resultTool, schema, _agent$model;
|
|
6603
|
+
var connectionId, agent, apis, logger, tools, toolMap, getAssistantAgent, assistant, _agent$model2, keyToModel, _tools, _toolMap, resultTool, _agent$outputs, schema, _agent$model;
|
|
6594
6604
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
6595
6605
|
while (1) switch (_context3.prev = _context3.next) {
|
|
6596
6606
|
case 0:
|
|
@@ -6691,7 +6701,7 @@ function _getAgent() {
|
|
|
6691
6701
|
}, {});
|
|
6692
6702
|
resultTool = undefined;
|
|
6693
6703
|
if (agent.outputs.structured) {
|
|
6694
|
-
schema = Object.entries(agent.outputs.structured
|
|
6704
|
+
schema = Object.entries(agent.outputs.structured).reduce(function (memo, _ref5) {
|
|
6695
6705
|
var k = _ref5[0],
|
|
6696
6706
|
v = _ref5[1];
|
|
6697
6707
|
if (v.type === 'string') {
|
|
@@ -6707,7 +6717,7 @@ function _getAgent() {
|
|
|
6707
6717
|
return memo;
|
|
6708
6718
|
}, {});
|
|
6709
6719
|
resultTool = {
|
|
6710
|
-
description: agent.outputs.
|
|
6720
|
+
description: ((_agent$outputs = agent.outputs) == null ? void 0 : _agent$outputs.description) || 'Structured Output',
|
|
6711
6721
|
parameters: z.object(schema)
|
|
6712
6722
|
};
|
|
6713
6723
|
}
|