@mastra/server 0.0.0-trigger-playground-ui-package-20250506151043 → 0.0.0-vector-sources-20250516175436

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.
Files changed (70) hide show
  1. package/README.md +48 -135
  2. package/dist/_tsup-dts-rollup.d.cts +161 -13
  3. package/dist/_tsup-dts-rollup.d.ts +161 -13
  4. package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
  5. package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
  6. package/dist/chunk-5SN4U5AC.cjs +508 -0
  7. package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
  8. package/dist/chunk-75ZPJI57.cjs +9 -0
  9. package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
  10. package/dist/{chunk-QJ3AHN64.js → chunk-C7564HUT.js} +4 -3
  11. package/dist/{chunk-4BIX6GMY.cjs → chunk-D4IRYCUI.cjs} +72 -26
  12. package/dist/{chunk-RBQASTUP.js → chunk-DJJIUEL2.js} +13 -5
  13. package/dist/{chunk-3XTEV33Q.js → chunk-EJO45KYT.js} +19 -16
  14. package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
  15. package/dist/{chunk-Q6SHQECN.js → chunk-HFWCEP5S.js} +4 -3
  16. package/dist/{chunk-3EJZQ6TQ.js → chunk-HWZVAG3H.js} +3 -3
  17. package/dist/{chunk-CHFORQ7J.cjs → chunk-I2B73Y4I.cjs} +60 -57
  18. package/dist/chunk-LIVAK2DM.js +2001 -0
  19. package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
  20. package/dist/{chunk-AMVOS7YB.cjs → chunk-MHKNLNAN.cjs} +9 -8
  21. package/dist/{chunk-OWNA6I2H.js → chunk-MIQYDLLM.js} +28 -11
  22. package/dist/chunk-MLKGABMK.js +7 -0
  23. package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
  24. package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
  25. package/dist/{chunk-SKBVVI24.cjs → chunk-OGCNNUHF.cjs} +9 -9
  26. package/dist/{chunk-BPL2CBLV.js → chunk-OR3CIE2H.js} +3 -2
  27. package/dist/chunk-P6SCPDYW.js +500 -0
  28. package/dist/{chunk-5JNVY6DU.js → chunk-TJKLBTFB.js} +20 -8
  29. package/dist/{chunk-M2RXDCPV.cjs → chunk-UCTEMO2Q.cjs} +76 -59
  30. package/dist/{chunk-5YGDYMRB.cjs → chunk-VPNDC2DI.cjs} +14 -13
  31. package/dist/{chunk-Y3SV5XK4.js → chunk-WUC6LSTW.js} +54 -8
  32. package/dist/{chunk-2FJURXCL.cjs → chunk-Y7UWRW5X.cjs} +43 -35
  33. package/dist/{chunk-55HTWX4C.cjs → chunk-YBVOQN4M.cjs} +20 -19
  34. package/dist/chunk-YWLUOY3D.cjs +2004 -0
  35. package/dist/{chunk-D3G23FP3.cjs → chunk-ZE5AAC4I.cjs} +37 -25
  36. package/dist/server/handlers/a2a.cjs +30 -0
  37. package/dist/server/handlers/a2a.d.cts +6 -0
  38. package/dist/server/handlers/a2a.d.ts +6 -0
  39. package/dist/server/handlers/a2a.js +1 -0
  40. package/dist/server/handlers/agents.cjs +7 -7
  41. package/dist/server/handlers/agents.js +1 -1
  42. package/dist/server/handlers/error.cjs +2 -2
  43. package/dist/server/handlers/error.js +1 -1
  44. package/dist/server/handlers/logs.cjs +4 -4
  45. package/dist/server/handlers/logs.js +1 -1
  46. package/dist/server/handlers/memory.cjs +9 -9
  47. package/dist/server/handlers/memory.js +1 -1
  48. package/dist/server/handlers/network.cjs +5 -5
  49. package/dist/server/handlers/network.js +1 -1
  50. package/dist/server/handlers/telemetry.cjs +3 -3
  51. package/dist/server/handlers/telemetry.js +1 -1
  52. package/dist/server/handlers/tools.cjs +5 -5
  53. package/dist/server/handlers/tools.js +1 -1
  54. package/dist/server/handlers/utils.cjs +2 -2
  55. package/dist/server/handlers/utils.js +1 -1
  56. package/dist/server/handlers/vNextWorkflows.cjs +11 -11
  57. package/dist/server/handlers/vNextWorkflows.js +1 -1
  58. package/dist/server/handlers/vector.cjs +7 -7
  59. package/dist/server/handlers/vector.js +1 -1
  60. package/dist/server/handlers/voice.cjs +4 -4
  61. package/dist/server/handlers/voice.js +1 -1
  62. package/dist/server/handlers/workflows.cjs +11 -11
  63. package/dist/server/handlers/workflows.js +1 -1
  64. package/dist/server/handlers.cjs +28 -23
  65. package/dist/server/handlers.d.cts +1 -0
  66. package/dist/server/handlers.d.ts +1 -0
  67. package/dist/server/handlers.js +11 -10
  68. package/package.json +7 -5
  69. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  70. package/dist/chunk-OMN3UI6X.js +0 -5576
