@mastra/server 0.0.0-transpile-packages-20250724123433 → 0.0.0-transpile-packages-20250730132657
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/_tsup-dts-rollup.d.cts +72 -11
- package/dist/_tsup-dts-rollup.d.ts +72 -11
- package/dist/{chunk-MEGCYGBU.js → chunk-36BLNJHS.js} +37 -37
- package/dist/{chunk-CBFTEHOO.cjs → chunk-424T5F2J.cjs} +1 -1
- package/dist/{chunk-B2PAS2IB.cjs → chunk-6KP2OBYA.cjs} +47 -17
- package/dist/{chunk-VULESSU5.js → chunk-6T5JUKOQ.js} +1 -1
- package/dist/{chunk-LI436ITD.cjs → chunk-HISYIDYH.cjs} +37 -37
- package/dist/{chunk-FRVBFMO2.cjs → chunk-HRSAZUIK.cjs} +5 -5
- package/dist/{chunk-LZ3VJXSO.cjs → chunk-I5JKUCGE.cjs} +36 -6
- package/dist/{chunk-G4L7OMCA.js → chunk-R3I7AJVL.js} +190 -3
- package/dist/{chunk-H7DMHBKY.js → chunk-T7HAZC2E.js} +31 -2
- package/dist/{chunk-Z75RYULP.cjs → chunk-TTPJHP42.cjs} +191 -2
- package/dist/{chunk-JMLYCXMK.cjs → chunk-UCV4247U.cjs} +7 -7
- package/dist/{chunk-BK4XT6EG.js → chunk-VTTN2FW3.js} +32 -3
- package/dist/{chunk-LRCAAFUA.js → chunk-WBRFIHSF.js} +1 -1
- package/dist/{chunk-5PQQ42EZ.js → chunk-ZYAFP2AV.js} +1 -1
- package/dist/server/handlers/agents.cjs +11 -7
- package/dist/server/handlers/agents.d.cts +1 -0
- package/dist/server/handlers/agents.d.ts +1 -0
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/legacyWorkflows.cjs +11 -11
- package/dist/server/handlers/legacyWorkflows.js +1 -1
- package/dist/server/handlers/memory.cjs +20 -12
- package/dist/server/handlers/memory.d.cts +2 -0
- package/dist/server/handlers/memory.d.ts +2 -0
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/scores.cjs +7 -7
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/tools.cjs +5 -5
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/vNextNetwork.cjs +5 -5
- package/dist/server/handlers/vNextNetwork.js +1 -1
- package/dist/server/handlers/workflows.cjs +19 -15
- package/dist/server/handlers/workflows.d.cts +1 -0
- package/dist/server/handlers/workflows.d.ts +1 -0
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +12 -12
- package/dist/server/handlers.js +6 -6
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { stringify, esm_default } from './chunk-
|
|
1
|
+
import { stringify, esm_default } from './chunk-36BLNJHS.js';
|
|
2
2
|
import { handleError } from './chunk-LF7P5PLR.js';
|
|
3
3
|
import { HTTPException } from './chunk-LCM566I4.js';
|
|
4
4
|
import { __export } from './chunk-MLKGABMK.js';
|
|
@@ -19,6 +19,7 @@ __export(workflows_exports, {
|
|
|
19
19
|
sendWorkflowRunEventHandler: () => sendWorkflowRunEventHandler,
|
|
20
20
|
startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
|
|
21
21
|
startWorkflowRunHandler: () => startWorkflowRunHandler,
|
|
22
|
+
streamVNextWorkflowHandler: () => streamVNextWorkflowHandler,
|
|
22
23
|
streamWorkflowHandler: () => streamWorkflowHandler,
|
|
23
24
|
watchWorkflowHandler: () => watchWorkflowHandler
|
|
24
25
|
});
|
|
@@ -340,6 +341,34 @@ async function streamWorkflowHandler({
|
|
|
340
341
|
return handleError(error, "Error executing workflow");
|
|
341
342
|
}
|
|
342
343
|
}
|
|
344
|
+
async function streamVNextWorkflowHandler({
|
|
345
|
+
mastra,
|
|
346
|
+
runtimeContext,
|
|
347
|
+
workflowId,
|
|
348
|
+
runId,
|
|
349
|
+
inputData
|
|
350
|
+
}) {
|
|
351
|
+
try {
|
|
352
|
+
if (!workflowId) {
|
|
353
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
354
|
+
}
|
|
355
|
+
if (!runId) {
|
|
356
|
+
throw new HTTPException(400, { message: "runId required to stream workflow" });
|
|
357
|
+
}
|
|
358
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
359
|
+
if (!workflow) {
|
|
360
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
361
|
+
}
|
|
362
|
+
const run = await workflow.createRunAsync({ runId });
|
|
363
|
+
const result = run.streamVNext({
|
|
364
|
+
inputData,
|
|
365
|
+
runtimeContext
|
|
366
|
+
});
|
|
367
|
+
return result;
|
|
368
|
+
} catch (error) {
|
|
369
|
+
return handleError(error, "Error streaming workflow");
|
|
370
|
+
}
|
|
371
|
+
}
|
|
343
372
|
async function resumeAsyncWorkflowHandler({
|
|
344
373
|
mastra,
|
|
345
374
|
workflowId,
|
|
@@ -495,4 +524,4 @@ async function sendWorkflowRunEventHandler({
|
|
|
495
524
|
}
|
|
496
525
|
}
|
|
497
526
|
|
|
498
|
-
export { cancelWorkflowRunHandler, createWorkflowRunHandler, getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunExecutionResultHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, sendWorkflowRunEventHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, streamWorkflowHandler, watchWorkflowHandler, workflows_exports };
|
|
527
|
+
export { cancelWorkflowRunHandler, createWorkflowRunHandler, getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunExecutionResultHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, sendWorkflowRunEventHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, streamVNextWorkflowHandler, streamWorkflowHandler, watchWorkflowHandler, workflows_exports };
|
|
@@ -11,6 +11,7 @@ var memory_exports = {};
|
|
|
11
11
|
chunk75ZPJI57_cjs.__export(memory_exports, {
|
|
12
12
|
createThreadHandler: () => createThreadHandler,
|
|
13
13
|
deleteThreadHandler: () => deleteThreadHandler,
|
|
14
|
+
getMemoryConfigHandler: () => getMemoryConfigHandler,
|
|
14
15
|
getMemoryStatusHandler: () => getMemoryStatusHandler,
|
|
15
16
|
getMessagesHandler: () => getMessagesHandler,
|
|
16
17
|
getMessagesPaginatedHandler: () => getMessagesPaginatedHandler,
|
|
@@ -18,6 +19,7 @@ chunk75ZPJI57_cjs.__export(memory_exports, {
|
|
|
18
19
|
getThreadsHandler: () => getThreadsHandler,
|
|
19
20
|
getWorkingMemoryHandler: () => getWorkingMemoryHandler,
|
|
20
21
|
saveMessagesHandler: () => saveMessagesHandler,
|
|
22
|
+
searchMemoryHandler: () => searchMemoryHandler,
|
|
21
23
|
updateThreadHandler: () => updateThreadHandler,
|
|
22
24
|
updateWorkingMemoryHandler: () => updateWorkingMemoryHandler
|
|
23
25
|
});
|
|
@@ -36,7 +38,7 @@ async function getMemoryFromContext({
|
|
|
36
38
|
throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Network not found" });
|
|
37
39
|
}
|
|
38
40
|
if (agent) {
|
|
39
|
-
return agent?.getMemory() || mastra.getMemory();
|
|
41
|
+
return await agent?.getMemory() || mastra.getMemory();
|
|
40
42
|
}
|
|
41
43
|
if (network) {
|
|
42
44
|
return await network?.getMemory({ runtimeContext }) || mastra.getMemory();
|
|
@@ -59,6 +61,23 @@ async function getMemoryStatusHandler({
|
|
|
59
61
|
return chunkPZQDCRPV_cjs.handleError(error, "Error getting memory status");
|
|
60
62
|
}
|
|
61
63
|
}
|
|
64
|
+
async function getMemoryConfigHandler({
|
|
65
|
+
mastra,
|
|
66
|
+
agentId,
|
|
67
|
+
networkId,
|
|
68
|
+
runtimeContext
|
|
69
|
+
}) {
|
|
70
|
+
try {
|
|
71
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
72
|
+
if (!memory) {
|
|
73
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Memory is not initialized" });
|
|
74
|
+
}
|
|
75
|
+
const config = memory.getMergedThreadConfig({});
|
|
76
|
+
return { config };
|
|
77
|
+
} catch (error) {
|
|
78
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error getting memory configuration");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
62
81
|
async function getThreadsHandler({
|
|
63
82
|
mastra,
|
|
64
83
|
agentId,
|
|
@@ -118,9 +137,15 @@ async function saveMessagesHandler({
|
|
|
118
137
|
if (!Array.isArray(body.messages)) {
|
|
119
138
|
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Messages should be an array" });
|
|
120
139
|
}
|
|
140
|
+
const invalidMessages = body.messages.filter((message) => !message.threadId || !message.resourceId);
|
|
141
|
+
if (invalidMessages.length > 0) {
|
|
142
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, {
|
|
143
|
+
message: `All messages must have threadId and resourceId fields. Found ${invalidMessages.length} invalid message(s).`
|
|
144
|
+
});
|
|
145
|
+
}
|
|
121
146
|
const processedMessages = body.messages.map((message) => ({
|
|
122
147
|
...message,
|
|
123
|
-
id: memory.generateId(),
|
|
148
|
+
id: message.id || memory.generateId(),
|
|
124
149
|
createdAt: message.createdAt ? new Date(message.createdAt) : /* @__PURE__ */ new Date()
|
|
125
150
|
}));
|
|
126
151
|
const result = await memory.saveMessages({ messages: processedMessages, memoryConfig: {} });
|
|
@@ -318,9 +343,172 @@ async function updateWorkingMemoryHandler({
|
|
|
318
343
|
return chunkPZQDCRPV_cjs.handleError(error, "Error updating working memory");
|
|
319
344
|
}
|
|
320
345
|
}
|
|
346
|
+
async function searchMemoryHandler({
|
|
347
|
+
mastra,
|
|
348
|
+
agentId,
|
|
349
|
+
searchQuery,
|
|
350
|
+
resourceId,
|
|
351
|
+
threadId,
|
|
352
|
+
limit = 20,
|
|
353
|
+
networkId,
|
|
354
|
+
runtimeContext,
|
|
355
|
+
memoryConfig
|
|
356
|
+
}) {
|
|
357
|
+
try {
|
|
358
|
+
chunkCCGRCYWJ_cjs.validateBody({ searchQuery, resourceId });
|
|
359
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
360
|
+
if (!memory) {
|
|
361
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Memory is not initialized" });
|
|
362
|
+
}
|
|
363
|
+
const config = memory.getMergedThreadConfig(memoryConfig || {});
|
|
364
|
+
const hasSemanticRecall = !!config?.semanticRecall;
|
|
365
|
+
const resourceScope = typeof config?.semanticRecall === "object" && config?.semanticRecall?.scope === "resource";
|
|
366
|
+
if (threadId && !resourceScope) {
|
|
367
|
+
const thread = await memory.getThreadById({ threadId });
|
|
368
|
+
if (!thread) {
|
|
369
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Thread not found" });
|
|
370
|
+
}
|
|
371
|
+
if (thread.resourceId !== resourceId) {
|
|
372
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(403, { message: "Thread does not belong to the specified resource" });
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
const searchResults = [];
|
|
376
|
+
const messageMap = /* @__PURE__ */ new Map();
|
|
377
|
+
if (threadId && !resourceScope) {
|
|
378
|
+
const thread = await memory.getThreadById({ threadId });
|
|
379
|
+
if (!thread) {
|
|
380
|
+
return {
|
|
381
|
+
results: [],
|
|
382
|
+
count: 0,
|
|
383
|
+
query: searchQuery,
|
|
384
|
+
searchScope: "thread",
|
|
385
|
+
searchType: hasSemanticRecall ? "semantic" : "text"
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
if (!threadId || resourceScope) {
|
|
390
|
+
const threads = await memory.getThreadsByResourceId({ resourceId });
|
|
391
|
+
if (threads.length === 0) {
|
|
392
|
+
return {
|
|
393
|
+
results: [],
|
|
394
|
+
count: 0,
|
|
395
|
+
query: searchQuery,
|
|
396
|
+
searchScope: "resource",
|
|
397
|
+
searchType: hasSemanticRecall ? "semantic" : "text"
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
for (const thread of threads) {
|
|
401
|
+
const result = await memory.rememberMessages({
|
|
402
|
+
threadId: thread.id,
|
|
403
|
+
resourceId,
|
|
404
|
+
vectorMessageSearch: searchQuery,
|
|
405
|
+
config
|
|
406
|
+
});
|
|
407
|
+
const threadMessages = (await memory.query({ threadId: thread.id })).uiMessages;
|
|
408
|
+
result.messagesV2.forEach((msg) => {
|
|
409
|
+
if (messageMap.has(msg.id)) return;
|
|
410
|
+
messageMap.set(msg.id, true);
|
|
411
|
+
const content = msg.content.content || msg.content.parts?.map((p) => p.type === "text" ? p.text : "").join(" ") || "";
|
|
412
|
+
if (!hasSemanticRecall && !content.toLowerCase().includes(searchQuery.toLowerCase())) {
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
const messageIndex = threadMessages.findIndex((m) => m.id === msg.id);
|
|
416
|
+
const searchResult = {
|
|
417
|
+
id: msg.id,
|
|
418
|
+
role: msg.role,
|
|
419
|
+
content,
|
|
420
|
+
createdAt: msg.createdAt,
|
|
421
|
+
threadId: msg.threadId || thread.id,
|
|
422
|
+
threadTitle: thread.title || msg.threadId || thread.id
|
|
423
|
+
};
|
|
424
|
+
if (messageIndex !== -1) {
|
|
425
|
+
searchResult.context = {
|
|
426
|
+
before: threadMessages.slice(Math.max(0, messageIndex - 2), messageIndex).map((m) => ({
|
|
427
|
+
id: m.id,
|
|
428
|
+
role: m.role,
|
|
429
|
+
content: m.content,
|
|
430
|
+
createdAt: m.createdAt || /* @__PURE__ */ new Date()
|
|
431
|
+
})),
|
|
432
|
+
after: threadMessages.slice(messageIndex + 1, messageIndex + 3).map((m) => ({
|
|
433
|
+
id: m.id,
|
|
434
|
+
role: m.role,
|
|
435
|
+
content: m.content,
|
|
436
|
+
createdAt: m.createdAt || /* @__PURE__ */ new Date()
|
|
437
|
+
}))
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
searchResults.push(searchResult);
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
} else if (threadId) {
|
|
444
|
+
const thread = await memory.getThreadById({ threadId });
|
|
445
|
+
if (!thread) {
|
|
446
|
+
return {
|
|
447
|
+
results: [],
|
|
448
|
+
count: 0,
|
|
449
|
+
query: searchQuery,
|
|
450
|
+
searchScope: "thread",
|
|
451
|
+
searchType: hasSemanticRecall ? "semantic" : "text"
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
const result = await memory.rememberMessages({
|
|
455
|
+
threadId,
|
|
456
|
+
resourceId,
|
|
457
|
+
vectorMessageSearch: searchQuery,
|
|
458
|
+
config
|
|
459
|
+
});
|
|
460
|
+
const threadMessages = (await memory.query({ threadId })).uiMessages;
|
|
461
|
+
result.messagesV2.forEach((msg) => {
|
|
462
|
+
if (messageMap.has(msg.id)) return;
|
|
463
|
+
messageMap.set(msg.id, true);
|
|
464
|
+
const content = msg.content.content || msg.content.parts?.map((p) => p.type === "text" ? p.text : "").join(" ") || "";
|
|
465
|
+
if (!hasSemanticRecall && !content.toLowerCase().includes(searchQuery.toLowerCase())) {
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
const messageIndex = threadMessages.findIndex((m) => m.id === msg.id);
|
|
469
|
+
const searchResult = {
|
|
470
|
+
id: msg.id,
|
|
471
|
+
role: msg.role,
|
|
472
|
+
content,
|
|
473
|
+
createdAt: msg.createdAt,
|
|
474
|
+
threadId,
|
|
475
|
+
threadTitle: thread?.title || threadId
|
|
476
|
+
};
|
|
477
|
+
if (messageIndex !== -1) {
|
|
478
|
+
searchResult.context = {
|
|
479
|
+
before: threadMessages.slice(Math.max(0, messageIndex - 2), messageIndex).map((m) => ({
|
|
480
|
+
id: m.id,
|
|
481
|
+
role: m.role,
|
|
482
|
+
content: m.content,
|
|
483
|
+
createdAt: m.createdAt || /* @__PURE__ */ new Date()
|
|
484
|
+
})),
|
|
485
|
+
after: threadMessages.slice(messageIndex + 1, messageIndex + 3).map((m) => ({
|
|
486
|
+
id: m.id,
|
|
487
|
+
role: m.role,
|
|
488
|
+
content: m.content,
|
|
489
|
+
createdAt: m.createdAt || /* @__PURE__ */ new Date()
|
|
490
|
+
}))
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
searchResults.push(searchResult);
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
const sortedResults = searchResults.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()).slice(0, limit);
|
|
497
|
+
return {
|
|
498
|
+
results: sortedResults,
|
|
499
|
+
count: sortedResults.length,
|
|
500
|
+
query: searchQuery,
|
|
501
|
+
searchScope: resourceScope ? "resource" : "thread",
|
|
502
|
+
searchType: hasSemanticRecall ? "semantic" : "text"
|
|
503
|
+
};
|
|
504
|
+
} catch (error) {
|
|
505
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error searching memory");
|
|
506
|
+
}
|
|
507
|
+
}
|
|
321
508
|
|
|
322
509
|
exports.createThreadHandler = createThreadHandler;
|
|
323
510
|
exports.deleteThreadHandler = deleteThreadHandler;
|
|
511
|
+
exports.getMemoryConfigHandler = getMemoryConfigHandler;
|
|
324
512
|
exports.getMemoryStatusHandler = getMemoryStatusHandler;
|
|
325
513
|
exports.getMessagesHandler = getMessagesHandler;
|
|
326
514
|
exports.getMessagesPaginatedHandler = getMessagesPaginatedHandler;
|
|
@@ -329,5 +517,6 @@ exports.getThreadsHandler = getThreadsHandler;
|
|
|
329
517
|
exports.getWorkingMemoryHandler = getWorkingMemoryHandler;
|
|
330
518
|
exports.memory_exports = memory_exports;
|
|
331
519
|
exports.saveMessagesHandler = saveMessagesHandler;
|
|
520
|
+
exports.searchMemoryHandler = searchMemoryHandler;
|
|
332
521
|
exports.updateThreadHandler = updateThreadHandler;
|
|
333
522
|
exports.updateWorkingMemoryHandler = updateWorkingMemoryHandler;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHISYIDYH_cjs = require('./chunk-HISYIDYH.cjs');
|
|
4
4
|
var chunkPZQDCRPV_cjs = require('./chunk-PZQDCRPV.cjs');
|
|
5
5
|
var chunk2KZFMI6P_cjs = require('./chunk-2KZFMI6P.cjs');
|
|
6
6
|
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
@@ -31,15 +31,15 @@ async function getLegacyWorkflowsHandler({ mastra }) {
|
|
|
31
31
|
serializedStepGraph: workflow.serializedStepGraph,
|
|
32
32
|
serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
|
|
33
33
|
name: workflow.name,
|
|
34
|
-
triggerSchema: workflow.triggerSchema ?
|
|
34
|
+
triggerSchema: workflow.triggerSchema ? chunkHISYIDYH_cjs.stringify(chunkHISYIDYH_cjs.esm_default(workflow.triggerSchema)) : void 0,
|
|
35
35
|
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
36
36
|
const _step = step;
|
|
37
37
|
acc2[key2] = {
|
|
38
38
|
id: _step.id,
|
|
39
39
|
description: _step.description,
|
|
40
40
|
workflowId: _step.workflowId,
|
|
41
|
-
inputSchema: _step.inputSchema ?
|
|
42
|
-
outputSchema: _step.outputSchema ?
|
|
41
|
+
inputSchema: _step.inputSchema ? chunkHISYIDYH_cjs.stringify(chunkHISYIDYH_cjs.esm_default(_step.inputSchema)) : void 0,
|
|
42
|
+
outputSchema: _step.outputSchema ? chunkHISYIDYH_cjs.stringify(chunkHISYIDYH_cjs.esm_default(_step.outputSchema)) : void 0
|
|
43
43
|
};
|
|
44
44
|
return acc2;
|
|
45
45
|
}, {})
|
|
@@ -66,15 +66,15 @@ async function getLegacyWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
66
66
|
serializedStepGraph: workflow.serializedStepGraph,
|
|
67
67
|
serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
|
|
68
68
|
name: workflow.name,
|
|
69
|
-
triggerSchema: workflow.triggerSchema ?
|
|
69
|
+
triggerSchema: workflow.triggerSchema ? chunkHISYIDYH_cjs.stringify(chunkHISYIDYH_cjs.esm_default(workflow.triggerSchema)) : void 0,
|
|
70
70
|
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
71
71
|
const _step = step;
|
|
72
72
|
acc[key] = {
|
|
73
73
|
id: _step.id,
|
|
74
74
|
description: _step.description,
|
|
75
75
|
workflowId: _step.workflowId,
|
|
76
|
-
inputSchema: _step.inputSchema ?
|
|
77
|
-
outputSchema: _step.outputSchema ?
|
|
76
|
+
inputSchema: _step.inputSchema ? chunkHISYIDYH_cjs.stringify(chunkHISYIDYH_cjs.esm_default(_step.inputSchema)) : void 0,
|
|
77
|
+
outputSchema: _step.outputSchema ? chunkHISYIDYH_cjs.stringify(chunkHISYIDYH_cjs.esm_default(_step.outputSchema)) : void 0
|
|
78
78
|
};
|
|
79
79
|
return acc;
|
|
80
80
|
}, {})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { stringify, esm_default } from './chunk-
|
|
1
|
+
import { stringify, esm_default } from './chunk-36BLNJHS.js';
|
|
2
2
|
import { validateBody } from './chunk-RSEO4XPX.js';
|
|
3
3
|
import { handleError } from './chunk-LF7P5PLR.js';
|
|
4
4
|
import { HTTPException } from './chunk-LCM566I4.js';
|
|
@@ -13,7 +13,8 @@ __export(agents_exports, {
|
|
|
13
13
|
getAgentsHandler: () => getAgentsHandler,
|
|
14
14
|
getEvalsByAgentIdHandler: () => getEvalsByAgentIdHandler,
|
|
15
15
|
getLiveEvalsByAgentIdHandler: () => getLiveEvalsByAgentIdHandler,
|
|
16
|
-
streamGenerateHandler: () => streamGenerateHandler
|
|
16
|
+
streamGenerateHandler: () => streamGenerateHandler,
|
|
17
|
+
streamVNextGenerateHandler: () => streamVNextGenerateHandler
|
|
17
18
|
});
|
|
18
19
|
async function getAgentsHandler({ mastra, runtimeContext }) {
|
|
19
20
|
try {
|
|
@@ -266,5 +267,33 @@ async function streamGenerateHandler({
|
|
|
266
267
|
return handleError(error, "error streaming agent response");
|
|
267
268
|
}
|
|
268
269
|
}
|
|
270
|
+
function streamVNextGenerateHandler({
|
|
271
|
+
mastra,
|
|
272
|
+
runtimeContext,
|
|
273
|
+
agentId,
|
|
274
|
+
body,
|
|
275
|
+
abortSignal
|
|
276
|
+
}) {
|
|
277
|
+
try {
|
|
278
|
+
const agent = mastra.getAgent(agentId);
|
|
279
|
+
if (!agent) {
|
|
280
|
+
throw new HTTPException(404, { message: "Agent not found" });
|
|
281
|
+
}
|
|
282
|
+
const { messages, runtimeContext: agentRuntimeContext, ...rest } = body;
|
|
283
|
+
const finalRuntimeContext = new RuntimeContext([
|
|
284
|
+
...Array.from(runtimeContext.entries()),
|
|
285
|
+
...Array.from(Object.entries(agentRuntimeContext ?? {}))
|
|
286
|
+
]);
|
|
287
|
+
validateBody({ messages });
|
|
288
|
+
const streamResult = agent.streamVNext(messages, {
|
|
289
|
+
...rest,
|
|
290
|
+
runtimeContext: finalRuntimeContext,
|
|
291
|
+
abortSignal
|
|
292
|
+
});
|
|
293
|
+
return streamResult;
|
|
294
|
+
} catch (error) {
|
|
295
|
+
return handleError(error, "error streaming agent response");
|
|
296
|
+
}
|
|
297
|
+
}
|
|
269
298
|
|
|
270
|
-
export { agents_exports, generateHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, streamGenerateHandler };
|
|
299
|
+
export { agents_exports, generateHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, streamGenerateHandler, streamVNextGenerateHandler };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { stringify, esm_default } from './chunk-
|
|
1
|
+
import { stringify, esm_default } from './chunk-36BLNJHS.js';
|
|
2
2
|
import { validateBody } from './chunk-RSEO4XPX.js';
|
|
3
3
|
import { handleError } from './chunk-LF7P5PLR.js';
|
|
4
4
|
import { HTTPException } from './chunk-LCM566I4.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { stringify, esm_default } from './chunk-
|
|
1
|
+
import { stringify, esm_default } from './chunk-36BLNJHS.js';
|
|
2
2
|
import { handleError } from './chunk-LF7P5PLR.js';
|
|
3
3
|
import { HTTPException } from './chunk-LCM566I4.js';
|
|
4
4
|
import { __export } from './chunk-MLKGABMK.js';
|
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkI5JKUCGE_cjs = require('../../chunk-I5JKUCGE.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "generateHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkI5JKUCGE_cjs.generateHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "getAgentByIdHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkI5JKUCGE_cjs.getAgentByIdHandler; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getAgentsHandler", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkI5JKUCGE_cjs.getAgentsHandler; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getEvalsByAgentIdHandler", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkI5JKUCGE_cjs.getEvalsByAgentIdHandler; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "getLiveEvalsByAgentIdHandler", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkI5JKUCGE_cjs.getLiveEvalsByAgentIdHandler; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "streamGenerateHandler", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkI5JKUCGE_cjs.streamGenerateHandler; }
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "streamVNextGenerateHandler", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return chunkI5JKUCGE_cjs.streamVNextGenerateHandler; }
|
|
30
34
|
});
|
|
@@ -4,3 +4,4 @@ export { getEvalsByAgentIdHandler } from '../../_tsup-dts-rollup.cjs';
|
|
|
4
4
|
export { getLiveEvalsByAgentIdHandler } from '../../_tsup-dts-rollup.cjs';
|
|
5
5
|
export { generateHandler } from '../../_tsup-dts-rollup.cjs';
|
|
6
6
|
export { streamGenerateHandler } from '../../_tsup-dts-rollup.cjs';
|
|
7
|
+
export { streamVNextGenerateHandler } from '../../_tsup-dts-rollup.cjs';
|
|
@@ -4,3 +4,4 @@ export { getEvalsByAgentIdHandler } from '../../_tsup-dts-rollup.js';
|
|
|
4
4
|
export { getLiveEvalsByAgentIdHandler } from '../../_tsup-dts-rollup.js';
|
|
5
5
|
export { generateHandler } from '../../_tsup-dts-rollup.js';
|
|
6
6
|
export { streamGenerateHandler } from '../../_tsup-dts-rollup.js';
|
|
7
|
+
export { streamVNextGenerateHandler } from '../../_tsup-dts-rollup.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { generateHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, streamGenerateHandler } from '../../chunk-
|
|
1
|
+
export { generateHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, streamGenerateHandler, streamVNextGenerateHandler } from '../../chunk-VTTN2FW3.js';
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkUCV4247U_cjs = require('../../chunk-UCV4247U.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "createLegacyWorkflowRunHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkUCV4247U_cjs.createLegacyWorkflowRunHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "getLegacyWorkflowByIdHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkUCV4247U_cjs.getLegacyWorkflowByIdHandler; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getLegacyWorkflowRunHandler", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkUCV4247U_cjs.getLegacyWorkflowRunHandler; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getLegacyWorkflowRunsHandler", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkUCV4247U_cjs.getLegacyWorkflowRunsHandler; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "getLegacyWorkflowsHandler", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkUCV4247U_cjs.getLegacyWorkflowsHandler; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "resumeAsyncLegacyWorkflowHandler", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkUCV4247U_cjs.resumeAsyncLegacyWorkflowHandler; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "resumeLegacyWorkflowHandler", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkUCV4247U_cjs.resumeLegacyWorkflowHandler; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "startAsyncLegacyWorkflowHandler", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkUCV4247U_cjs.startAsyncLegacyWorkflowHandler; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "startLegacyWorkflowRunHandler", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkUCV4247U_cjs.startLegacyWorkflowRunHandler; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "watchLegacyWorkflowHandler", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkUCV4247U_cjs.watchLegacyWorkflowHandler; }
|
|
46
46
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createLegacyWorkflowRunHandler, getLegacyWorkflowByIdHandler, getLegacyWorkflowRunHandler, getLegacyWorkflowRunsHandler, getLegacyWorkflowsHandler, resumeAsyncLegacyWorkflowHandler, resumeLegacyWorkflowHandler, startAsyncLegacyWorkflowHandler, startLegacyWorkflowRunHandler, watchLegacyWorkflowHandler } from '../../chunk-
|
|
1
|
+
export { createLegacyWorkflowRunHandler, getLegacyWorkflowByIdHandler, getLegacyWorkflowRunHandler, getLegacyWorkflowRunsHandler, getLegacyWorkflowsHandler, resumeAsyncLegacyWorkflowHandler, resumeLegacyWorkflowHandler, startAsyncLegacyWorkflowHandler, startLegacyWorkflowRunHandler, watchLegacyWorkflowHandler } from '../../chunk-ZYAFP2AV.js';
|
|
@@ -1,50 +1,58 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkTTPJHP42_cjs = require('../../chunk-TTPJHP42.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "createThreadHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkTTPJHP42_cjs.createThreadHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "deleteThreadHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkTTPJHP42_cjs.deleteThreadHandler; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "getMemoryConfigHandler", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkTTPJHP42_cjs.getMemoryConfigHandler; }
|
|
14
18
|
});
|
|
15
19
|
Object.defineProperty(exports, "getMemoryStatusHandler", {
|
|
16
20
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkTTPJHP42_cjs.getMemoryStatusHandler; }
|
|
18
22
|
});
|
|
19
23
|
Object.defineProperty(exports, "getMessagesHandler", {
|
|
20
24
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkTTPJHP42_cjs.getMessagesHandler; }
|
|
22
26
|
});
|
|
23
27
|
Object.defineProperty(exports, "getMessagesPaginatedHandler", {
|
|
24
28
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkTTPJHP42_cjs.getMessagesPaginatedHandler; }
|
|
26
30
|
});
|
|
27
31
|
Object.defineProperty(exports, "getThreadByIdHandler", {
|
|
28
32
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkTTPJHP42_cjs.getThreadByIdHandler; }
|
|
30
34
|
});
|
|
31
35
|
Object.defineProperty(exports, "getThreadsHandler", {
|
|
32
36
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkTTPJHP42_cjs.getThreadsHandler; }
|
|
34
38
|
});
|
|
35
39
|
Object.defineProperty(exports, "getWorkingMemoryHandler", {
|
|
36
40
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkTTPJHP42_cjs.getWorkingMemoryHandler; }
|
|
38
42
|
});
|
|
39
43
|
Object.defineProperty(exports, "saveMessagesHandler", {
|
|
40
44
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkTTPJHP42_cjs.saveMessagesHandler; }
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports, "searchMemoryHandler", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () { return chunkTTPJHP42_cjs.searchMemoryHandler; }
|
|
42
50
|
});
|
|
43
51
|
Object.defineProperty(exports, "updateThreadHandler", {
|
|
44
52
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkTTPJHP42_cjs.updateThreadHandler; }
|
|
46
54
|
});
|
|
47
55
|
Object.defineProperty(exports, "updateWorkingMemoryHandler", {
|
|
48
56
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkTTPJHP42_cjs.updateWorkingMemoryHandler; }
|
|
50
58
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { getMemoryStatusHandler } from '../../_tsup-dts-rollup.cjs';
|
|
2
|
+
export { getMemoryConfigHandler } from '../../_tsup-dts-rollup.cjs';
|
|
2
3
|
export { getThreadsHandler } from '../../_tsup-dts-rollup.cjs';
|
|
3
4
|
export { getThreadByIdHandler } from '../../_tsup-dts-rollup.cjs';
|
|
4
5
|
export { saveMessagesHandler } from '../../_tsup-dts-rollup.cjs';
|
|
@@ -9,3 +10,4 @@ export { getMessagesPaginatedHandler } from '../../_tsup-dts-rollup.cjs';
|
|
|
9
10
|
export { getMessagesHandler } from '../../_tsup-dts-rollup.cjs';
|
|
10
11
|
export { getWorkingMemoryHandler } from '../../_tsup-dts-rollup.cjs';
|
|
11
12
|
export { updateWorkingMemoryHandler } from '../../_tsup-dts-rollup.cjs';
|
|
13
|
+
export { searchMemoryHandler } from '../../_tsup-dts-rollup.cjs';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { getMemoryStatusHandler } from '../../_tsup-dts-rollup.js';
|
|
2
|
+
export { getMemoryConfigHandler } from '../../_tsup-dts-rollup.js';
|
|
2
3
|
export { getThreadsHandler } from '../../_tsup-dts-rollup.js';
|
|
3
4
|
export { getThreadByIdHandler } from '../../_tsup-dts-rollup.js';
|
|
4
5
|
export { saveMessagesHandler } from '../../_tsup-dts-rollup.js';
|
|
@@ -9,3 +10,4 @@ export { getMessagesPaginatedHandler } from '../../_tsup-dts-rollup.js';
|
|
|
9
10
|
export { getMessagesHandler } from '../../_tsup-dts-rollup.js';
|
|
10
11
|
export { getWorkingMemoryHandler } from '../../_tsup-dts-rollup.js';
|
|
11
12
|
export { updateWorkingMemoryHandler } from '../../_tsup-dts-rollup.js';
|
|
13
|
+
export { searchMemoryHandler } from '../../_tsup-dts-rollup.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createThreadHandler, deleteThreadHandler, getMemoryStatusHandler, getMessagesHandler, getMessagesPaginatedHandler, getThreadByIdHandler, getThreadsHandler, getWorkingMemoryHandler, saveMessagesHandler, updateThreadHandler, updateWorkingMemoryHandler } from '../../chunk-
|
|
1
|
+
export { createThreadHandler, deleteThreadHandler, getMemoryConfigHandler, getMemoryStatusHandler, getMessagesHandler, getMessagesPaginatedHandler, getThreadByIdHandler, getThreadsHandler, getWorkingMemoryHandler, saveMessagesHandler, searchMemoryHandler, updateThreadHandler, updateWorkingMemoryHandler } from '../../chunk-R3I7AJVL.js';
|