@mastra/core 0.1.25 → 0.1.26
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/openai/assistant.d.ts +6 -3
- package/dist/agents/openai/assistant.d.ts.map +1 -1
- package/dist/agents/vector-sync.d.ts.map +1 -1
- package/dist/core.cjs.development.js +89 -83
- 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 +93 -83
- package/dist/core.esm.js.map +1 -1
- package/dist/framework.d.ts +13 -6
- package/dist/framework.d.ts.map +1 -1
- package/dist/utils/inngest.d.ts +1 -0
- package/dist/utils/inngest.d.ts.map +1 -1
- package/dist/workflows/runner.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -52,13 +52,15 @@ export declare function getAssistantAgentHandler(logger?: Logger<{
|
|
|
52
52
|
}) => Promise<OpenAI.Beta.Threads.Runs.Run & {
|
|
53
53
|
_request_id?: string | null;
|
|
54
54
|
}>;
|
|
55
|
-
handleRunStatus: ({ threadId, run, }: {
|
|
55
|
+
handleRunStatus: ({ threadId, run, callback, }: {
|
|
56
56
|
run: OpenAI.Beta.Threads.Runs.Run;
|
|
57
57
|
threadId: string;
|
|
58
|
+
callback?: (run: OpenAI.Beta.Threads.Run) => void;
|
|
58
59
|
}) => Promise<any>;
|
|
59
|
-
handleRequiresAction: ({ threadId, run, }: {
|
|
60
|
+
handleRequiresAction: ({ threadId, run, callback, }: {
|
|
60
61
|
threadId: string;
|
|
61
62
|
run: OpenAI.Beta.Threads.Runs.Run;
|
|
63
|
+
callback?: (run: OpenAI.Beta.Threads.Run) => void;
|
|
62
64
|
}) => Promise<any>;
|
|
63
65
|
createUserMessage: ({ threadId, content, }: {
|
|
64
66
|
threadId: string;
|
|
@@ -66,9 +68,10 @@ export declare function getAssistantAgentHandler(logger?: Logger<{
|
|
|
66
68
|
}) => Promise<OpenAI.Beta.Threads.Messages.Message & {
|
|
67
69
|
_request_id?: string | null;
|
|
68
70
|
}>;
|
|
69
|
-
watchRun: ({ runId, threadId, }: {
|
|
71
|
+
watchRun: ({ runId, threadId, callback, }: {
|
|
70
72
|
runId?: string;
|
|
71
73
|
threadId: string;
|
|
74
|
+
callback?: (run: OpenAI.Beta.Threads.Run) => void;
|
|
72
75
|
}) => Promise<any>;
|
|
73
76
|
}>;
|
|
74
77
|
//# sourceMappingURL=assistant.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.d.ts","sourceRoot":"","sources":["../../../src/agents/openai/assistant.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAOrD,wBAAgB,2BAA2B,CACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,gBAAgB,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC,4DAQC;IACD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC;CACrE;;GA8BF;AAED,wBAAgB,2BAA2B,CACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,gBAAgB,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC,yEASC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,IAAI,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MAAM,kBAAkB,8BA4B9B,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,GACP,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,cAAc,EAAE,CA2DnB;AAED,wBAAgB,oBAAoB;;;;EAOnC;AAED,wBAAgB,uBAAuB;;;;EAOtC;AAED,wBAAgB,eAAe;;;;EAM9B;AAED,wBAAsB,wCAAwC,CAAC,EAC7D,MAAM,GACP,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;CAChB,iBA2BA"}
|
|
@@ -1890,7 +1890,8 @@ var makeCallback = function makeCallback(framework) {
|
|
|
1890
1890
|
var APP_ID = 'mastra';
|
|
1891
1891
|
var client$1 = /*#__PURE__*/new inngest.Inngest({
|
|
1892
1892
|
id: APP_ID,
|
|
1893
|
-
eventKey: process.env.INNGEST_EVENT_KEY
|
|
1893
|
+
eventKey: process.env.INNGEST_EVENT_KEY,
|
|
1894
|
+
baseUrl: process.env.INNGEST_URL
|
|
1894
1895
|
});
|
|
1895
1896
|
|
|
1896
1897
|
function readBlueprintSync(filePath) {
|
|
@@ -4638,11 +4639,8 @@ function _blueprintRunner() {
|
|
|
4638
4639
|
});
|
|
4639
4640
|
case 19:
|
|
4640
4641
|
ranSuccessfully = _context4.sent;
|
|
4641
|
-
console.log('====Full context====', {
|
|
4642
|
-
fullCtx: fullCtx
|
|
4643
|
-
});
|
|
4644
4642
|
if (!ranSuccessfully) {
|
|
4645
|
-
_context4.next =
|
|
4643
|
+
_context4.next = 25;
|
|
4646
4644
|
break;
|
|
4647
4645
|
}
|
|
4648
4646
|
logger.info({
|
|
@@ -4655,7 +4653,7 @@ function _blueprintRunner() {
|
|
|
4655
4653
|
return _context4.abrupt("return", {
|
|
4656
4654
|
fullCtx: fullCtx
|
|
4657
4655
|
});
|
|
4658
|
-
case
|
|
4656
|
+
case 25:
|
|
4659
4657
|
logger.error({
|
|
4660
4658
|
type: RegisteredLogger.WORKFLOW,
|
|
4661
4659
|
destinationPath: "" + blueprint.id,
|
|
@@ -4666,7 +4664,7 @@ function _blueprintRunner() {
|
|
|
4666
4664
|
return _context4.abrupt("return", {
|
|
4667
4665
|
fullCtx: null
|
|
4668
4666
|
});
|
|
4669
|
-
case
|
|
4667
|
+
case 27:
|
|
4670
4668
|
case "end":
|
|
4671
4669
|
return _context4.stop();
|
|
4672
4670
|
}
|
|
@@ -5746,7 +5744,6 @@ function _syncAndWriteVectorProviderIndexesToLocal() {
|
|
|
5746
5744
|
while (1) switch (_context15.prev = _context15.next) {
|
|
5747
5745
|
case 0:
|
|
5748
5746
|
mastra = _ref14.mastra;
|
|
5749
|
-
// TODO: Return in prod ? or do somethif different
|
|
5750
5747
|
vectorProviders = mastra.config.agents.vectorProvider;
|
|
5751
5748
|
pullVectorProviderIndexes = /*#__PURE__*/function () {
|
|
5752
5749
|
var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref15) {
|
|
@@ -5885,9 +5882,9 @@ function getAgentSystemApis(_ref) {
|
|
|
5885
5882
|
case 19:
|
|
5886
5883
|
run = _context.sent;
|
|
5887
5884
|
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;
|
|
5888
|
-
_answer2 = run == null || (_run$content2 = run.content) == null
|
|
5885
|
+
_answer2 = run == null || (_run$content2 = run.content) == null || (_run$content2 = _run$content2.find(function (m) {
|
|
5889
5886
|
return m.toolName === 'answer';
|
|
5890
|
-
}).args;
|
|
5887
|
+
})) == null ? void 0 : _run$content2.args;
|
|
5891
5888
|
return _context.abrupt("return", {
|
|
5892
5889
|
message: message,
|
|
5893
5890
|
answer: _answer2
|
|
@@ -5915,18 +5912,18 @@ if (process.env.OPENAI_API_KEY) {
|
|
|
5915
5912
|
function createAssistantAgentHandler(logger) {
|
|
5916
5913
|
return /*#__PURE__*/function () {
|
|
5917
5914
|
var _createAssistantAgent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
5918
|
-
var name, instructions, model, tools,
|
|
5915
|
+
var name, instructions, model, tools, assistant;
|
|
5919
5916
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5920
5917
|
while (1) switch (_context.prev = _context.next) {
|
|
5921
5918
|
case 0:
|
|
5922
|
-
name = _ref.name, instructions = _ref.instructions, model = _ref.model, tools = _ref.tools
|
|
5919
|
+
name = _ref.name, instructions = _ref.instructions, model = _ref.model, tools = _ref.tools;
|
|
5923
5920
|
_context.next = 3;
|
|
5924
5921
|
return client.beta.assistants.create({
|
|
5925
5922
|
name: name,
|
|
5926
5923
|
model: model,
|
|
5927
5924
|
instructions: instructions,
|
|
5928
|
-
tools: tools
|
|
5929
|
-
response_format
|
|
5925
|
+
tools: tools
|
|
5926
|
+
//response_format,
|
|
5930
5927
|
});
|
|
5931
5928
|
case 3:
|
|
5932
5929
|
assistant = _context.sent;
|
|
@@ -5965,15 +5962,16 @@ function updateAssistantAgentHandler(logger) {
|
|
|
5965
5962
|
while (1) switch (_context2.prev = _context2.next) {
|
|
5966
5963
|
case 0:
|
|
5967
5964
|
assistantId = _ref2.assistantId, name = _ref2.name, instructions = _ref2.instructions, model = _ref2.model, tools = _ref2.tools, response_format = _ref2.response_format;
|
|
5968
|
-
|
|
5965
|
+
console.log('response_format', response_format);
|
|
5966
|
+
_context2.next = 4;
|
|
5969
5967
|
return client.beta.assistants.update(assistantId, {
|
|
5970
5968
|
name: name,
|
|
5971
5969
|
model: model,
|
|
5972
5970
|
instructions: instructions,
|
|
5973
|
-
tools: tools
|
|
5974
|
-
response_format
|
|
5971
|
+
tools: tools
|
|
5972
|
+
//response_format,
|
|
5975
5973
|
});
|
|
5976
|
-
case
|
|
5974
|
+
case 4:
|
|
5977
5975
|
assistant = _context2.sent;
|
|
5978
5976
|
logger == null || logger.info({
|
|
5979
5977
|
destinationPath: "" + assistant.id,
|
|
@@ -5990,7 +5988,7 @@ function updateAssistantAgentHandler(logger) {
|
|
|
5990
5988
|
}
|
|
5991
5989
|
}, null, 2)
|
|
5992
5990
|
});
|
|
5993
|
-
case
|
|
5991
|
+
case 6:
|
|
5994
5992
|
case "end":
|
|
5995
5993
|
return _context2.stop();
|
|
5996
5994
|
}
|
|
@@ -6016,11 +6014,11 @@ function getAssistantAgentHandler(logger) {
|
|
|
6016
6014
|
agent = _context11.sent;
|
|
6017
6015
|
handleRunStatus = /*#__PURE__*/function () {
|
|
6018
6016
|
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
|
|
6019
|
-
var threadId, run, _messages$data, messages;
|
|
6017
|
+
var threadId, run, callback, _messages$data, messages;
|
|
6020
6018
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
6021
6019
|
while (1) switch (_context3.prev = _context3.next) {
|
|
6022
6020
|
case 0:
|
|
6023
|
-
threadId = _ref4.threadId, run = _ref4.run;
|
|
6021
|
+
threadId = _ref4.threadId, run = _ref4.run, callback = _ref4.callback;
|
|
6024
6022
|
if (!(run.status === 'completed')) {
|
|
6025
6023
|
_context3.next = 8;
|
|
6026
6024
|
break;
|
|
@@ -6032,17 +6030,19 @@ function getAssistantAgentHandler(logger) {
|
|
|
6032
6030
|
return _context3.abrupt("return", (_messages$data = messages.data) == null ? void 0 : _messages$data[0]);
|
|
6033
6031
|
case 8:
|
|
6034
6032
|
if (!(run.status === 'requires_action')) {
|
|
6035
|
-
_context3.next =
|
|
6033
|
+
_context3.next = 15;
|
|
6036
6034
|
break;
|
|
6037
6035
|
}
|
|
6038
|
-
|
|
6036
|
+
callback == null || callback(run);
|
|
6037
|
+
_context3.next = 12;
|
|
6039
6038
|
return handleRequiresAction({
|
|
6040
6039
|
run: run,
|
|
6041
|
-
threadId: threadId
|
|
6040
|
+
threadId: threadId,
|
|
6041
|
+
callback: callback
|
|
6042
6042
|
});
|
|
6043
|
-
case
|
|
6043
|
+
case 12:
|
|
6044
6044
|
return _context3.abrupt("return", _context3.sent);
|
|
6045
|
-
case
|
|
6045
|
+
case 15:
|
|
6046
6046
|
console.error('Run did not complete:', run);
|
|
6047
6047
|
logger == null || logger.error({
|
|
6048
6048
|
destinationPath: "" + id,
|
|
@@ -6057,7 +6057,7 @@ function getAssistantAgentHandler(logger) {
|
|
|
6057
6057
|
}, null, 2)
|
|
6058
6058
|
});
|
|
6059
6059
|
return _context3.abrupt("return", run == null ? void 0 : run.last_error);
|
|
6060
|
-
case
|
|
6060
|
+
case 18:
|
|
6061
6061
|
case "end":
|
|
6062
6062
|
return _context3.stop();
|
|
6063
6063
|
}
|
|
@@ -6069,13 +6069,13 @@ function getAssistantAgentHandler(logger) {
|
|
|
6069
6069
|
}();
|
|
6070
6070
|
handleRequiresAction = /*#__PURE__*/function () {
|
|
6071
6071
|
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref6) {
|
|
6072
|
-
var threadId, run, toolOutputs;
|
|
6072
|
+
var threadId, run, callback, toolOutputs;
|
|
6073
6073
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
6074
6074
|
while (1) switch (_context5.prev = _context5.next) {
|
|
6075
6075
|
case 0:
|
|
6076
|
-
threadId = _ref6.threadId, run = _ref6.run;
|
|
6076
|
+
threadId = _ref6.threadId, run = _ref6.run, callback = _ref6.callback;
|
|
6077
6077
|
if (!(run.required_action && run.required_action.submit_tool_outputs && run.required_action.submit_tool_outputs.tool_calls)) {
|
|
6078
|
-
_context5.next =
|
|
6078
|
+
_context5.next = 22;
|
|
6079
6079
|
break;
|
|
6080
6080
|
}
|
|
6081
6081
|
_context5.t0 = _.compact;
|
|
@@ -6192,19 +6192,19 @@ function getAssistantAgentHandler(logger) {
|
|
|
6192
6192
|
});
|
|
6193
6193
|
return _context5.abrupt("return", handleRunStatus({
|
|
6194
6194
|
threadId: threadId,
|
|
6195
|
-
run: run
|
|
6195
|
+
run: run,
|
|
6196
|
+
callback: callback
|
|
6196
6197
|
}));
|
|
6197
6198
|
case 11:
|
|
6198
6199
|
if (!(toolOutputs && (toolOutputs == null ? void 0 : toolOutputs.length) > 0)) {
|
|
6199
|
-
_context5.next =
|
|
6200
|
+
_context5.next = 19;
|
|
6200
6201
|
break;
|
|
6201
6202
|
}
|
|
6202
|
-
|
|
6203
|
-
_context5.next = 15;
|
|
6203
|
+
_context5.next = 14;
|
|
6204
6204
|
return client.beta.threads.runs.submitToolOutputsAndPoll(threadId, run.id, {
|
|
6205
6205
|
tool_outputs: toolOutputs
|
|
6206
6206
|
});
|
|
6207
|
-
case
|
|
6207
|
+
case 14:
|
|
6208
6208
|
run = _context5.sent;
|
|
6209
6209
|
logger == null || logger.info({
|
|
6210
6210
|
destinationPath: "" + id,
|
|
@@ -6218,9 +6218,9 @@ function getAssistantAgentHandler(logger) {
|
|
|
6218
6218
|
}, null, 2)
|
|
6219
6219
|
});
|
|
6220
6220
|
console.log('Tool outputs submitted successfully.');
|
|
6221
|
-
_context5.next =
|
|
6221
|
+
_context5.next = 21;
|
|
6222
6222
|
break;
|
|
6223
|
-
case
|
|
6223
|
+
case 19:
|
|
6224
6224
|
logger == null || logger.info({
|
|
6225
6225
|
destinationPath: "" + id,
|
|
6226
6226
|
statusCode: 404,
|
|
@@ -6231,12 +6231,13 @@ function getAssistantAgentHandler(logger) {
|
|
|
6231
6231
|
}, null, 2)
|
|
6232
6232
|
});
|
|
6233
6233
|
console.log('No tool outputs to submit.');
|
|
6234
|
-
case
|
|
6234
|
+
case 21:
|
|
6235
6235
|
return _context5.abrupt("return", handleRunStatus({
|
|
6236
6236
|
threadId: threadId,
|
|
6237
|
-
run: run
|
|
6237
|
+
run: run,
|
|
6238
|
+
callback: callback
|
|
6238
6239
|
}));
|
|
6239
|
-
case
|
|
6240
|
+
case 22:
|
|
6240
6241
|
case "end":
|
|
6241
6242
|
return _context5.stop();
|
|
6242
6243
|
}
|
|
@@ -6346,11 +6347,11 @@ function getAssistantAgentHandler(logger) {
|
|
|
6346
6347
|
}(),
|
|
6347
6348
|
watchRun: function () {
|
|
6348
6349
|
var _watchRun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref13) {
|
|
6349
|
-
var runId, threadId, run;
|
|
6350
|
+
var runId, threadId, callback, run;
|
|
6350
6351
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
6351
6352
|
while (1) switch (_context10.prev = _context10.next) {
|
|
6352
6353
|
case 0:
|
|
6353
|
-
runId = _ref13.runId, threadId = _ref13.threadId;
|
|
6354
|
+
runId = _ref13.runId, threadId = _ref13.threadId, callback = _ref13.callback;
|
|
6354
6355
|
if (!runId) {
|
|
6355
6356
|
_context10.next = 7;
|
|
6356
6357
|
break;
|
|
@@ -6389,7 +6390,8 @@ function getAssistantAgentHandler(logger) {
|
|
|
6389
6390
|
case 11:
|
|
6390
6391
|
return _context10.abrupt("return", handleRunStatus({
|
|
6391
6392
|
threadId: threadId,
|
|
6392
|
-
run: run
|
|
6393
|
+
run: run,
|
|
6394
|
+
callback: callback
|
|
6393
6395
|
}));
|
|
6394
6396
|
case 12:
|
|
6395
6397
|
case "end":
|
|
@@ -7547,13 +7549,16 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
7547
7549
|
inngestApiToken = (_ref22 = (_this$config$runner$s = (_this$config$runner2 = this.config.runner) == null ? void 0 : _this$config$runner2.signingKey) != null ? _this$config$runner$s : process.env.INNGEST_SIGNING_KEY) != null ? _ref22 : '123';
|
|
7548
7550
|
startTime = Date.now();
|
|
7549
7551
|
_poll = /*#__PURE__*/function () {
|
|
7550
|
-
var _ref23 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
7551
|
-
var response, obj, data, error, lastRun, elapsedTime;
|
|
7552
|
+
var _ref23 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(lastRunId) {
|
|
7553
|
+
var response, obj, data, error, lastRunning, defaultLastRun, lastRun, elapsedTime;
|
|
7552
7554
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
7553
7555
|
while (1) switch (_context8.prev = _context8.next) {
|
|
7554
7556
|
case 0:
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
+
if (lastRunId === void 0) {
|
|
7558
|
+
lastRunId = '';
|
|
7559
|
+
}
|
|
7560
|
+
_context8.prev = 1;
|
|
7561
|
+
_context8.next = 4;
|
|
7557
7562
|
return fetch(inngestApiUrl + "/v1/events/" + id + "/runs", {
|
|
7558
7563
|
method: 'GET',
|
|
7559
7564
|
headers: {
|
|
@@ -7561,16 +7566,16 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
7561
7566
|
Authorization: "Bearer " + inngestApiToken
|
|
7562
7567
|
}
|
|
7563
7568
|
});
|
|
7564
|
-
case
|
|
7569
|
+
case 4:
|
|
7565
7570
|
response = _context8.sent;
|
|
7566
7571
|
console.log("Polling for event " + id + "...", response.ok);
|
|
7567
7572
|
if (!response.ok) {
|
|
7568
7573
|
_context8.next = 28;
|
|
7569
7574
|
break;
|
|
7570
7575
|
}
|
|
7571
|
-
_context8.next =
|
|
7576
|
+
_context8.next = 9;
|
|
7572
7577
|
return response.json();
|
|
7573
|
-
case
|
|
7578
|
+
case 9:
|
|
7574
7579
|
obj = _context8.sent;
|
|
7575
7580
|
console.log({
|
|
7576
7581
|
obj: obj
|
|
@@ -7578,42 +7583,45 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
7578
7583
|
data = obj.data, error = obj.error;
|
|
7579
7584
|
console.log("Got data for event " + id + "...", data, error);
|
|
7580
7585
|
if (!error) {
|
|
7581
|
-
_context8.next =
|
|
7586
|
+
_context8.next = 16;
|
|
7582
7587
|
break;
|
|
7583
7588
|
}
|
|
7584
7589
|
console.error(error);
|
|
7585
7590
|
return _context8.abrupt("return", null);
|
|
7586
|
-
case
|
|
7591
|
+
case 16:
|
|
7587
7592
|
if (!((data == null ? void 0 : data.length) === 0)) {
|
|
7588
|
-
_context8.next =
|
|
7593
|
+
_context8.next = 20;
|
|
7589
7594
|
break;
|
|
7590
7595
|
}
|
|
7591
|
-
_context8.next =
|
|
7596
|
+
_context8.next = 19;
|
|
7592
7597
|
return new Promise(function (resolve) {
|
|
7593
7598
|
return setTimeout(resolve, interval);
|
|
7594
7599
|
});
|
|
7595
|
-
case 18:
|
|
7596
|
-
return _context8.abrupt("return", _poll());
|
|
7597
7600
|
case 19:
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
case 23:
|
|
7606
|
-
if (!(lastRun.status === 'Running')) {
|
|
7607
|
-
_context8.next = 27;
|
|
7601
|
+
return _context8.abrupt("return", _poll());
|
|
7602
|
+
case 20:
|
|
7603
|
+
lastRunning = data == null ? void 0 : data.find(function (run) {
|
|
7604
|
+
return run.status === 'Running';
|
|
7605
|
+
});
|
|
7606
|
+
if (!lastRunning) {
|
|
7607
|
+
_context8.next = 25;
|
|
7608
7608
|
break;
|
|
7609
7609
|
}
|
|
7610
|
-
_context8.next =
|
|
7610
|
+
_context8.next = 24;
|
|
7611
7611
|
return new Promise(function (resolve) {
|
|
7612
7612
|
return setTimeout(resolve, interval);
|
|
7613
7613
|
});
|
|
7614
|
-
case
|
|
7615
|
-
return _context8.abrupt("return", _poll());
|
|
7616
|
-
case
|
|
7614
|
+
case 24:
|
|
7615
|
+
return _context8.abrupt("return", _poll(lastRunning.run_id));
|
|
7616
|
+
case 25:
|
|
7617
|
+
defaultLastRun = data[0];
|
|
7618
|
+
if (lastRunId) {
|
|
7619
|
+
lastRun = data == null ? void 0 : data.find(function (run) {
|
|
7620
|
+
return run.run_id === lastRunId;
|
|
7621
|
+
});
|
|
7622
|
+
} else {
|
|
7623
|
+
lastRun = defaultLastRun;
|
|
7624
|
+
}
|
|
7617
7625
|
return _context8.abrupt("return", {
|
|
7618
7626
|
status: lastRun.status,
|
|
7619
7627
|
output: lastRun.output,
|
|
@@ -7625,7 +7633,7 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
7625
7633
|
break;
|
|
7626
7634
|
case 30:
|
|
7627
7635
|
_context8.prev = 30;
|
|
7628
|
-
_context8.t0 = _context8["catch"](
|
|
7636
|
+
_context8.t0 = _context8["catch"](1);
|
|
7629
7637
|
console.error("Request failed: " + _context8.t0);
|
|
7630
7638
|
case 33:
|
|
7631
7639
|
// Check if timeout has been reached
|
|
@@ -7647,9 +7655,9 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
7647
7655
|
case "end":
|
|
7648
7656
|
return _context8.stop();
|
|
7649
7657
|
}
|
|
7650
|
-
}, _callee8, null, [[
|
|
7658
|
+
}, _callee8, null, [[1, 30]]);
|
|
7651
7659
|
}));
|
|
7652
|
-
return function poll() {
|
|
7660
|
+
return function poll(_x8) {
|
|
7653
7661
|
return _ref23.apply(this, arguments);
|
|
7654
7662
|
};
|
|
7655
7663
|
}();
|
|
@@ -7725,7 +7733,7 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
7725
7733
|
}
|
|
7726
7734
|
}, _callee10);
|
|
7727
7735
|
}));
|
|
7728
|
-
function subscribe(
|
|
7736
|
+
function subscribe(_x10) {
|
|
7729
7737
|
return _subscribe.apply(this, arguments);
|
|
7730
7738
|
}
|
|
7731
7739
|
return subscribe;
|
|
@@ -7762,7 +7770,7 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
7762
7770
|
}
|
|
7763
7771
|
}, _callee11);
|
|
7764
7772
|
}));
|
|
7765
|
-
function subscribe(
|
|
7773
|
+
function subscribe(_x11) {
|
|
7766
7774
|
return _subscribe2.apply(this, arguments);
|
|
7767
7775
|
}
|
|
7768
7776
|
return subscribe;
|
|
@@ -7779,7 +7787,7 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
7779
7787
|
}
|
|
7780
7788
|
}, _callee12, this, [[1, 20]]);
|
|
7781
7789
|
}));
|
|
7782
|
-
function triggerEvent(
|
|
7790
|
+
function triggerEvent(_x9) {
|
|
7783
7791
|
return _triggerEvent.apply(this, arguments);
|
|
7784
7792
|
}
|
|
7785
7793
|
return triggerEvent;
|
|
@@ -7824,7 +7832,7 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
7824
7832
|
}
|
|
7825
7833
|
}, _callee13, this);
|
|
7826
7834
|
}));
|
|
7827
|
-
function triggerSystemEvent(
|
|
7835
|
+
function triggerSystemEvent(_x12) {
|
|
7828
7836
|
return _triggerSystemEvent.apply(this, arguments);
|
|
7829
7837
|
}
|
|
7830
7838
|
return triggerSystemEvent;
|
|
@@ -7883,9 +7891,7 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
7883
7891
|
var v = _ref30[1];
|
|
7884
7892
|
return _extends({}, acc, v);
|
|
7885
7893
|
}, {});
|
|
7886
|
-
console.log('got finalApis==='
|
|
7887
|
-
finalApis: finalApis
|
|
7888
|
-
});
|
|
7894
|
+
console.log('got finalApis===');
|
|
7889
7895
|
return _context14.abrupt("return", getAgent({
|
|
7890
7896
|
connectionId: connectionId,
|
|
7891
7897
|
agent: agentBlueprint,
|
|
@@ -7898,7 +7904,7 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
7898
7904
|
}
|
|
7899
7905
|
}, _callee14, this);
|
|
7900
7906
|
}));
|
|
7901
|
-
function getAgent$1(
|
|
7907
|
+
function getAgent$1(_x13) {
|
|
7902
7908
|
return _getAgent2.apply(this, arguments);
|
|
7903
7909
|
}
|
|
7904
7910
|
return getAgent$1;
|
|
@@ -7908,11 +7914,11 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
7908
7914
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
7909
7915
|
while (1) switch (_context15.prev = _context15.next) {
|
|
7910
7916
|
case 0:
|
|
7911
|
-
_context15.next =
|
|
7917
|
+
_context15.next = 3;
|
|
7912
7918
|
return syncAndWriteVectorProviderIndexesToLocal({
|
|
7913
7919
|
mastra: this
|
|
7914
7920
|
});
|
|
7915
|
-
case
|
|
7921
|
+
case 3:
|
|
7916
7922
|
case "end":
|
|
7917
7923
|
return _context15.stop();
|
|
7918
7924
|
}
|