@@ -1,12 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkQN4KF3BH_cjs = require('./chunk-QN4KF3BH.cjs');
4
- var chunkZLBRQFDD_cjs = require('./chunk-ZLBRQFDD.cjs');
5
- var chunkFV45V6WC_cjs = require('./chunk-FV45V6WC.cjs');
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
 
7
8
  // src/server/handlers/memory.ts
8
9
  var memory_exports = {};
9
- chunkFV45V6WC_cjs.__export(memory_exports, {
10
+ chunk75ZPJI57_cjs.__export(memory_exports, {
10
11
  createThreadHandler: () => createThreadHandler,
11
12
  deleteThreadHandler: () => deleteThreadHandler,
12
13
  getMemoryStatusHandler: () => getMemoryStatusHandler,
@@ -22,7 +23,7 @@ function getMemoryFromContext({
22
23
  }) {
23
24
  const agent = agentId ? mastra.getAgent(agentId) : null;
24
25
  if (agentId && !agent) {
25
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Agent not found" });
26
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
26
27
  }
27
28
  const memory = agent?.getMemory?.() || mastra.getMemory();
28
29
  return memory;
@@ -35,7 +36,7 @@ async function getMemoryStatusHandler({ mastra, agentId }) {
35
36
  }
36
37
  return { result: true };
37
38
  } catch (error) {
38
- return chunkZLBRQFDD_cjs.handleError(error, "Error getting memory status");
39
+ return chunk64U3UDTH_cjs.handleError(error, "Error getting memory status");
39
40
  }
40
41
  }
41
42
  async function getThreadsHandler({
@@ -46,13 +47,13 @@ async function getThreadsHandler({
46
47
  try {
47
48
  const memory = getMemoryFromContext({ mastra, agentId });
48
49
  if (!memory) {
49
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Memory is not initialized" });
50
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
50
51
  }
51
- chunkQN4KF3BH_cjs.validateBody({ resourceId });
52
+ chunk57CJTIPW_cjs.validateBody({ resourceId });
52
53
  const threads = await memory.getThreadsByResourceId({ resourceId });
53
54
  return threads;
54
55
  } catch (error) {
55
- return chunkZLBRQFDD_cjs.handleError(error, "Error getting threads");
56
+ return chunk64U3UDTH_cjs.handleError(error, "Error getting threads");
56
57
  }
57
58
  }
58
59
  async function getThreadByIdHandler({
@@ -61,18 +62,18 @@ async function getThreadByIdHandler({
61
62
  threadId
62
63
  }) {
63
64
  try {
64
- chunkQN4KF3BH_cjs.validateBody({ threadId });
65
+ chunk57CJTIPW_cjs.validateBody({ threadId });
65
66
  const memory = getMemoryFromContext({ mastra, agentId });
66
67
  if (!memory) {
67
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Memory is not initialized" });
68
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
68
69
  }
69
70
  const thread = await memory.getThreadById({ threadId });
70
71
  if (!thread) {
71
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Thread not found" });
72
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Thread not found" });
72
73
  }
73
74
  return thread;
74
75
  } catch (error) {
75
- return chunkZLBRQFDD_cjs.handleError(error, "Error getting thread");
76
+ return chunk64U3UDTH_cjs.handleError(error, "Error getting thread");
76
77
  }
77
78
  }
78
79
  async function saveMessagesHandler({
@@ -83,13 +84,13 @@ async function saveMessagesHandler({
83
84
  try {
84
85
  const memory = getMemoryFromContext({ mastra, agentId });
85
86
  if (!memory) {
86
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Memory is not initialized" });
87
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
87
88
  }
88
89
  if (!body?.messages) {
89
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Messages are required" });
90
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Messages are required" });
90
91
  }
91
92
  if (!Array.isArray(body.messages)) {
92
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Messages should be an array" });
93
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Messages should be an array" });
93
94
  }
94
95
  const processedMessages = body.messages.map((message) => ({
95
96
  ...message,
@@ -99,7 +100,7 @@ async function saveMessagesHandler({
99
100
  const result = await memory.saveMessages({ messages: processedMessages, memoryConfig: {} });
100
101
  return result;
101
102
  } catch (error) {
102
- return chunkZLBRQFDD_cjs.handleError(error, "Error saving messages");
103
+ return chunk64U3UDTH_cjs.handleError(error, "Error saving messages");
103
104
  }
104
105
  }
105
106
  async function createThreadHandler({
@@ -110,9 +111,9 @@ async function createThreadHandler({
110
111
  try {
111
112
  const memory = getMemoryFromContext({ mastra, agentId });
112
113
  if (!memory) {
113
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Memory is not initialized" });
114
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
114
115
  }
115
- chunkQN4KF3BH_cjs.validateBody({ resourceId: body?.resourceId });
116
+ chunk57CJTIPW_cjs.validateBody({ resourceId: body?.resourceId });
116
117
  const result = await memory.createThread({
117
118
  resourceId: body?.resourceId,
118
119
  title: body?.title,
@@ -121,7 +122,7 @@ async function createThreadHandler({
121
122
  });
122
123
  return result;
123
124
  } catch (error) {
124
- return chunkZLBRQFDD_cjs.handleError(error, "Error saving thread to memory");
125
+ return chunk64U3UDTH_cjs.handleError(error, "Error saving thread to memory");
125
126
  }
126
127
  }
127
128
  async function updateThreadHandler({
@@ -133,17 +134,17 @@ async function updateThreadHandler({
133
134
  try {
134
135
  const memory = getMemoryFromContext({ mastra, agentId });
135
136
  if (!body) {
136
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Body is required" });
137
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Body is required" });
137
138
  }
138
139
  const { title, metadata, resourceId } = body;
139
140
  const updatedAt = /* @__PURE__ */ new Date();
140
- chunkQN4KF3BH_cjs.validateBody({ threadId });
141
+ chunk57CJTIPW_cjs.validateBody({ threadId });
141
142
  if (!memory) {
142
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Memory is not initialized" });
143
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
143
144
  }
144
145
  const thread = await memory.getThreadById({ threadId });
145
146
  if (!thread) {
146
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Thread not found" });
147
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Thread not found" });
147
148
  }
148
149
  const updatedThread = {
149
150
  ...thread,
@@ -156,7 +157,7 @@ async function updateThreadHandler({
156
157
  const result = await memory.saveThread({ thread: updatedThread });
157
158
  return result;
158
159
  } catch (error) {
159
- return chunkZLBRQFDD_cjs.handleError(error, "Error updating thread");
160
+ return chunk64U3UDTH_cjs.handleError(error, "Error updating thread");
160
161
  }
161
162
  }
162
163
  async function deleteThreadHandler({
@@ -165,40 +166,47 @@ async function deleteThreadHandler({
165
166
  threadId
166
167
  }) {
167
168
  try {
168
- chunkQN4KF3BH_cjs.validateBody({ threadId });
169
+ chunk57CJTIPW_cjs.validateBody({ threadId });
169
170
  const memory = getMemoryFromContext({ mastra, agentId });
170
171
  if (!memory) {
171
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Memory is not initialized" });
172
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
172
173
  }
173
174
  const thread = await memory.getThreadById({ threadId });
174
175
  if (!thread) {
175
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Thread not found" });
176
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Thread not found" });
176
177
  }
177
178
  await memory.deleteThread(threadId);
178
179
  return { result: "Thread deleted" };
179
180
  } catch (error) {
180
- return chunkZLBRQFDD_cjs.handleError(error, "Error deleting thread");
181
+ return chunk64U3UDTH_cjs.handleError(error, "Error deleting thread");
181
182
  }
182
183
  }
183
184
  async function getMessagesHandler({
184
185
  mastra,
185
186
  agentId,
186
- threadId
187
+ threadId,
188
+ limit
187
189
  }) {
190
+ if (limit !== void 0 && (!Number.isInteger(limit) || limit <= 0)) {
191
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Invalid limit: must be a positive integer" });
192
+ }
188
193
  try {
189
- chunkQN4KF3BH_cjs.validateBody({ threadId });
194
+ chunk57CJTIPW_cjs.validateBody({ threadId });
190
195
  const memory = getMemoryFromContext({ mastra, agentId });
191
196
  if (!memory) {
192
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Memory is not initialized" });
197
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
193
198
  }
194
199
  const thread = await memory.getThreadById({ threadId });
195
200
  if (!thread) {
196
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Thread not found" });
201
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Thread not found" });
197
202
  }
198
- const result = await memory.query({ threadId });
203
+ const result = await memory.query({
204
+ threadId,
205
+ ...limit && { selectBy: { last: limit } }
206
+ });
199
207
  return result;
200
208
  } catch (error) {
201
- return chunkZLBRQFDD_cjs.handleError(error, "Error getting messages");
209
+ return chunk64U3UDTH_cjs.handleError(error, "Error getting messages");
202
210
  }
203
211
  }
204
212
 
@@ -1,13 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunkQN4KF3BH_cjs = require('./chunk-QN4KF3BH.cjs');
4
- var chunkZLBRQFDD_cjs = require('./chunk-ZLBRQFDD.cjs');
5
- var chunkFV45V6WC_cjs = require('./chunk-FV45V6WC.cjs');
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
- chunkFV45V6WC_cjs.__export(voice_exports, {
11
+ chunk75ZPJI57_cjs.__export(voice_exports, {
11
12
  generateSpeechHandler: () => generateSpeechHandler,
12
13
  getSpeakersHandler: () => getSpeakersHandler,
13
14
  transcribeSpeechHandler: () => transcribeSpeechHandler
@@ -15,19 +16,19 @@ chunkFV45V6WC_cjs.__export(voice_exports, {
15
16
  async function getSpeakersHandler({ mastra, agentId }) {
16
17
  try {
17
18
  if (!agentId) {
18
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Agent ID is required" });
19
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
19
20
  }
20
21
  const agent = mastra.getAgent(agentId);
21
22
  if (!agent) {
22
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Agent not found" });
23
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
23
24
  }
24
25
  if (!agent.voice) {
25
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
26
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
26
27
  }
27
28
  const speakers = await agent.voice.getSpeakers();
28
29
  return speakers;
29
30
  } catch (error) {
30
- return chunkZLBRQFDD_cjs.handleError(error, "Error getting speakers");
31
+ return chunk64U3UDTH_cjs.handleError(error, "Error getting speakers");
31
32
  }
32
33
  }
33
34
  async function generateSpeechHandler({
@@ -37,25 +38,25 @@ async function generateSpeechHandler({
37
38
  }) {
38
39
  try {
39
40
  if (!agentId) {
40
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Agent ID is required" });
41
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
41
42
  }
42
- chunkQN4KF3BH_cjs.validateBody({
43
+ chunk57CJTIPW_cjs.validateBody({
43
44
  text: body?.text
44
45
  });
45
46
  const agent = mastra.getAgent(agentId);
46
47
  if (!agent) {
47
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Agent not found" });
48
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
48
49
  }
49
50
  if (!agent.voice) {
50
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
51
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
51
52
  }
52
53
  const audioStream = await agent.voice.speak(body.text, { speaker: body.speakerId });
53
54
  if (!audioStream) {
54
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: "Failed to generate speech" });
55
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: "Failed to generate speech" });
55
56
  }
56
57
  return audioStream;
57
58
  } catch (error) {
58
- return chunkZLBRQFDD_cjs.handleError(error, "Error generating speech");
59
+ return chunk64U3UDTH_cjs.handleError(error, "Error generating speech");
59
60
  }
60
61
  }
61
62
  async function transcribeSpeechHandler({
@@ -65,17 +66,17 @@ async function transcribeSpeechHandler({
65
66
  }) {
66
67
  try {
67
68
  if (!agentId) {
68
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Agent ID is required" });
69
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
69
70
  }
70
71
  if (!body?.audioData) {
71
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Audio data is required" });
72
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Audio data is required" });
72
73
  }
73
74
  const agent = mastra.getAgent(agentId);
74
75
  if (!agent) {
75
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Agent not found" });
76
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
76
77
  }
77
78
  if (!agent.voice) {
78
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
79
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
79
80
  }
80
81
  const audioStream = new stream.Readable();
81
82
  audioStream.push(body.audioData);
@@ -83,7 +84,7 @@ async function transcribeSpeechHandler({
83
84
  const text = await agent.voice.listen(audioStream, body.options);
84
85
  return { text };
85
86
  } catch (error) {
86
- return chunkZLBRQFDD_cjs.handleError(error, "Error transcribing speech");
87
+ return chunk64U3UDTH_cjs.handleError(error, "Error transcribing speech");
87
88
  }
88
89
  }
89
90