@mastra/server 0.0.0-bundle-dynamic-imports-20250424001248 → 0.0.0-cli-debug-20250611094457
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/README.md +48 -135
- package/dist/_tsup-dts-rollup.d.cts +331 -42
- package/dist/_tsup-dts-rollup.d.ts +331 -42
- package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
- package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
- package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
- package/dist/chunk-6F2H7Y45.js +255 -0
- package/dist/{chunk-2FJURXCL.cjs → chunk-6TJSHFCJ.cjs} +44 -36
- package/dist/chunk-75ZPJI57.cjs +9 -0
- package/dist/chunk-7IBZ4L35.js +344 -0
- package/dist/{chunk-7IWQE76Z.cjs → chunk-B4MQFJ7G.cjs} +16 -10
- package/dist/{chunk-WTHDCRMY.js → chunk-BFOA2QQY.js} +12 -6
- package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
- package/dist/{chunk-RE6YL32K.js → chunk-C7564HUT.js} +52 -30
- package/dist/{chunk-55HTWX4C.cjs → chunk-CMMOIUFC.cjs} +40 -19
- package/dist/{chunk-Q6SHQECN.js → chunk-CP55EVBK.js} +24 -4
- package/dist/chunk-GHC4YV6R.js +504 -0
- package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
- package/dist/{chunk-5JNVY6DU.js → chunk-HYP7B2TL.js} +7 -5
- package/dist/{chunk-RBQASTUP.js → chunk-I7KJZNX5.js} +14 -6
- package/dist/chunk-IMBY5XUG.cjs +86 -0
- package/dist/chunk-JEWNMAYQ.cjs +263 -0
- package/dist/chunk-JKF6PRPU.cjs +357 -0
- package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
- package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
- package/dist/chunk-QLG2PFHE.js +81 -0
- package/dist/chunk-SDPGVWQJ.cjs +512 -0
- package/dist/{chunk-LFOBHRFO.js → chunk-TEZOEGR4.js} +69 -54
- package/dist/{chunk-D3G23FP3.cjs → chunk-TJO277H7.cjs} +24 -22
- package/dist/chunk-UZ7FJ66C.cjs +332 -0
- package/dist/{chunk-FPIWDH5Y.cjs → chunk-VPNDC2DI.cjs} +62 -40
- package/dist/chunk-WKWHYFX4.js +2001 -0
- package/dist/chunk-XUGQSVZ4.cjs +2004 -0
- package/dist/server/handlers/a2a.cjs +30 -0
- package/dist/server/handlers/a2a.d.cts +6 -0
- package/dist/server/handlers/a2a.d.ts +6 -0
- package/dist/server/handlers/a2a.js +1 -0
- package/dist/server/handlers/agents.cjs +7 -7
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/error.cjs +2 -2
- package/dist/server/handlers/error.js +1 -1
- package/dist/server/handlers/legacyWorkflows.cjs +46 -0
- package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
- package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
- package/dist/server/handlers/legacyWorkflows.js +1 -0
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +9 -9
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/network.cjs +5 -5
- package/dist/server/handlers/network.js +1 -1
- package/dist/server/handlers/telemetry.cjs +3 -3
- package/dist/server/handlers/telemetry.js +1 -1
- package/dist/server/handlers/tools.cjs +5 -5
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/utils.cjs +2 -2
- package/dist/server/handlers/utils.js +1 -1
- package/dist/server/handlers/vector.cjs +7 -7
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/voice.cjs +8 -4
- package/dist/server/handlers/voice.d.cts +1 -0
- package/dist/server/handlers/voice.d.ts +1 -0
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +17 -13
- package/dist/server/handlers/workflows.d.cts +3 -2
- package/dist/server/handlers/workflows.d.ts +3 -2
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +33 -23
- package/dist/server/handlers.d.cts +2 -0
- package/dist/server/handlers.d.ts +2 -0
- package/dist/server/handlers.js +11 -9
- package/package.json +12 -10
- package/dist/chunk-3EJZQ6TQ.js +0 -49
- package/dist/chunk-5SWCVTNL.cjs +0 -5579
- package/dist/chunk-HCOPJZ4A.cjs +0 -164
- package/dist/chunk-OMN3UI6X.js +0 -5576
- package/dist/chunk-R4J7XQYU.js +0 -156
- package/dist/chunk-SKBVVI24.cjs +0 -54
- package/dist/chunk-TZK63M5N.cjs +0 -317
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { validateBody } from './chunk-
|
|
2
|
-
import { handleError } from './chunk-
|
|
3
|
-
import {
|
|
1
|
+
import { validateBody } from './chunk-H5PTF3Y4.js';
|
|
2
|
+
import { handleError } from './chunk-M5ABIP7D.js';
|
|
3
|
+
import { HTTPException } from './chunk-NYN7KFXL.js';
|
|
4
|
+
import { __export } from './chunk-MLKGABMK.js';
|
|
4
5
|
|
|
5
6
|
// src/server/handlers/network.ts
|
|
6
7
|
var network_exports = {};
|
|
@@ -10,33 +11,48 @@ __export(network_exports, {
|
|
|
10
11
|
getNetworksHandler: () => getNetworksHandler,
|
|
11
12
|
streamGenerateHandler: () => streamGenerateHandler
|
|
12
13
|
});
|
|
13
|
-
async function getNetworksHandler({
|
|
14
|
+
async function getNetworksHandler({
|
|
15
|
+
mastra,
|
|
16
|
+
runtimeContext
|
|
17
|
+
}) {
|
|
14
18
|
try {
|
|
15
19
|
const networks = mastra.getNetworks();
|
|
16
|
-
const serializedNetworks =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
const serializedNetworks = await Promise.all(
|
|
21
|
+
networks.map(async (network) => {
|
|
22
|
+
const routingAgent = network.getRoutingAgent();
|
|
23
|
+
const routingLLM = await routingAgent.getLLM({ runtimeContext });
|
|
24
|
+
const agents = network.getAgents();
|
|
25
|
+
return {
|
|
26
|
+
id: network.formatAgentId(routingAgent.name),
|
|
27
|
+
name: routingAgent.name,
|
|
28
|
+
instructions: routingAgent.instructions,
|
|
29
|
+
agents: await Promise.all(
|
|
30
|
+
agents.map(async (agent) => {
|
|
31
|
+
const llm = await agent.getLLM({ runtimeContext });
|
|
32
|
+
return {
|
|
33
|
+
name: agent.name,
|
|
34
|
+
provider: llm?.getProvider(),
|
|
35
|
+
modelId: llm?.getModelId()
|
|
36
|
+
};
|
|
37
|
+
})
|
|
38
|
+
),
|
|
39
|
+
routingModel: {
|
|
40
|
+
provider: routingLLM?.getProvider(),
|
|
41
|
+
modelId: routingLLM?.getModelId()
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
})
|
|
45
|
+
);
|
|
34
46
|
return serializedNetworks;
|
|
35
47
|
} catch (error) {
|
|
36
48
|
return handleError(error, "Error getting networks");
|
|
37
49
|
}
|
|
38
50
|
}
|
|
39
|
-
async function getNetworkByIdHandler({
|
|
51
|
+
async function getNetworkByIdHandler({
|
|
52
|
+
mastra,
|
|
53
|
+
networkId,
|
|
54
|
+
runtimeContext
|
|
55
|
+
}) {
|
|
40
56
|
try {
|
|
41
57
|
const networks = mastra.getNetworks();
|
|
42
58
|
const network = networks.find((network2) => {
|
|
@@ -47,19 +63,25 @@ async function getNetworkByIdHandler({ mastra, networkId }) {
|
|
|
47
63
|
throw new HTTPException(404, { message: "Network not found" });
|
|
48
64
|
}
|
|
49
65
|
const routingAgent = network.getRoutingAgent();
|
|
66
|
+
const routingLLM = await routingAgent.getLLM({ runtimeContext });
|
|
50
67
|
const agents = network.getAgents();
|
|
51
68
|
const serializedNetwork = {
|
|
52
69
|
id: network.formatAgentId(routingAgent.name),
|
|
53
70
|
name: routingAgent.name,
|
|
54
71
|
instructions: routingAgent.instructions,
|
|
55
|
-
agents:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
72
|
+
agents: await Promise.all(
|
|
73
|
+
agents.map(async (agent) => {
|
|
74
|
+
const llm = await agent.getLLM({ runtimeContext });
|
|
75
|
+
return {
|
|
76
|
+
name: agent.name,
|
|
77
|
+
provider: llm?.getProvider(),
|
|
78
|
+
modelId: llm?.getModelId()
|
|
79
|
+
};
|
|
80
|
+
})
|
|
81
|
+
),
|
|
60
82
|
routingModel: {
|
|
61
|
-
provider:
|
|
62
|
-
modelId:
|
|
83
|
+
provider: routingLLM?.getProvider(),
|
|
84
|
+
modelId: routingLLM?.getModelId()
|
|
63
85
|
}
|
|
64
86
|
};
|
|
65
87
|
return serializedNetwork;
|
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunk57CJTIPW_cjs = require('./chunk-57CJTIPW.cjs');
|
|
4
|
+
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
5
|
+
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
6
|
+
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
6
7
|
var stream = require('stream');
|
|
7
8
|
|
|
8
9
|
// src/server/handlers/voice.ts
|
|
9
10
|
var voice_exports = {};
|
|
10
|
-
|
|
11
|
+
chunk75ZPJI57_cjs.__export(voice_exports, {
|
|
11
12
|
generateSpeechHandler: () => generateSpeechHandler,
|
|
13
|
+
getListenerHandler: () => getListenerHandler,
|
|
12
14
|
getSpeakersHandler: () => getSpeakersHandler,
|
|
13
15
|
transcribeSpeechHandler: () => transcribeSpeechHandler
|
|
14
16
|
});
|
|
15
17
|
async function getSpeakersHandler({ mastra, agentId }) {
|
|
16
18
|
try {
|
|
17
19
|
if (!agentId) {
|
|
18
|
-
throw new
|
|
20
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
|
|
19
21
|
}
|
|
20
22
|
const agent = mastra.getAgent(agentId);
|
|
21
23
|
if (!agent) {
|
|
22
|
-
throw new
|
|
24
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
|
|
23
25
|
}
|
|
24
26
|
if (!agent.voice) {
|
|
25
|
-
throw new
|
|
27
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
26
28
|
}
|
|
27
29
|
const speakers = await agent.voice.getSpeakers();
|
|
28
30
|
return speakers;
|
|
29
31
|
} catch (error) {
|
|
30
|
-
return
|
|
32
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error getting speakers");
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
async function generateSpeechHandler({
|
|
@@ -37,25 +39,25 @@ async function generateSpeechHandler({
|
|
|
37
39
|
}) {
|
|
38
40
|
try {
|
|
39
41
|
if (!agentId) {
|
|
40
|
-
throw new
|
|
42
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
|
|
41
43
|
}
|
|
42
|
-
|
|
44
|
+
chunk57CJTIPW_cjs.validateBody({
|
|
43
45
|
text: body?.text
|
|
44
46
|
});
|
|
45
47
|
const agent = mastra.getAgent(agentId);
|
|
46
48
|
if (!agent) {
|
|
47
|
-
throw new
|
|
49
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
|
|
48
50
|
}
|
|
49
51
|
if (!agent.voice) {
|
|
50
|
-
throw new
|
|
52
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
51
53
|
}
|
|
52
54
|
const audioStream = await agent.voice.speak(body.text, { speaker: body.speakerId });
|
|
53
55
|
if (!audioStream) {
|
|
54
|
-
throw new
|
|
56
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: "Failed to generate speech" });
|
|
55
57
|
}
|
|
56
58
|
return audioStream;
|
|
57
59
|
} catch (error) {
|
|
58
|
-
return
|
|
60
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error generating speech");
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
async function transcribeSpeechHandler({
|
|
@@ -65,17 +67,17 @@ async function transcribeSpeechHandler({
|
|
|
65
67
|
}) {
|
|
66
68
|
try {
|
|
67
69
|
if (!agentId) {
|
|
68
|
-
throw new
|
|
70
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
|
|
69
71
|
}
|
|
70
72
|
if (!body?.audioData) {
|
|
71
|
-
throw new
|
|
73
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Audio data is required" });
|
|
72
74
|
}
|
|
73
75
|
const agent = mastra.getAgent(agentId);
|
|
74
76
|
if (!agent) {
|
|
75
|
-
throw new
|
|
77
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
|
|
76
78
|
}
|
|
77
79
|
if (!agent.voice) {
|
|
78
|
-
throw new
|
|
80
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
79
81
|
}
|
|
80
82
|
const audioStream = new stream.Readable();
|
|
81
83
|
audioStream.push(body.audioData);
|
|
@@ -83,11 +85,30 @@ async function transcribeSpeechHandler({
|
|
|
83
85
|
const text = await agent.voice.listen(audioStream, body.options);
|
|
84
86
|
return { text };
|
|
85
87
|
} catch (error) {
|
|
86
|
-
return
|
|
88
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error transcribing speech");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async function getListenerHandler({ mastra, agentId }) {
|
|
92
|
+
try {
|
|
93
|
+
if (!agentId) {
|
|
94
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
|
|
95
|
+
}
|
|
96
|
+
const agent = mastra.getAgent(agentId);
|
|
97
|
+
if (!agent) {
|
|
98
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
|
|
99
|
+
}
|
|
100
|
+
if (!agent.voice) {
|
|
101
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
102
|
+
}
|
|
103
|
+
const listeners = await agent.voice.getListener();
|
|
104
|
+
return listeners;
|
|
105
|
+
} catch (error) {
|
|
106
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error getting listeners");
|
|
87
107
|
}
|
|
88
108
|
}
|
|
89
109
|
|
|
90
110
|
exports.generateSpeechHandler = generateSpeechHandler;
|
|
111
|
+
exports.getListenerHandler = getListenerHandler;
|
|
91
112
|
exports.getSpeakersHandler = getSpeakersHandler;
|
|
92
113
|
exports.transcribeSpeechHandler = transcribeSpeechHandler;
|
|
93
114
|
exports.voice_exports = voice_exports;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { validateBody } from './chunk-
|
|
2
|
-
import { handleError } from './chunk-
|
|
3
|
-
import {
|
|
1
|
+
import { validateBody } from './chunk-H5PTF3Y4.js';
|
|
2
|
+
import { handleError } from './chunk-M5ABIP7D.js';
|
|
3
|
+
import { HTTPException } from './chunk-NYN7KFXL.js';
|
|
4
|
+
import { __export } from './chunk-MLKGABMK.js';
|
|
4
5
|
import { Readable } from 'stream';
|
|
5
6
|
|
|
6
7
|
// src/server/handlers/voice.ts
|
|
7
8
|
var voice_exports = {};
|
|
8
9
|
__export(voice_exports, {
|
|
9
10
|
generateSpeechHandler: () => generateSpeechHandler,
|
|
11
|
+
getListenerHandler: () => getListenerHandler,
|
|
10
12
|
getSpeakersHandler: () => getSpeakersHandler,
|
|
11
13
|
transcribeSpeechHandler: () => transcribeSpeechHandler
|
|
12
14
|
});
|
|
@@ -84,5 +86,23 @@ async function transcribeSpeechHandler({
|
|
|
84
86
|
return handleError(error, "Error transcribing speech");
|
|
85
87
|
}
|
|
86
88
|
}
|
|
89
|
+
async function getListenerHandler({ mastra, agentId }) {
|
|
90
|
+
try {
|
|
91
|
+
if (!agentId) {
|
|
92
|
+
throw new HTTPException(400, { message: "Agent ID is required" });
|
|
93
|
+
}
|
|
94
|
+
const agent = mastra.getAgent(agentId);
|
|
95
|
+
if (!agent) {
|
|
96
|
+
throw new HTTPException(404, { message: "Agent not found" });
|
|
97
|
+
}
|
|
98
|
+
if (!agent.voice) {
|
|
99
|
+
throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
100
|
+
}
|
|
101
|
+
const listeners = await agent.voice.getListener();
|
|
102
|
+
return listeners;
|
|
103
|
+
} catch (error) {
|
|
104
|
+
return handleError(error, "Error getting listeners");
|
|
105
|
+
}
|
|
106
|
+
}
|
|
87
107
|
|
|
88
|
-
export { generateSpeechHandler, getSpeakersHandler, transcribeSpeechHandler, voice_exports };
|
|
108
|
+
export { generateSpeechHandler, getListenerHandler, getSpeakersHandler, transcribeSpeechHandler, voice_exports };
|