@mastra/core 0.1.21 → 0.1.23
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 +92 -65
- 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 +96 -65
- package/dist/core.esm.js.map +1 -1
- package/dist/framework.d.ts +22 -7
- 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/handler.d.ts +22 -0
- package/dist/workflows/handler.d.ts.map +1 -1
- package/dist/workflows/runner.d.ts +7 -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,WAA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M,CAAC,MAAM,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrD;AAED,eAAO,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) {
|
|
@@ -2041,7 +2042,7 @@ var createWorkflowHandler = function createWorkflowHandler(_ref3) {
|
|
|
2041
2042
|
event: 'workflow/run-automations'
|
|
2042
2043
|
}, /*#__PURE__*/function () {
|
|
2043
2044
|
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
|
|
2044
|
-
var event, step, _event$data, trigger, payload, connectionId, getBlueprintsDirPath, blueprints, triggeredAndPublishedBlueprints, runs;
|
|
2045
|
+
var event, step, _event$data, trigger, payload, connectionId, getBlueprintsDirPath, blueprints, triggeredAndPublishedBlueprints, runs, data;
|
|
2045
2046
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2046
2047
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2047
2048
|
case 0:
|
|
@@ -2107,22 +2108,24 @@ var createWorkflowHandler = function createWorkflowHandler(_ref3) {
|
|
|
2107
2108
|
_context3.next = 12;
|
|
2108
2109
|
return Promise.all(runs);
|
|
2109
2110
|
case 12:
|
|
2111
|
+
data = _context3.sent;
|
|
2110
2112
|
return _context3.abrupt("return", {
|
|
2111
2113
|
event: event,
|
|
2112
|
-
body: "sync completed"
|
|
2114
|
+
body: "sync completed",
|
|
2115
|
+
data: data
|
|
2113
2116
|
});
|
|
2114
|
-
case
|
|
2115
|
-
_context3.prev =
|
|
2117
|
+
case 16:
|
|
2118
|
+
_context3.prev = 16;
|
|
2116
2119
|
_context3.t0 = _context3["catch"](1);
|
|
2117
2120
|
return _context3.abrupt("return", {
|
|
2118
2121
|
event: event,
|
|
2119
2122
|
body: "error occurred while running sync: " + _context3.t0
|
|
2120
2123
|
});
|
|
2121
|
-
case
|
|
2124
|
+
case 19:
|
|
2122
2125
|
case "end":
|
|
2123
2126
|
return _context3.stop();
|
|
2124
2127
|
}
|
|
2125
|
-
}, _callee3, null, [[1,
|
|
2128
|
+
}, _callee3, null, [[1, 16]]);
|
|
2126
2129
|
}));
|
|
2127
2130
|
return function (_x3) {
|
|
2128
2131
|
return _ref5.apply(this, arguments);
|
|
@@ -4208,11 +4211,11 @@ function runActionsRecursively(_x) {
|
|
|
4208
4211
|
}
|
|
4209
4212
|
function _runActionsRecursively() {
|
|
4210
4213
|
_runActionsRecursively = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref7) {
|
|
4211
|
-
var blueprintActions, frameworkApis, frameworkEvents, dataContext, blueprintId, runId, ctx, blueprintActionKVMap, logger, _loop, _ret, _iterator2, _step2;
|
|
4214
|
+
var blueprintActions, frameworkApis, frameworkEvents, dataContext, blueprintId, runId, ctx, blueprintActionKVMap, logger, order, _loop, _ret, _iterator2, _step2;
|
|
4212
4215
|
return _regeneratorRuntime().wrap(function _callee$(_context3) {
|
|
4213
4216
|
while (1) switch (_context3.prev = _context3.next) {
|
|
4214
4217
|
case 0:
|
|
4215
|
-
blueprintActions = _ref7.blueprintActions, frameworkApis = _ref7.frameworkApis, frameworkEvents = _ref7.frameworkEvents, dataContext = _ref7.dataContext, blueprintId = _ref7.blueprintId, runId = _ref7.runId, ctx = _ref7.ctx, blueprintActionKVMap = _ref7.blueprintActionKVMap, logger = _ref7.logger;
|
|
4218
|
+
blueprintActions = _ref7.blueprintActions, frameworkApis = _ref7.frameworkApis, frameworkEvents = _ref7.frameworkEvents, dataContext = _ref7.dataContext, blueprintId = _ref7.blueprintId, runId = _ref7.runId, ctx = _ref7.ctx, blueprintActionKVMap = _ref7.blueprintActionKVMap, logger = _ref7.logger, order = _ref7.order;
|
|
4216
4219
|
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
4217
4220
|
var _action$subActions;
|
|
4218
4221
|
var action, concreteAction, hasValidBranch, _loop2, _ret2, _iterator3, _step3, defaultCondition, defaultAction, actionExecutor, _ref9, mastraConnectionId, actionPayload, resolvedPayload, resolvedSchema, data, executorResult, _ctx, subActions;
|
|
@@ -4308,7 +4311,8 @@ function _runActionsRecursively() {
|
|
|
4308
4311
|
runId: runId,
|
|
4309
4312
|
ctx: ctx,
|
|
4310
4313
|
blueprintActionKVMap: blueprintActionKVMap,
|
|
4311
|
-
logger: logger
|
|
4314
|
+
logger: logger,
|
|
4315
|
+
order: order + 1
|
|
4312
4316
|
});
|
|
4313
4317
|
case 22:
|
|
4314
4318
|
executorResult = _context.sent;
|
|
@@ -4390,7 +4394,8 @@ function _runActionsRecursively() {
|
|
|
4390
4394
|
ctx: ctx,
|
|
4391
4395
|
blueprintId: blueprintId,
|
|
4392
4396
|
blueprintActionKVMap: blueprintActionKVMap,
|
|
4393
|
-
logger: logger
|
|
4397
|
+
logger: logger,
|
|
4398
|
+
order: order + 1
|
|
4394
4399
|
});
|
|
4395
4400
|
case 26:
|
|
4396
4401
|
_context2.t1 = _context2.sent;
|
|
@@ -4483,7 +4488,9 @@ function _runActionsRecursively() {
|
|
|
4483
4488
|
v: false
|
|
4484
4489
|
});
|
|
4485
4490
|
case 57:
|
|
4486
|
-
dataContext[action.id] = executorResult
|
|
4491
|
+
dataContext[action.id] = _extends({}, executorResult, {
|
|
4492
|
+
workflowStepOrder: order
|
|
4493
|
+
});
|
|
4487
4494
|
if (!(action.type === "CONDITIONS" || (_action$subActions = action.subActions) != null && _action$subActions.length)) {
|
|
4488
4495
|
_context2.next = 65;
|
|
4489
4496
|
break;
|
|
@@ -4503,7 +4510,8 @@ function _runActionsRecursively() {
|
|
|
4503
4510
|
ctx: ctx,
|
|
4504
4511
|
blueprintId: blueprintId,
|
|
4505
4512
|
blueprintActionKVMap: blueprintActionKVMap,
|
|
4506
|
-
logger: logger
|
|
4513
|
+
logger: logger,
|
|
4514
|
+
order: order + 1
|
|
4507
4515
|
});
|
|
4508
4516
|
case 63:
|
|
4509
4517
|
_context2.t3 = _context2.sent;
|
|
@@ -4611,7 +4619,9 @@ function _blueprintRunner() {
|
|
|
4611
4619
|
message: 'Workflow run skipped'
|
|
4612
4620
|
})
|
|
4613
4621
|
});
|
|
4614
|
-
return _context4.abrupt("return"
|
|
4622
|
+
return _context4.abrupt("return", {
|
|
4623
|
+
fullCtx: null
|
|
4624
|
+
});
|
|
4615
4625
|
case 16:
|
|
4616
4626
|
blueprintActionKVMap = constructWorkflowContextBluePrint(blueprint);
|
|
4617
4627
|
_context4.next = 19;
|
|
@@ -4624,28 +4634,37 @@ function _blueprintRunner() {
|
|
|
4624
4634
|
blueprintActionKVMap: blueprintActionKVMap,
|
|
4625
4635
|
blueprintId: blueprint.id,
|
|
4626
4636
|
runId: '',
|
|
4627
|
-
logger: logger
|
|
4637
|
+
logger: logger,
|
|
4638
|
+
order: 0
|
|
4628
4639
|
});
|
|
4629
4640
|
case 19:
|
|
4630
4641
|
ranSuccessfully = _context4.sent;
|
|
4631
|
-
if (ranSuccessfully) {
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
destinationPath: "" + blueprint.id,
|
|
4635
|
-
message: JSON.stringify({
|
|
4636
|
-
message: 'Workflow run completed'
|
|
4637
|
-
})
|
|
4638
|
-
});
|
|
4639
|
-
} else {
|
|
4640
|
-
logger.error({
|
|
4641
|
-
type: RegisteredLogger.WORKFLOW,
|
|
4642
|
-
destinationPath: "" + blueprint.id,
|
|
4643
|
-
message: JSON.stringify({
|
|
4644
|
-
message: 'Workflow run failed'
|
|
4645
|
-
})
|
|
4646
|
-
});
|
|
4642
|
+
if (!ranSuccessfully) {
|
|
4643
|
+
_context4.next = 25;
|
|
4644
|
+
break;
|
|
4647
4645
|
}
|
|
4648
|
-
|
|
4646
|
+
logger.info({
|
|
4647
|
+
type: RegisteredLogger.WORKFLOW,
|
|
4648
|
+
destinationPath: "" + blueprint.id,
|
|
4649
|
+
message: JSON.stringify({
|
|
4650
|
+
message: 'Workflow run completed'
|
|
4651
|
+
})
|
|
4652
|
+
});
|
|
4653
|
+
return _context4.abrupt("return", {
|
|
4654
|
+
fullCtx: fullCtx
|
|
4655
|
+
});
|
|
4656
|
+
case 25:
|
|
4657
|
+
logger.error({
|
|
4658
|
+
type: RegisteredLogger.WORKFLOW,
|
|
4659
|
+
destinationPath: "" + blueprint.id,
|
|
4660
|
+
message: JSON.stringify({
|
|
4661
|
+
message: 'Workflow run failed'
|
|
4662
|
+
})
|
|
4663
|
+
});
|
|
4664
|
+
return _context4.abrupt("return", {
|
|
4665
|
+
fullCtx: null
|
|
4666
|
+
});
|
|
4667
|
+
case 27:
|
|
4649
4668
|
case "end":
|
|
4650
4669
|
return _context4.stop();
|
|
4651
4670
|
}
|
|
@@ -5725,7 +5744,6 @@ function _syncAndWriteVectorProviderIndexesToLocal() {
|
|
|
5725
5744
|
while (1) switch (_context15.prev = _context15.next) {
|
|
5726
5745
|
case 0:
|
|
5727
5746
|
mastra = _ref14.mastra;
|
|
5728
|
-
// TODO: Return in prod ? or do somethif different
|
|
5729
5747
|
vectorProviders = mastra.config.agents.vectorProvider;
|
|
5730
5748
|
pullVectorProviderIndexes = /*#__PURE__*/function () {
|
|
5731
5749
|
var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref15) {
|
|
@@ -5864,9 +5882,9 @@ function getAgentSystemApis(_ref) {
|
|
|
5864
5882
|
case 19:
|
|
5865
5883
|
run = _context.sent;
|
|
5866
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;
|
|
5867
|
-
_answer2 = run == null || (_run$content2 = run.content) == null
|
|
5885
|
+
_answer2 = run == null || (_run$content2 = run.content) == null || (_run$content2 = _run$content2.find(function (m) {
|
|
5868
5886
|
return m.toolName === 'answer';
|
|
5869
|
-
}).args;
|
|
5887
|
+
})) == null ? void 0 : _run$content2.args;
|
|
5870
5888
|
return _context.abrupt("return", {
|
|
5871
5889
|
message: message,
|
|
5872
5890
|
answer: _answer2
|
|
@@ -5944,7 +5962,8 @@ function updateAssistantAgentHandler(logger) {
|
|
|
5944
5962
|
while (1) switch (_context2.prev = _context2.next) {
|
|
5945
5963
|
case 0:
|
|
5946
5964
|
assistantId = _ref2.assistantId, name = _ref2.name, instructions = _ref2.instructions, model = _ref2.model, tools = _ref2.tools, response_format = _ref2.response_format;
|
|
5947
|
-
|
|
5965
|
+
console.log('response_format', response_format);
|
|
5966
|
+
_context2.next = 4;
|
|
5948
5967
|
return client.beta.assistants.update(assistantId, {
|
|
5949
5968
|
name: name,
|
|
5950
5969
|
model: model,
|
|
@@ -5952,7 +5971,7 @@ function updateAssistantAgentHandler(logger) {
|
|
|
5952
5971
|
tools: tools,
|
|
5953
5972
|
response_format: response_format
|
|
5954
5973
|
});
|
|
5955
|
-
case
|
|
5974
|
+
case 4:
|
|
5956
5975
|
assistant = _context2.sent;
|
|
5957
5976
|
logger == null || logger.info({
|
|
5958
5977
|
destinationPath: "" + assistant.id,
|
|
@@ -5969,7 +5988,7 @@ function updateAssistantAgentHandler(logger) {
|
|
|
5969
5988
|
}
|
|
5970
5989
|
}, null, 2)
|
|
5971
5990
|
});
|
|
5972
|
-
case
|
|
5991
|
+
case 6:
|
|
5973
5992
|
case "end":
|
|
5974
5993
|
return _context2.stop();
|
|
5975
5994
|
}
|
|
@@ -5995,11 +6014,11 @@ function getAssistantAgentHandler(logger) {
|
|
|
5995
6014
|
agent = _context11.sent;
|
|
5996
6015
|
handleRunStatus = /*#__PURE__*/function () {
|
|
5997
6016
|
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
|
|
5998
|
-
var threadId, run, _messages$data, messages;
|
|
6017
|
+
var threadId, run, callback, _messages$data, messages;
|
|
5999
6018
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
6000
6019
|
while (1) switch (_context3.prev = _context3.next) {
|
|
6001
6020
|
case 0:
|
|
6002
|
-
threadId = _ref4.threadId, run = _ref4.run;
|
|
6021
|
+
threadId = _ref4.threadId, run = _ref4.run, callback = _ref4.callback;
|
|
6003
6022
|
if (!(run.status === 'completed')) {
|
|
6004
6023
|
_context3.next = 8;
|
|
6005
6024
|
break;
|
|
@@ -6011,17 +6030,19 @@ function getAssistantAgentHandler(logger) {
|
|
|
6011
6030
|
return _context3.abrupt("return", (_messages$data = messages.data) == null ? void 0 : _messages$data[0]);
|
|
6012
6031
|
case 8:
|
|
6013
6032
|
if (!(run.status === 'requires_action')) {
|
|
6014
|
-
_context3.next =
|
|
6033
|
+
_context3.next = 15;
|
|
6015
6034
|
break;
|
|
6016
6035
|
}
|
|
6017
|
-
|
|
6036
|
+
callback == null || callback(run);
|
|
6037
|
+
_context3.next = 12;
|
|
6018
6038
|
return handleRequiresAction({
|
|
6019
6039
|
run: run,
|
|
6020
|
-
threadId: threadId
|
|
6040
|
+
threadId: threadId,
|
|
6041
|
+
callback: callback
|
|
6021
6042
|
});
|
|
6022
|
-
case
|
|
6043
|
+
case 12:
|
|
6023
6044
|
return _context3.abrupt("return", _context3.sent);
|
|
6024
|
-
case
|
|
6045
|
+
case 15:
|
|
6025
6046
|
console.error('Run did not complete:', run);
|
|
6026
6047
|
logger == null || logger.error({
|
|
6027
6048
|
destinationPath: "" + id,
|
|
@@ -6036,7 +6057,7 @@ function getAssistantAgentHandler(logger) {
|
|
|
6036
6057
|
}, null, 2)
|
|
6037
6058
|
});
|
|
6038
6059
|
return _context3.abrupt("return", run == null ? void 0 : run.last_error);
|
|
6039
|
-
case
|
|
6060
|
+
case 18:
|
|
6040
6061
|
case "end":
|
|
6041
6062
|
return _context3.stop();
|
|
6042
6063
|
}
|
|
@@ -6048,13 +6069,13 @@ function getAssistantAgentHandler(logger) {
|
|
|
6048
6069
|
}();
|
|
6049
6070
|
handleRequiresAction = /*#__PURE__*/function () {
|
|
6050
6071
|
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref6) {
|
|
6051
|
-
var threadId, run, toolOutputs;
|
|
6072
|
+
var threadId, run, callback, toolOutputs;
|
|
6052
6073
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
6053
6074
|
while (1) switch (_context5.prev = _context5.next) {
|
|
6054
6075
|
case 0:
|
|
6055
|
-
threadId = _ref6.threadId, run = _ref6.run;
|
|
6076
|
+
threadId = _ref6.threadId, run = _ref6.run, callback = _ref6.callback;
|
|
6056
6077
|
if (!(run.required_action && run.required_action.submit_tool_outputs && run.required_action.submit_tool_outputs.tool_calls)) {
|
|
6057
|
-
_context5.next =
|
|
6078
|
+
_context5.next = 22;
|
|
6058
6079
|
break;
|
|
6059
6080
|
}
|
|
6060
6081
|
_context5.t0 = _.compact;
|
|
@@ -6171,19 +6192,19 @@ function getAssistantAgentHandler(logger) {
|
|
|
6171
6192
|
});
|
|
6172
6193
|
return _context5.abrupt("return", handleRunStatus({
|
|
6173
6194
|
threadId: threadId,
|
|
6174
|
-
run: run
|
|
6195
|
+
run: run,
|
|
6196
|
+
callback: callback
|
|
6175
6197
|
}));
|
|
6176
6198
|
case 11:
|
|
6177
6199
|
if (!(toolOutputs && (toolOutputs == null ? void 0 : toolOutputs.length) > 0)) {
|
|
6178
|
-
_context5.next =
|
|
6200
|
+
_context5.next = 19;
|
|
6179
6201
|
break;
|
|
6180
6202
|
}
|
|
6181
|
-
|
|
6182
|
-
_context5.next = 15;
|
|
6203
|
+
_context5.next = 14;
|
|
6183
6204
|
return client.beta.threads.runs.submitToolOutputsAndPoll(threadId, run.id, {
|
|
6184
6205
|
tool_outputs: toolOutputs
|
|
6185
6206
|
});
|
|
6186
|
-
case
|
|
6207
|
+
case 14:
|
|
6187
6208
|
run = _context5.sent;
|
|
6188
6209
|
logger == null || logger.info({
|
|
6189
6210
|
destinationPath: "" + id,
|
|
@@ -6197,9 +6218,9 @@ function getAssistantAgentHandler(logger) {
|
|
|
6197
6218
|
}, null, 2)
|
|
6198
6219
|
});
|
|
6199
6220
|
console.log('Tool outputs submitted successfully.');
|
|
6200
|
-
_context5.next =
|
|
6221
|
+
_context5.next = 21;
|
|
6201
6222
|
break;
|
|
6202
|
-
case
|
|
6223
|
+
case 19:
|
|
6203
6224
|
logger == null || logger.info({
|
|
6204
6225
|
destinationPath: "" + id,
|
|
6205
6226
|
statusCode: 404,
|
|
@@ -6210,12 +6231,13 @@ function getAssistantAgentHandler(logger) {
|
|
|
6210
6231
|
}, null, 2)
|
|
6211
6232
|
});
|
|
6212
6233
|
console.log('No tool outputs to submit.');
|
|
6213
|
-
case
|
|
6234
|
+
case 21:
|
|
6214
6235
|
return _context5.abrupt("return", handleRunStatus({
|
|
6215
6236
|
threadId: threadId,
|
|
6216
|
-
run: run
|
|
6237
|
+
run: run,
|
|
6238
|
+
callback: callback
|
|
6217
6239
|
}));
|
|
6218
|
-
case
|
|
6240
|
+
case 22:
|
|
6219
6241
|
case "end":
|
|
6220
6242
|
return _context5.stop();
|
|
6221
6243
|
}
|
|
@@ -6325,11 +6347,11 @@ function getAssistantAgentHandler(logger) {
|
|
|
6325
6347
|
}(),
|
|
6326
6348
|
watchRun: function () {
|
|
6327
6349
|
var _watchRun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref13) {
|
|
6328
|
-
var runId, threadId, run;
|
|
6350
|
+
var runId, threadId, callback, run;
|
|
6329
6351
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
6330
6352
|
while (1) switch (_context10.prev = _context10.next) {
|
|
6331
6353
|
case 0:
|
|
6332
|
-
runId = _ref13.runId, threadId = _ref13.threadId;
|
|
6354
|
+
runId = _ref13.runId, threadId = _ref13.threadId, callback = _ref13.callback;
|
|
6333
6355
|
if (!runId) {
|
|
6334
6356
|
_context10.next = 7;
|
|
6335
6357
|
break;
|
|
@@ -6368,7 +6390,8 @@ function getAssistantAgentHandler(logger) {
|
|
|
6368
6390
|
case 11:
|
|
6369
6391
|
return _context10.abrupt("return", handleRunStatus({
|
|
6370
6392
|
threadId: threadId,
|
|
6371
|
-
run: run
|
|
6393
|
+
run: run,
|
|
6394
|
+
callback: callback
|
|
6372
6395
|
}));
|
|
6373
6396
|
case 12:
|
|
6374
6397
|
case "end":
|
|
@@ -6908,7 +6931,7 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
6908
6931
|
this.runBlueprint = /*#__PURE__*/function () {
|
|
6909
6932
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
|
|
6910
6933
|
var _this$availableIntegr;
|
|
6911
|
-
var blueprint, _ref2$dataCtx, dataCtx, ctx, systemApis, systemEvents, availableIntegrations, availableIntegrationApis, availableIntegrationEvents, frameworkApis, frameworkEvents;
|
|
6934
|
+
var blueprint, _ref2$dataCtx, dataCtx, ctx, systemApis, systemEvents, availableIntegrations, availableIntegrationApis, availableIntegrationEvents, frameworkApis, frameworkEvents, blueprintResult;
|
|
6912
6935
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6913
6936
|
while (1) switch (_context.prev = _context.next) {
|
|
6914
6937
|
case 0:
|
|
@@ -6941,6 +6964,9 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
6941
6964
|
logger: _this.logger.get('WORKFLOW')
|
|
6942
6965
|
});
|
|
6943
6966
|
case 10:
|
|
6967
|
+
blueprintResult = _context.sent;
|
|
6968
|
+
return _context.abrupt("return", blueprintResult);
|
|
6969
|
+
case 12:
|
|
6944
6970
|
case "end":
|
|
6945
6971
|
return _context.stop();
|
|
6946
6972
|
}
|
|
@@ -7592,6 +7618,7 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
7592
7618
|
case 27:
|
|
7593
7619
|
return _context8.abrupt("return", {
|
|
7594
7620
|
status: lastRun.status,
|
|
7621
|
+
output: lastRun.output,
|
|
7595
7622
|
startedAt: lastRun.run_started_at,
|
|
7596
7623
|
endedAt: lastRun.ended_at
|
|
7597
7624
|
});
|
|
@@ -7881,11 +7908,11 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
7881
7908
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
7882
7909
|
while (1) switch (_context15.prev = _context15.next) {
|
|
7883
7910
|
case 0:
|
|
7884
|
-
_context15.next =
|
|
7911
|
+
_context15.next = 3;
|
|
7885
7912
|
return syncAndWriteVectorProviderIndexesToLocal({
|
|
7886
7913
|
mastra: this
|
|
7887
7914
|
});
|
|
7888
|
-
case
|
|
7915
|
+
case 3:
|
|
7889
7916
|
case "end":
|
|
7890
7917
|
return _context15.stop();
|
|
7891
7918
|
}
|