@mastra/server 0.10.6-alpha.1 → 0.10.6-alpha.3

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.
@@ -239,11 +239,18 @@ async function streamGenerateHandler({
239
239
  resourceId: finalResourceId,
240
240
  runtimeContext: finalRuntimeContext
241
241
  });
242
- const streamResponse = rest.output ? streamResult.toTextStreamResponse() : streamResult.toDataStreamResponse({
242
+ const streamResponse = rest.output ? streamResult.toTextStreamResponse({
243
+ headers: {
244
+ "Transfer-Encoding": "chunked"
245
+ }
246
+ }) : streamResult.toDataStreamResponse({
243
247
  sendUsage: true,
244
248
  sendReasoning: true,
245
249
  getErrorMessage: (error) => {
246
250
  return `An error occurred while processing your request. ${error instanceof Error ? error.message : JSON.stringify(error)}`;
251
+ },
252
+ headers: {
253
+ "Transfer-Encoding": "chunked"
247
254
  }
248
255
  });
249
256
  return streamResponse;
@@ -241,11 +241,18 @@ async function streamGenerateHandler({
241
241
  resourceId: finalResourceId,
242
242
  runtimeContext: finalRuntimeContext
243
243
  });
244
- const streamResponse = rest.output ? streamResult.toTextStreamResponse() : streamResult.toDataStreamResponse({
244
+ const streamResponse = rest.output ? streamResult.toTextStreamResponse({
245
+ headers: {
246
+ "Transfer-Encoding": "chunked"
247
+ }
248
+ }) : streamResult.toDataStreamResponse({
245
249
  sendUsage: true,
246
250
  sendReasoning: true,
247
251
  getErrorMessage: (error) => {
248
252
  return `An error occurred while processing your request. ${error instanceof Error ? error.message : JSON.stringify(error)}`;
253
+ },
254
+ headers: {
255
+ "Transfer-Encoding": "chunked"
249
256
  }
250
257
  });
251
258
  return streamResponse;
@@ -21,10 +21,11 @@ async function getSpeakersHandler({ mastra, agentId }) {
21
21
  if (!agent) {
22
22
  throw new HTTPException(404, { message: "Agent not found" });
23
23
  }
24
- if (!agent.voice) {
24
+ const voice = await agent.getVoice();
25
+ if (!voice) {
25
26
  throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
26
27
  }
27
- const speakers = await agent.voice.getSpeakers();
28
+ const speakers = await voice.getSpeakers();
28
29
  return speakers;
29
30
  } catch (error) {
30
31
  return handleError(error, "Error getting speakers");
@@ -46,10 +47,11 @@ async function generateSpeechHandler({
46
47
  if (!agent) {
47
48
  throw new HTTPException(404, { message: "Agent not found" });
48
49
  }
49
- if (!agent.voice) {
50
+ const voice = await agent.getVoice();
51
+ if (!voice) {
50
52
  throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
51
53
  }
52
- const audioStream = await agent.voice.speak(body.text, { speaker: body.speakerId });
54
+ const audioStream = await voice.speak(body.text, { speaker: body.speakerId });
53
55
  if (!audioStream) {
54
56
  throw new HTTPException(500, { message: "Failed to generate speech" });
55
57
  }
@@ -74,13 +76,14 @@ async function transcribeSpeechHandler({
74
76
  if (!agent) {
75
77
  throw new HTTPException(404, { message: "Agent not found" });
76
78
  }
77
- if (!agent.voice) {
79
+ const voice = await agent.getVoice();
80
+ if (!voice) {
78
81
  throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
79
82
  }
80
83
  const audioStream = new Readable();
81
84
  audioStream.push(body.audioData);
82
85
  audioStream.push(null);
83
- const text = await agent.voice.listen(audioStream, body.options);
86
+ const text = await voice.listen(audioStream, body.options);
84
87
  return { text };
85
88
  } catch (error) {
86
89
  return handleError(error, "Error transcribing speech");
@@ -95,10 +98,11 @@ async function getListenerHandler({ mastra, agentId }) {
95
98
  if (!agent) {
96
99
  throw new HTTPException(404, { message: "Agent not found" });
97
100
  }
98
- if (!agent.voice) {
101
+ const voice = await agent.getVoice();
102
+ if (!voice) {
99
103
  throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
100
104
  }
101
- const listeners = await agent.voice.getListener();
105
+ const listeners = await voice.getListener();
102
106
  return listeners;
103
107
  } catch (error) {
104
108
  return handleError(error, "Error getting listeners");
@@ -23,10 +23,11 @@ async function getSpeakersHandler({ mastra, agentId }) {
23
23
  if (!agent) {
24
24
  throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
25
25
  }
26
- if (!agent.voice) {
26
+ const voice = await agent.getVoice();
27
+ if (!voice) {
27
28
  throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
28
29
  }
29
- const speakers = await agent.voice.getSpeakers();
30
+ const speakers = await voice.getSpeakers();
30
31
  return speakers;
31
32
  } catch (error) {
32
33
  return chunk64U3UDTH_cjs.handleError(error, "Error getting speakers");
@@ -48,10 +49,11 @@ async function generateSpeechHandler({
48
49
  if (!agent) {
49
50
  throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
50
51
  }
51
- if (!agent.voice) {
52
+ const voice = await agent.getVoice();
53
+ if (!voice) {
52
54
  throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
53
55
  }
54
- const audioStream = await agent.voice.speak(body.text, { speaker: body.speakerId });
56
+ const audioStream = await voice.speak(body.text, { speaker: body.speakerId });
55
57
  if (!audioStream) {
56
58
  throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: "Failed to generate speech" });
57
59
  }
@@ -76,13 +78,14 @@ async function transcribeSpeechHandler({
76
78
  if (!agent) {
77
79
  throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
78
80
  }
79
- if (!agent.voice) {
81
+ const voice = await agent.getVoice();
82
+ if (!voice) {
80
83
  throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
81
84
  }
82
85
  const audioStream = new stream.Readable();
83
86
  audioStream.push(body.audioData);
84
87
  audioStream.push(null);
85
- const text = await agent.voice.listen(audioStream, body.options);
88
+ const text = await voice.listen(audioStream, body.options);
86
89
  return { text };
87
90
  } catch (error) {
88
91
  return chunk64U3UDTH_cjs.handleError(error, "Error transcribing speech");
@@ -97,10 +100,11 @@ async function getListenerHandler({ mastra, agentId }) {
97
100
  if (!agent) {
98
101
  throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
99
102
  }
100
- if (!agent.voice) {
103
+ const voice = await agent.getVoice();
104
+ if (!voice) {
101
105
  throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
102
106
  }
103
- const listeners = await agent.voice.getListener();
107
+ const listeners = await voice.getListener();
104
108
  return listeners;
105
109
  } catch (error) {
106
110
  return chunk64U3UDTH_cjs.handleError(error, "Error getting listeners");
@@ -1,30 +1,30 @@
1
1
  'use strict';
2
2
 
3
- var chunk42YJ2YVD_cjs = require('../../chunk-42YJ2YVD.cjs');
3
+ var chunkC75ZRJKD_cjs = require('../../chunk-C75ZRJKD.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "generateHandler", {
8
8
  enumerable: true,
9
- get: function () { return chunk42YJ2YVD_cjs.generateHandler; }
9
+ get: function () { return chunkC75ZRJKD_cjs.generateHandler; }
10
10
  });
11
11
  Object.defineProperty(exports, "getAgentByIdHandler", {
12
12
  enumerable: true,
13
- get: function () { return chunk42YJ2YVD_cjs.getAgentByIdHandler; }
13
+ get: function () { return chunkC75ZRJKD_cjs.getAgentByIdHandler; }
14
14
  });
15
15
  Object.defineProperty(exports, "getAgentsHandler", {
16
16
  enumerable: true,
17
- get: function () { return chunk42YJ2YVD_cjs.getAgentsHandler; }
17
+ get: function () { return chunkC75ZRJKD_cjs.getAgentsHandler; }
18
18
  });
19
19
  Object.defineProperty(exports, "getEvalsByAgentIdHandler", {
20
20
  enumerable: true,
21
- get: function () { return chunk42YJ2YVD_cjs.getEvalsByAgentIdHandler; }
21
+ get: function () { return chunkC75ZRJKD_cjs.getEvalsByAgentIdHandler; }
22
22
  });
23
23
  Object.defineProperty(exports, "getLiveEvalsByAgentIdHandler", {
24
24
  enumerable: true,
25
- get: function () { return chunk42YJ2YVD_cjs.getLiveEvalsByAgentIdHandler; }
25
+ get: function () { return chunkC75ZRJKD_cjs.getLiveEvalsByAgentIdHandler; }
26
26
  });
27
27
  Object.defineProperty(exports, "streamGenerateHandler", {
28
28
  enumerable: true,
29
- get: function () { return chunk42YJ2YVD_cjs.streamGenerateHandler; }
29
+ get: function () { return chunkC75ZRJKD_cjs.streamGenerateHandler; }
30
30
  });
@@ -1 +1 @@
1
- export { generateHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, streamGenerateHandler } from '../../chunk-O2YAAFY3.js';
1
+ export { generateHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, streamGenerateHandler } from '../../chunk-4O23XCE5.js';
@@ -1,22 +1,22 @@
1
1
  'use strict';
2
2
 
3
- var chunkCMMOIUFC_cjs = require('../../chunk-CMMOIUFC.cjs');
3
+ var chunkWJY57THV_cjs = require('../../chunk-WJY57THV.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "generateSpeechHandler", {
8
8
  enumerable: true,
9
- get: function () { return chunkCMMOIUFC_cjs.generateSpeechHandler; }
9
+ get: function () { return chunkWJY57THV_cjs.generateSpeechHandler; }
10
10
  });
11
11
  Object.defineProperty(exports, "getListenerHandler", {
12
12
  enumerable: true,
13
- get: function () { return chunkCMMOIUFC_cjs.getListenerHandler; }
13
+ get: function () { return chunkWJY57THV_cjs.getListenerHandler; }
14
14
  });
15
15
  Object.defineProperty(exports, "getSpeakersHandler", {
16
16
  enumerable: true,
17
- get: function () { return chunkCMMOIUFC_cjs.getSpeakersHandler; }
17
+ get: function () { return chunkWJY57THV_cjs.getSpeakersHandler; }
18
18
  });
19
19
  Object.defineProperty(exports, "transcribeSpeechHandler", {
20
20
  enumerable: true,
21
- get: function () { return chunkCMMOIUFC_cjs.transcribeSpeechHandler; }
21
+ get: function () { return chunkWJY57THV_cjs.transcribeSpeechHandler; }
22
22
  });
@@ -1 +1 @@
1
- export { generateSpeechHandler, getListenerHandler, getSpeakersHandler, transcribeSpeechHandler } from '../../chunk-CP55EVBK.js';
1
+ export { generateSpeechHandler, getListenerHandler, getSpeakersHandler, transcribeSpeechHandler } from '../../chunk-R5VGYBV6.js';
@@ -4,10 +4,10 @@ var chunkVPNDC2DI_cjs = require('../chunk-VPNDC2DI.cjs');
4
4
  var chunkB4MQFJ7G_cjs = require('../chunk-B4MQFJ7G.cjs');
5
5
  var chunkNGURCFEJ_cjs = require('../chunk-NGURCFEJ.cjs');
6
6
  var chunkBNEY4P4P_cjs = require('../chunk-BNEY4P4P.cjs');
7
- var chunkCMMOIUFC_cjs = require('../chunk-CMMOIUFC.cjs');
7
+ var chunkWJY57THV_cjs = require('../chunk-WJY57THV.cjs');
8
8
  var chunkFRXZL32L_cjs = require('../chunk-FRXZL32L.cjs');
9
9
  var chunkSDPGVWQJ_cjs = require('../chunk-SDPGVWQJ.cjs');
10
- var chunk42YJ2YVD_cjs = require('../chunk-42YJ2YVD.cjs');
10
+ var chunkC75ZRJKD_cjs = require('../chunk-C75ZRJKD.cjs');
11
11
  var chunkWE32JG64_cjs = require('../chunk-WE32JG64.cjs');
12
12
  var chunkIMBY5XUG_cjs = require('../chunk-IMBY5XUG.cjs');
13
13
  var chunk6TJSHFCJ_cjs = require('../chunk-6TJSHFCJ.cjs');
@@ -32,7 +32,7 @@ Object.defineProperty(exports, "vector", {
32
32
  });
33
33
  Object.defineProperty(exports, "voice", {
34
34
  enumerable: true,
35
- get: function () { return chunkCMMOIUFC_cjs.voice_exports; }
35
+ get: function () { return chunkWJY57THV_cjs.voice_exports; }
36
36
  });
37
37
  Object.defineProperty(exports, "workflows", {
38
38
  enumerable: true,
@@ -44,7 +44,7 @@ Object.defineProperty(exports, "a2a", {
44
44
  });
45
45
  Object.defineProperty(exports, "agents", {
46
46
  enumerable: true,
47
- get: function () { return chunk42YJ2YVD_cjs.agents_exports; }
47
+ get: function () { return chunkC75ZRJKD_cjs.agents_exports; }
48
48
  });
49
49
  Object.defineProperty(exports, "legacyWorkflows", {
50
50
  enumerable: true,
@@ -2,10 +2,10 @@ export { network_exports as network } from '../chunk-C7564HUT.js';
2
2
  export { telemetry_exports as telemetry } from '../chunk-BFOA2QQY.js';
3
3
  export { tools_exports as tools } from '../chunk-2HXKRRNS.js';
4
4
  export { vector_exports as vector } from '../chunk-55DOQLP6.js';
5
- export { voice_exports as voice } from '../chunk-CP55EVBK.js';
5
+ export { voice_exports as voice } from '../chunk-R5VGYBV6.js';
6
6
  export { workflows_exports as workflows } from '../chunk-JKTNRUKY.js';
7
7
  export { a2a_exports as a2a } from '../chunk-GHC4YV6R.js';
8
- export { agents_exports as agents } from '../chunk-O2YAAFY3.js';
8
+ export { agents_exports as agents } from '../chunk-4O23XCE5.js';
9
9
  export { legacyWorkflows_exports as legacyWorkflows } from '../chunk-CLYX4KLH.js';
10
10
  export { logs_exports as logs } from '../chunk-QLG2PFHE.js';
11
11
  export { memory_exports as memory } from '../chunk-I7KJZNX5.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/server",
3
- "version": "0.10.6-alpha.1",
3
+ "version": "0.10.6-alpha.3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -60,7 +60,7 @@
60
60
  "zod": "^3.25.57",
61
61
  "zod-to-json-schema": "^3.24.5",
62
62
  "@internal/lint": "0.0.12",
63
- "@mastra/core": "0.10.6-alpha.1"
63
+ "@mastra/core": "0.10.6-alpha.3"
64
64
  },
65
65
  "scripts": {
66
66
  "build": "tsup src/index.ts src/server/handlers.ts src/server/handlers/*.ts !src/server/handlers/*.test.ts --format esm,cjs --clean --experimental-dts --treeshake=smallest --splitting",