@mastra/server 0.0.0-share-agent-metadata-with-cloud-20250718110128 → 0.0.0-sidebar-window-undefined-fix-20251029233656

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 (274) hide show
  1. package/CHANGELOG.md +4200 -0
  2. package/README.md +0 -5
  3. package/dist/chunk-2P4VRXBT.js +533 -0
  4. package/dist/chunk-2P4VRXBT.js.map +1 -0
  5. package/dist/chunk-2PLXW4ZX.cjs +2777 -0
  6. package/dist/chunk-2PLXW4ZX.cjs.map +1 -0
  7. package/dist/chunk-2S4IMB6E.cjs +130 -0
  8. package/dist/chunk-2S4IMB6E.cjs.map +1 -0
  9. package/dist/chunk-3SNGNFUJ.cjs +128 -0
  10. package/dist/chunk-3SNGNFUJ.cjs.map +1 -0
  11. package/dist/{chunk-RSEO4XPX.js → chunk-4QCXUEAT.js} +11 -2
  12. package/dist/chunk-4QCXUEAT.js.map +1 -0
  13. package/dist/chunk-6VPAV4ZV.js +692 -0
  14. package/dist/chunk-6VPAV4ZV.js.map +1 -0
  15. package/dist/chunk-7HCPO76Z.js +19548 -0
  16. package/dist/chunk-7HCPO76Z.js.map +1 -0
  17. package/dist/{chunk-2KZFMI6P.cjs → chunk-7NADHFD2.cjs} +2 -0
  18. package/dist/chunk-7NADHFD2.cjs.map +1 -0
  19. package/dist/{chunk-4D66QEKC.js → chunk-ABRFV4XP.js} +5 -3
  20. package/dist/chunk-ABRFV4XP.js.map +1 -0
  21. package/dist/{chunk-LRCAAFUA.js → chunk-AHB4JCIQ.js} +50 -12
  22. package/dist/chunk-AHB4JCIQ.js.map +1 -0
  23. package/dist/chunk-AW5BU3RQ.js +192 -0
  24. package/dist/chunk-AW5BU3RQ.js.map +1 -0
  25. package/dist/chunk-B7QWVGQQ.cjs +729 -0
  26. package/dist/chunk-B7QWVGQQ.cjs.map +1 -0
  27. package/dist/chunk-BATEJLED.js +124 -0
  28. package/dist/chunk-BATEJLED.js.map +1 -0
  29. package/dist/chunk-CJFKRVED.cjs +134 -0
  30. package/dist/chunk-CJFKRVED.cjs.map +1 -0
  31. package/dist/{chunk-LF7P5PLR.js → chunk-CY4TP3FK.js} +3 -1
  32. package/dist/chunk-CY4TP3FK.js.map +1 -0
  33. package/dist/{chunk-7TP2LX5L.cjs → chunk-EP3JQDPD.cjs} +20 -18
  34. package/dist/chunk-EP3JQDPD.cjs.map +1 -0
  35. package/dist/chunk-G4PUALCE.cjs +28 -0
  36. package/dist/chunk-G4PUALCE.cjs.map +1 -0
  37. package/dist/chunk-GDUKGVFI.cjs +550 -0
  38. package/dist/chunk-GDUKGVFI.cjs.map +1 -0
  39. package/dist/chunk-GU4EWMZB.cjs +769 -0
  40. package/dist/chunk-GU4EWMZB.cjs.map +1 -0
  41. package/dist/{chunk-JMLYCXMK.cjs → chunk-I3C4ODGV.cjs} +48 -45
  42. package/dist/chunk-I3C4ODGV.cjs.map +1 -0
  43. package/dist/{chunk-SDPGVWQJ.cjs → chunk-K5T5A3AL.cjs} +110 -137
  44. package/dist/chunk-K5T5A3AL.cjs.map +1 -0
  45. package/dist/chunk-KDUHLUK4.cjs +19584 -0
  46. package/dist/chunk-KDUHLUK4.cjs.map +1 -0
  47. package/dist/chunk-KSFLUEWV.js +130 -0
  48. package/dist/chunk-KSFLUEWV.js.map +1 -0
  49. package/dist/chunk-LF2ZLOFP.js +767 -0
  50. package/dist/chunk-LF2ZLOFP.js.map +1 -0
  51. package/dist/{chunk-5PQQ42EZ.js → chunk-LLUOPR3J.js} +13 -10
  52. package/dist/chunk-LLUOPR3J.js.map +1 -0
  53. package/dist/chunk-LPM6BBAX.cjs +1043 -0
  54. package/dist/chunk-LPM6BBAX.cjs.map +1 -0
  55. package/dist/{chunk-LCM566I4.js → chunk-MMROOK5J.js} +2 -0
  56. package/dist/chunk-MMROOK5J.js.map +1 -0
  57. package/dist/{chunk-GHC4YV6R.js → chunk-MN2TZQ7I.js} +109 -136
  58. package/dist/chunk-MN2TZQ7I.js.map +1 -0
  59. package/dist/{chunk-WNVFNNWN.js → chunk-MYR4PVGN.js} +5 -3
  60. package/dist/chunk-MYR4PVGN.js.map +1 -0
  61. package/dist/chunk-O7I5CWRX.cjs +44 -0
  62. package/dist/chunk-O7I5CWRX.cjs.map +1 -0
  63. package/dist/chunk-PR4QN5HX.js +39 -0
  64. package/dist/chunk-PR4QN5HX.js.map +1 -0
  65. package/dist/{chunk-KHZKYUNR.js → chunk-QQXMIP6C.js} +23 -13
  66. package/dist/chunk-QQXMIP6C.js.map +1 -0
  67. package/dist/chunk-QU6N55W6.cjs +256 -0
  68. package/dist/chunk-QU6N55W6.cjs.map +1 -0
  69. package/dist/{chunk-PZQDCRPV.cjs → chunk-RE4RPXT2.cjs} +4 -2
  70. package/dist/chunk-RE4RPXT2.cjs.map +1 -0
  71. package/dist/chunk-RQK4FQUD.js +1012 -0
  72. package/dist/chunk-RQK4FQUD.js.map +1 -0
  73. package/dist/chunk-SHWNNZBL.js +254 -0
  74. package/dist/chunk-SHWNNZBL.js.map +1 -0
  75. package/dist/chunk-SPRRK3P7.cjs +200 -0
  76. package/dist/chunk-SPRRK3P7.cjs.map +1 -0
  77. package/dist/chunk-TOCYBDP2.js +46 -0
  78. package/dist/chunk-TOCYBDP2.js.map +1 -0
  79. package/dist/chunk-TRGAMKHX.cjs +167 -0
  80. package/dist/chunk-TRGAMKHX.cjs.map +1 -0
  81. package/dist/chunk-X6C7BUWN.cjs +48 -0
  82. package/dist/chunk-X6C7BUWN.cjs.map +1 -0
  83. package/dist/{chunk-QGX47B5D.cjs → chunk-XN74I6VW.cjs} +11 -9
  84. package/dist/chunk-XN74I6VW.cjs.map +1 -0
  85. package/dist/chunk-YSHNCC6F.cjs +713 -0
  86. package/dist/chunk-YSHNCC6F.cjs.map +1 -0
  87. package/dist/{chunk-H7DMHBKY.js → chunk-ZLBL4NQC.js} +307 -98
  88. package/dist/chunk-ZLBL4NQC.js.map +1 -0
  89. package/dist/chunk-ZULZ2752.js +2774 -0
  90. package/dist/chunk-ZULZ2752.js.map +1 -0
  91. package/dist/dist-4MVGNSRL.cjs +1150 -0
  92. package/dist/dist-4MVGNSRL.cjs.map +1 -0
  93. package/dist/dist-FZYCV3VB.cjs +940 -0
  94. package/dist/dist-FZYCV3VB.cjs.map +1 -0
  95. package/dist/dist-G2BYZJOC.cjs +928 -0
  96. package/dist/dist-G2BYZJOC.cjs.map +1 -0
  97. package/dist/dist-P4MXBQ3U.cjs +16 -0
  98. package/dist/dist-P4MXBQ3U.cjs.map +1 -0
  99. package/dist/dist-PQZUVLPC.js +937 -0
  100. package/dist/dist-PQZUVLPC.js.map +1 -0
  101. package/dist/dist-R7WYX6LC.js +925 -0
  102. package/dist/dist-R7WYX6LC.js.map +1 -0
  103. package/dist/dist-RFMYFILX.cjs +764 -0
  104. package/dist/dist-RFMYFILX.cjs.map +1 -0
  105. package/dist/dist-X7XR3M3Z.js +1147 -0
  106. package/dist/dist-X7XR3M3Z.js.map +1 -0
  107. package/dist/dist-XVBSOGFK.js +761 -0
  108. package/dist/dist-XVBSOGFK.js.map +1 -0
  109. package/dist/dist-YREX2TJT.js +3 -0
  110. package/dist/dist-YREX2TJT.js.map +1 -0
  111. package/dist/index.cjs +6 -0
  112. package/dist/index.cjs.map +1 -0
  113. package/dist/index.d.ts +1 -0
  114. package/dist/index.d.ts.map +1 -0
  115. package/dist/index.js +5 -0
  116. package/dist/index.js.map +1 -0
  117. package/dist/server/a2a/protocol.d.ts +8 -0
  118. package/dist/server/a2a/protocol.d.ts.map +1 -0
  119. package/dist/server/a2a/store.cjs +25 -0
  120. package/dist/server/a2a/store.cjs.map +1 -0
  121. package/dist/server/a2a/store.d.ts +14 -0
  122. package/dist/server/a2a/store.d.ts.map +1 -0
  123. package/dist/server/a2a/store.js +23 -0
  124. package/dist/server/a2a/store.js.map +1 -0
  125. package/dist/server/a2a/tasks.d.ts +20 -0
  126. package/dist/server/a2a/tasks.d.ts.map +1 -0
  127. package/dist/server/handlers/a2a.cjs +13 -11
  128. package/dist/server/handlers/a2a.cjs.map +1 -0
  129. package/dist/server/handlers/a2a.d.ts +68 -6
  130. package/dist/server/handlers/a2a.d.ts.map +1 -0
  131. package/dist/server/handlers/a2a.js +3 -1
  132. package/dist/server/handlers/a2a.js.map +1 -0
  133. package/dist/server/handlers/agent-builder.cjs +68 -0
  134. package/dist/server/handlers/agent-builder.cjs.map +1 -0
  135. package/dist/server/handlers/agent-builder.d.ts +94 -0
  136. package/dist/server/handlers/agent-builder.d.ts.map +1 -0
  137. package/dist/server/handlers/agent-builder.js +3 -0
  138. package/dist/server/handlers/agent-builder.js.map +1 -0
  139. package/dist/server/handlers/agents.cjs +61 -7
  140. package/dist/server/handlers/agents.cjs.map +1 -0
  141. package/dist/server/handlers/agents.d.ts +208 -6
  142. package/dist/server/handlers/agents.d.ts.map +1 -0
  143. package/dist/server/handlers/agents.js +3 -1
  144. package/dist/server/handlers/agents.js.map +1 -0
  145. package/dist/server/handlers/error.cjs +4 -2
  146. package/dist/server/handlers/error.cjs.map +1 -0
  147. package/dist/server/handlers/error.d.ts +2 -1
  148. package/dist/server/handlers/error.d.ts.map +1 -0
  149. package/dist/server/handlers/error.js +3 -1
  150. package/dist/server/handlers/error.js.map +1 -0
  151. package/dist/server/handlers/legacyWorkflows.cjs +13 -11
  152. package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
  153. package/dist/server/handlers/legacyWorkflows.d.ts +59 -10
  154. package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
  155. package/dist/server/handlers/legacyWorkflows.js +3 -1
  156. package/dist/server/handlers/legacyWorkflows.js.map +1 -0
  157. package/dist/server/handlers/logs.cjs +6 -4
  158. package/dist/server/handlers/logs.cjs.map +1 -0
  159. package/dist/server/handlers/logs.d.ts +34 -3
  160. package/dist/server/handlers/logs.d.ts.map +1 -0
  161. package/dist/server/handlers/logs.js +3 -1
  162. package/dist/server/handlers/logs.js.map +1 -0
  163. package/dist/server/handlers/memory.cjs +33 -11
  164. package/dist/server/handlers/memory.cjs.map +1 -0
  165. package/dist/server/handlers/memory.d.ts +118 -10
  166. package/dist/server/handlers/memory.d.ts.map +1 -0
  167. package/dist/server/handlers/memory.js +3 -1
  168. package/dist/server/handlers/memory.js.map +1 -0
  169. package/dist/server/handlers/observability.cjs +24 -0
  170. package/dist/server/handlers/observability.cjs.map +1 -0
  171. package/dist/server/handlers/observability.d.ts +49 -0
  172. package/dist/server/handlers/observability.d.ts.map +1 -0
  173. package/dist/server/handlers/observability.js +3 -0
  174. package/dist/server/handlers/observability.js.map +1 -0
  175. package/dist/server/handlers/scores.cjs +32 -0
  176. package/dist/server/handlers/scores.cjs.map +1 -0
  177. package/dist/server/handlers/scores.d.ts +152 -0
  178. package/dist/server/handlers/scores.d.ts.map +1 -0
  179. package/dist/server/handlers/scores.js +3 -0
  180. package/dist/server/handlers/scores.js.map +1 -0
  181. package/dist/server/handlers/tools.cjs +11 -5
  182. package/dist/server/handlers/tools.cjs.map +1 -0
  183. package/dist/server/handlers/tools.d.ts +25 -4
  184. package/dist/server/handlers/tools.d.ts.map +1 -0
  185. package/dist/server/handlers/tools.js +3 -1
  186. package/dist/server/handlers/tools.js.map +1 -0
  187. package/dist/server/handlers/utils.cjs +8 -2
  188. package/dist/server/handlers/utils.cjs.map +1 -0
  189. package/dist/server/handlers/utils.d.ts +8 -1
  190. package/dist/server/handlers/utils.d.ts.map +1 -0
  191. package/dist/server/handlers/utils.js +3 -1
  192. package/dist/server/handlers/utils.js.map +1 -0
  193. package/dist/server/handlers/vector.cjs +9 -7
  194. package/dist/server/handlers/vector.cjs.map +1 -0
  195. package/dist/server/handlers/vector.d.ts +51 -6
  196. package/dist/server/handlers/vector.d.ts.map +1 -0
  197. package/dist/server/handlers/vector.js +3 -1
  198. package/dist/server/handlers/vector.js.map +1 -0
  199. package/dist/server/handlers/voice.cjs +7 -5
  200. package/dist/server/handlers/voice.cjs.map +1 -0
  201. package/dist/server/handlers/voice.d.ts +41 -4
  202. package/dist/server/handlers/voice.d.ts.map +1 -0
  203. package/dist/server/handlers/voice.js +3 -1
  204. package/dist/server/handlers/voice.js.map +1 -0
  205. package/dist/server/handlers/workflows.cjs +41 -15
  206. package/dist/server/handlers/workflows.cjs.map +1 -0
  207. package/dist/server/handlers/workflows.d.ts +97 -14
  208. package/dist/server/handlers/workflows.d.ts.map +1 -0
  209. package/dist/server/handlers/workflows.js +3 -1
  210. package/dist/server/handlers/workflows.js.map +1 -0
  211. package/dist/server/handlers.cjs +38 -31
  212. package/dist/server/handlers.cjs.map +1 -0
  213. package/dist/server/handlers.d.ts +13 -11
  214. package/dist/server/handlers.d.ts.map +1 -0
  215. package/dist/server/handlers.js +14 -11
  216. package/dist/server/handlers.js.map +1 -0
  217. package/dist/server/http-exception.d.ts +87 -0
  218. package/dist/server/http-exception.d.ts.map +1 -0
  219. package/dist/server/types.d.ts +10 -0
  220. package/dist/server/types.d.ts.map +1 -0
  221. package/dist/server/utils.d.ts +44 -0
  222. package/dist/server/utils.d.ts.map +1 -0
  223. package/dist/token-375W3LEI.cjs +64 -0
  224. package/dist/token-375W3LEI.cjs.map +1 -0
  225. package/dist/token-C3IMNCC4.js +62 -0
  226. package/dist/token-C3IMNCC4.js.map +1 -0
  227. package/dist/token-util-CV3RRG6K.cjs +9 -0
  228. package/dist/token-util-CV3RRG6K.cjs.map +1 -0
  229. package/dist/token-util-E5QO2RCL.js +7 -0
  230. package/dist/token-util-E5QO2RCL.js.map +1 -0
  231. package/package.json +37 -14
  232. package/dist/_tsup-dts-rollup.d.cts +0 -1107
  233. package/dist/_tsup-dts-rollup.d.ts +0 -1107
  234. package/dist/chunk-2SLFAFTR.cjs +0 -148
  235. package/dist/chunk-3CNDE7QY.cjs +0 -308
  236. package/dist/chunk-75ZPJI57.cjs +0 -9
  237. package/dist/chunk-B2PAS2IB.cjs +0 -514
  238. package/dist/chunk-BK4XT6EG.js +0 -270
  239. package/dist/chunk-CCGRCYWJ.cjs +0 -18
  240. package/dist/chunk-CRCR3ZUK.js +0 -142
  241. package/dist/chunk-FRVBFMO2.cjs +0 -128
  242. package/dist/chunk-G7KH752Y.cjs +0 -145
  243. package/dist/chunk-KOHWJYJT.js +0 -296
  244. package/dist/chunk-LI436ITD.cjs +0 -2042
  245. package/dist/chunk-LZ3VJXSO.cjs +0 -278
  246. package/dist/chunk-MEGCYGBU.js +0 -2039
  247. package/dist/chunk-MLKGABMK.js +0 -7
  248. package/dist/chunk-RG473F6Y.js +0 -141
  249. package/dist/chunk-RHSWAXKB.cjs +0 -118
  250. package/dist/index.d.cts +0 -1
  251. package/dist/server/handlers/a2a.d.cts +0 -6
  252. package/dist/server/handlers/agents.d.cts +0 -6
  253. package/dist/server/handlers/error.d.cts +0 -1
  254. package/dist/server/handlers/legacyWorkflows.d.cts +0 -10
  255. package/dist/server/handlers/logs.d.cts +0 -3
  256. package/dist/server/handlers/memory.d.cts +0 -10
  257. package/dist/server/handlers/network.cjs +0 -22
  258. package/dist/server/handlers/network.d.cts +0 -4
  259. package/dist/server/handlers/network.d.ts +0 -4
  260. package/dist/server/handlers/network.js +0 -1
  261. package/dist/server/handlers/telemetry.cjs +0 -14
  262. package/dist/server/handlers/telemetry.d.cts +0 -2
  263. package/dist/server/handlers/telemetry.d.ts +0 -2
  264. package/dist/server/handlers/telemetry.js +0 -1
  265. package/dist/server/handlers/tools.d.cts +0 -4
  266. package/dist/server/handlers/utils.d.cts +0 -1
  267. package/dist/server/handlers/vNextNetwork.cjs +0 -218
  268. package/dist/server/handlers/vNextNetwork.d.cts +0 -6
  269. package/dist/server/handlers/vNextNetwork.d.ts +0 -6
  270. package/dist/server/handlers/vNextNetwork.js +0 -211
  271. package/dist/server/handlers/vector.d.cts +0 -6
  272. package/dist/server/handlers/voice.d.cts +0 -4
  273. package/dist/server/handlers/workflows.d.cts +0 -14
  274. package/dist/server/handlers.d.cts +0 -11
@@ -1,7 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- export { __export };
@@ -1,141 +0,0 @@
1
- import { handleError } from './chunk-LF7P5PLR.js';
2
- import { HTTPException } from './chunk-LCM566I4.js';
3
- import { __export } from './chunk-MLKGABMK.js';
4
-
5
- // src/server/handlers/telemetry.ts
6
- var telemetry_exports = {};
7
- __export(telemetry_exports, {
8
- getTelemetryHandler: () => getTelemetryHandler,
9
- storeTelemetryHandler: () => storeTelemetryHandler
10
- });
11
- async function getTelemetryHandler({ mastra, body }) {
12
- try {
13
- const telemetry = mastra.getTelemetry();
14
- const storage = mastra.getStorage();
15
- if (!telemetry) {
16
- throw new HTTPException(400, { message: "Telemetry is not initialized" });
17
- }
18
- if (!storage) {
19
- return [];
20
- }
21
- if (!body) {
22
- throw new HTTPException(400, { message: "Body is required" });
23
- }
24
- const { name, scope, page, perPage, attribute, fromDate, toDate } = body;
25
- const attributes = attribute ? Object.fromEntries(
26
- (Array.isArray(attribute) ? attribute : [attribute]).map((attr) => {
27
- const [key, value] = attr.split(":");
28
- return [key, value];
29
- })
30
- ) : void 0;
31
- const traces = await storage.getTraces({
32
- name,
33
- scope,
34
- page: Number(page ?? 0),
35
- perPage: Number(perPage ?? 100),
36
- attributes,
37
- fromDate: fromDate ? new Date(fromDate) : void 0,
38
- toDate: toDate ? new Date(toDate) : void 0
39
- });
40
- return traces;
41
- } catch (error2) {
42
- return handleError(error2, "Error getting telemetry");
43
- }
44
- }
45
- async function storeTelemetryHandler({ mastra, body }) {
46
- try {
47
- const storage = mastra.getStorage();
48
- const logger = mastra.getLogger();
49
- if (!storage) {
50
- return {
51
- status: "error",
52
- message: "Storage is not initialized"
53
- };
54
- }
55
- const now = /* @__PURE__ */ new Date();
56
- const items = body?.resourceSpans?.[0]?.scopeSpans;
57
- logger.debug("[Telemetry Handler] Received spans:", {
58
- totalSpans: items?.reduce((acc, scope) => acc + scope.spans.length, 0) || 0,
59
- timestamp: now.toISOString()
60
- });
61
- if (!items?.length) {
62
- return {
63
- status: "success",
64
- message: "No spans to process",
65
- traceCount: 0
66
- };
67
- }
68
- const allSpans = items.reduce((acc, scopedSpans) => {
69
- const { scope, spans } = scopedSpans;
70
- for (const span of spans) {
71
- const {
72
- spanId,
73
- parentSpanId,
74
- traceId,
75
- name,
76
- kind,
77
- attributes,
78
- status,
79
- events,
80
- links,
81
- startTimeUnixNano,
82
- endTimeUnixNano,
83
- ...rest
84
- } = span;
85
- const startTime = Number(BigInt(startTimeUnixNano) / 1000n);
86
- const endTime = Number(BigInt(endTimeUnixNano) / 1000n);
87
- acc.push({
88
- id: spanId,
89
- parentSpanId,
90
- traceId,
91
- name,
92
- scope: scope.name,
93
- kind,
94
- status: JSON.stringify(status),
95
- events: JSON.stringify(events),
96
- links: JSON.stringify(links),
97
- attributes: JSON.stringify(
98
- attributes.reduce((acc2, attr) => {
99
- const valueKey = Object.keys(attr.value)[0];
100
- if (valueKey) {
101
- acc2[attr.key] = attr.value[valueKey];
102
- }
103
- return acc2;
104
- }, {})
105
- ),
106
- startTime,
107
- endTime,
108
- other: JSON.stringify(rest),
109
- createdAt: now
110
- });
111
- }
112
- return acc;
113
- }, []);
114
- return storage.batchTraceInsert({
115
- records: allSpans
116
- }).then(() => {
117
- return {
118
- status: "success",
119
- message: "Traces received and processed successfully",
120
- traceCount: body.resourceSpans?.length || 0
121
- };
122
- }).catch(() => {
123
- return {
124
- status: "error",
125
- message: "Failed to process traces",
126
- // @ts-ignore
127
- error: error.message
128
- };
129
- });
130
- } catch (error2) {
131
- console.error("Error processing traces:", error2);
132
- return {
133
- status: "error",
134
- message: "Failed to process traces",
135
- // @ts-ignore
136
- error: error2.message
137
- };
138
- }
139
- }
140
-
141
- export { getTelemetryHandler, storeTelemetryHandler, telemetry_exports };
@@ -1,118 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkCCGRCYWJ_cjs = require('./chunk-CCGRCYWJ.cjs');
4
- var chunkPZQDCRPV_cjs = require('./chunk-PZQDCRPV.cjs');
5
- var chunk2KZFMI6P_cjs = require('./chunk-2KZFMI6P.cjs');
6
- var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
7
- var stream = require('stream');
8
-
9
- // src/server/handlers/voice.ts
10
- var voice_exports = {};
11
- chunk75ZPJI57_cjs.__export(voice_exports, {
12
- generateSpeechHandler: () => generateSpeechHandler,
13
- getListenerHandler: () => getListenerHandler,
14
- getSpeakersHandler: () => getSpeakersHandler,
15
- transcribeSpeechHandler: () => transcribeSpeechHandler
16
- });
17
- async function getSpeakersHandler({ mastra, agentId }) {
18
- try {
19
- if (!agentId) {
20
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Agent ID is required" });
21
- }
22
- const agent = mastra.getAgent(agentId);
23
- if (!agent) {
24
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
25
- }
26
- const voice = await agent.getVoice();
27
- if (!voice) {
28
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
29
- }
30
- const speakers = await voice.getSpeakers();
31
- return speakers;
32
- } catch (error) {
33
- return chunkPZQDCRPV_cjs.handleError(error, "Error getting speakers");
34
- }
35
- }
36
- async function generateSpeechHandler({
37
- mastra,
38
- agentId,
39
- body
40
- }) {
41
- try {
42
- if (!agentId) {
43
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Agent ID is required" });
44
- }
45
- chunkCCGRCYWJ_cjs.validateBody({
46
- text: body?.text
47
- });
48
- const agent = mastra.getAgent(agentId);
49
- if (!agent) {
50
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
51
- }
52
- const voice = await agent.getVoice();
53
- if (!voice) {
54
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
55
- }
56
- const audioStream = await voice.speak(body.text, { speaker: body.speakerId });
57
- if (!audioStream) {
58
- throw new chunk2KZFMI6P_cjs.HTTPException(500, { message: "Failed to generate speech" });
59
- }
60
- return audioStream;
61
- } catch (error) {
62
- return chunkPZQDCRPV_cjs.handleError(error, "Error generating speech");
63
- }
64
- }
65
- async function transcribeSpeechHandler({
66
- mastra,
67
- agentId,
68
- body
69
- }) {
70
- try {
71
- if (!agentId) {
72
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Agent ID is required" });
73
- }
74
- if (!body?.audioData) {
75
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Audio data is required" });
76
- }
77
- const agent = mastra.getAgent(agentId);
78
- if (!agent) {
79
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
80
- }
81
- const voice = await agent.getVoice();
82
- if (!voice) {
83
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
84
- }
85
- const audioStream = new stream.Readable();
86
- audioStream.push(body.audioData);
87
- audioStream.push(null);
88
- const text = await voice.listen(audioStream, body.options);
89
- return { text };
90
- } catch (error) {
91
- return chunkPZQDCRPV_cjs.handleError(error, "Error transcribing speech");
92
- }
93
- }
94
- async function getListenerHandler({ mastra, agentId }) {
95
- try {
96
- if (!agentId) {
97
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Agent ID is required" });
98
- }
99
- const agent = mastra.getAgent(agentId);
100
- if (!agent) {
101
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
102
- }
103
- const voice = await agent.getVoice();
104
- if (!voice) {
105
- throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
106
- }
107
- const listeners = await voice.getListener();
108
- return listeners;
109
- } catch (error) {
110
- return chunkPZQDCRPV_cjs.handleError(error, "Error getting listeners");
111
- }
112
- }
113
-
114
- exports.generateSpeechHandler = generateSpeechHandler;
115
- exports.getListenerHandler = getListenerHandler;
116
- exports.getSpeakersHandler = getSpeakersHandler;
117
- exports.transcribeSpeechHandler = transcribeSpeechHandler;
118
- exports.voice_exports = voice_exports;
package/dist/index.d.cts DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- export { getAgentCardByIdHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { handleTaskSend } from '../../_tsup-dts-rollup.cjs';
3
- export { handleTaskGet } from '../../_tsup-dts-rollup.cjs';
4
- export { handleTaskSendSubscribe } from '../../_tsup-dts-rollup.cjs';
5
- export { handleTaskCancel } from '../../_tsup-dts-rollup.cjs';
6
- export { getAgentExecutionHandler } from '../../_tsup-dts-rollup.cjs';
@@ -1,6 +0,0 @@
1
- export { getAgentsHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { getAgentByIdHandler } from '../../_tsup-dts-rollup.cjs';
3
- export { getEvalsByAgentIdHandler } from '../../_tsup-dts-rollup.cjs';
4
- export { getLiveEvalsByAgentIdHandler } from '../../_tsup-dts-rollup.cjs';
5
- export { generateHandler } from '../../_tsup-dts-rollup.cjs';
6
- export { streamGenerateHandler } from '../../_tsup-dts-rollup.cjs';
@@ -1 +0,0 @@
1
- export { handleError } from '../../_tsup-dts-rollup.cjs';
@@ -1,10 +0,0 @@
1
- export { getLegacyWorkflowsHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { getLegacyWorkflowByIdHandler } from '../../_tsup-dts-rollup.cjs';
3
- export { startAsyncLegacyWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
4
- export { getLegacyWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
5
- export { createLegacyWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
6
- export { startLegacyWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
7
- export { watchLegacyWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
8
- export { resumeAsyncLegacyWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
9
- export { resumeLegacyWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
10
- export { getLegacyWorkflowRunsHandler } from '../../_tsup-dts-rollup.cjs';
@@ -1,3 +0,0 @@
1
- export { getLogsHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { getLogsByRunIdHandler } from '../../_tsup-dts-rollup.cjs';
3
- export { getLogTransports } from '../../_tsup-dts-rollup.cjs';
@@ -1,10 +0,0 @@
1
- export { getMemoryStatusHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { getThreadsHandler } from '../../_tsup-dts-rollup.cjs';
3
- export { getThreadByIdHandler } from '../../_tsup-dts-rollup.cjs';
4
- export { saveMessagesHandler } from '../../_tsup-dts-rollup.cjs';
5
- export { createThreadHandler } from '../../_tsup-dts-rollup.cjs';
6
- export { updateThreadHandler } from '../../_tsup-dts-rollup.cjs';
7
- export { deleteThreadHandler } from '../../_tsup-dts-rollup.cjs';
8
- export { getMessagesHandler } from '../../_tsup-dts-rollup.cjs';
9
- export { getWorkingMemoryHandler } from '../../_tsup-dts-rollup.cjs';
10
- export { updateWorkingMemoryHandler } from '../../_tsup-dts-rollup.cjs';
@@ -1,22 +0,0 @@
1
- 'use strict';
2
-
3
- var chunk2SLFAFTR_cjs = require('../../chunk-2SLFAFTR.cjs');
4
-
5
-
6
-
7
- Object.defineProperty(exports, "generateHandler", {
8
- enumerable: true,
9
- get: function () { return chunk2SLFAFTR_cjs.generateHandler; }
10
- });
11
- Object.defineProperty(exports, "getNetworkByIdHandler", {
12
- enumerable: true,
13
- get: function () { return chunk2SLFAFTR_cjs.getNetworkByIdHandler; }
14
- });
15
- Object.defineProperty(exports, "getNetworksHandler", {
16
- enumerable: true,
17
- get: function () { return chunk2SLFAFTR_cjs.getNetworksHandler; }
18
- });
19
- Object.defineProperty(exports, "streamGenerateHandler", {
20
- enumerable: true,
21
- get: function () { return chunk2SLFAFTR_cjs.streamGenerateHandler; }
22
- });
@@ -1,4 +0,0 @@
1
- export { getNetworksHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { getNetworkByIdHandler } from '../../_tsup-dts-rollup.cjs';
3
- export { generateHandler_alias_1 as generateHandler } from '../../_tsup-dts-rollup.cjs';
4
- export { streamGenerateHandler_alias_1 as streamGenerateHandler } from '../../_tsup-dts-rollup.cjs';
@@ -1,4 +0,0 @@
1
- export { getNetworksHandler } from '../../_tsup-dts-rollup.js';
2
- export { getNetworkByIdHandler } from '../../_tsup-dts-rollup.js';
3
- export { generateHandler_alias_1 as generateHandler } from '../../_tsup-dts-rollup.js';
4
- export { streamGenerateHandler_alias_1 as streamGenerateHandler } from '../../_tsup-dts-rollup.js';
@@ -1 +0,0 @@
1
- export { generateHandler, getNetworkByIdHandler, getNetworksHandler, streamGenerateHandler } from '../../chunk-CRCR3ZUK.js';
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkG7KH752Y_cjs = require('../../chunk-G7KH752Y.cjs');
4
-
5
-
6
-
7
- Object.defineProperty(exports, "getTelemetryHandler", {
8
- enumerable: true,
9
- get: function () { return chunkG7KH752Y_cjs.getTelemetryHandler; }
10
- });
11
- Object.defineProperty(exports, "storeTelemetryHandler", {
12
- enumerable: true,
13
- get: function () { return chunkG7KH752Y_cjs.storeTelemetryHandler; }
14
- });
@@ -1,2 +0,0 @@
1
- export { getTelemetryHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { storeTelemetryHandler } from '../../_tsup-dts-rollup.cjs';
@@ -1,2 +0,0 @@
1
- export { getTelemetryHandler } from '../../_tsup-dts-rollup.js';
2
- export { storeTelemetryHandler } from '../../_tsup-dts-rollup.js';
@@ -1 +0,0 @@
1
- export { getTelemetryHandler, storeTelemetryHandler } from '../../chunk-RG473F6Y.js';
@@ -1,4 +0,0 @@
1
- export { getToolsHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { getToolByIdHandler } from '../../_tsup-dts-rollup.cjs';
3
- export { executeToolHandler } from '../../_tsup-dts-rollup.cjs';
4
- export { executeAgentToolHandler } from '../../_tsup-dts-rollup.cjs';
@@ -1 +0,0 @@
1
- export { validateBody } from '../../_tsup-dts-rollup.cjs';
@@ -1,218 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkLI436ITD_cjs = require('../../chunk-LI436ITD.cjs');
4
- var chunkCCGRCYWJ_cjs = require('../../chunk-CCGRCYWJ.cjs');
5
- var chunkPZQDCRPV_cjs = require('../../chunk-PZQDCRPV.cjs');
6
- var chunk2KZFMI6P_cjs = require('../../chunk-2KZFMI6P.cjs');
7
-
8
- // src/server/handlers/vNextNetwork.ts
9
- async function getVNextNetworksHandler({
10
- mastra,
11
- runtimeContext
12
- }) {
13
- try {
14
- const networks = mastra.vnext_getNetworks();
15
- const serializedNetworks = await Promise.all(
16
- networks.map(async (network) => {
17
- const routingAgent = await network.getRoutingAgent({ runtimeContext });
18
- const routingLLM = await routingAgent.getLLM({ runtimeContext });
19
- const agents = await network.getAgents({ runtimeContext });
20
- const workflows = await network.getWorkflows({ runtimeContext });
21
- const tools = await network.getTools({ runtimeContext });
22
- const networkInstruction = await network.getInstructions({ runtimeContext });
23
- return {
24
- id: network.id,
25
- name: network.name,
26
- instructions: networkInstruction,
27
- tools: await Promise.all(
28
- Object.values(tools).map(async (tool) => {
29
- return {
30
- id: tool.id,
31
- description: tool.description
32
- };
33
- })
34
- ),
35
- agents: await Promise.all(
36
- Object.values(agents).map(async (agent) => {
37
- const llm = await agent.getLLM({ runtimeContext });
38
- return {
39
- name: agent.name,
40
- provider: llm?.getProvider(),
41
- modelId: llm?.getModelId()
42
- };
43
- })
44
- ),
45
- workflows: await Promise.all(
46
- Object.values(workflows).map(async (workflow) => {
47
- return {
48
- name: workflow.name,
49
- description: workflow.description,
50
- inputSchema: workflow.inputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(workflow.inputSchema)) : void 0,
51
- outputSchema: workflow.outputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(workflow.outputSchema)) : void 0
52
- };
53
- })
54
- ),
55
- routingModel: {
56
- provider: routingLLM?.getProvider(),
57
- modelId: routingLLM?.getModelId()
58
- }
59
- };
60
- })
61
- );
62
- return serializedNetworks;
63
- } catch (error) {
64
- return chunkPZQDCRPV_cjs.handleError(error, "Error getting networks");
65
- }
66
- }
67
- async function getVNextNetworkByIdHandler({
68
- mastra,
69
- networkId,
70
- runtimeContext
71
- }) {
72
- try {
73
- const network = mastra.vnext_getNetwork(networkId);
74
- if (!network) {
75
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Network not found" });
76
- }
77
- const routingAgent = await network.getRoutingAgent({ runtimeContext });
78
- const routingLLM = await routingAgent.getLLM({ runtimeContext });
79
- const agents = await network.getAgents({ runtimeContext });
80
- const workflows = await network.getWorkflows({ runtimeContext });
81
- const tools = await network.getTools({ runtimeContext });
82
- const networkInstruction = await network.getInstructions({ runtimeContext });
83
- const serializedNetwork = {
84
- id: network.id,
85
- name: network.name,
86
- instructions: networkInstruction,
87
- agents: await Promise.all(
88
- Object.values(agents).map(async (agent) => {
89
- const llm = await agent.getLLM({ runtimeContext });
90
- return {
91
- name: agent.name,
92
- provider: llm?.getProvider(),
93
- modelId: llm?.getModelId()
94
- };
95
- })
96
- ),
97
- workflows: await Promise.all(
98
- Object.values(workflows).map(async (workflow) => {
99
- return {
100
- name: workflow.name,
101
- description: workflow.description,
102
- inputSchema: workflow.inputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(workflow.inputSchema)) : void 0,
103
- outputSchema: workflow.outputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(workflow.outputSchema)) : void 0
104
- };
105
- })
106
- ),
107
- tools: await Promise.all(
108
- Object.values(tools).map(async (tool) => {
109
- return {
110
- id: tool.id,
111
- description: tool.description
112
- };
113
- })
114
- ),
115
- routingModel: {
116
- provider: routingLLM?.getProvider(),
117
- modelId: routingLLM?.getModelId()
118
- }
119
- };
120
- return serializedNetwork;
121
- } catch (error) {
122
- return chunkPZQDCRPV_cjs.handleError(error, "Error getting network by ID");
123
- }
124
- }
125
- async function generateVNextNetworkHandler({
126
- mastra,
127
- runtimeContext,
128
- networkId,
129
- body
130
- }) {
131
- try {
132
- const network = mastra.vnext_getNetwork(networkId);
133
- if (!network) {
134
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Network not found" });
135
- }
136
- chunkCCGRCYWJ_cjs.validateBody({ message: body.message });
137
- const { message, threadId, resourceId } = body;
138
- const result = await network.generate(message, { runtimeContext, threadId, resourceId });
139
- return result;
140
- } catch (error) {
141
- return chunkPZQDCRPV_cjs.handleError(error, "Error generating from network");
142
- }
143
- }
144
- async function streamGenerateVNextNetworkHandler({
145
- mastra,
146
- networkId,
147
- body,
148
- runtimeContext
149
- }) {
150
- try {
151
- const network = mastra.vnext_getNetwork(networkId);
152
- if (!network) {
153
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Network not found" });
154
- }
155
- chunkCCGRCYWJ_cjs.validateBody({ message: body.message });
156
- const { message, threadId, resourceId } = body;
157
- const streamResult = await network.stream(message, {
158
- runtimeContext,
159
- threadId,
160
- resourceId
161
- });
162
- return streamResult;
163
- } catch (error) {
164
- return chunkPZQDCRPV_cjs.handleError(error, "Error streaming from network");
165
- }
166
- }
167
- async function loopVNextNetworkHandler({
168
- mastra,
169
- networkId,
170
- body,
171
- runtimeContext
172
- }) {
173
- try {
174
- const network = mastra.vnext_getNetwork(networkId);
175
- if (!network) {
176
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Network not found" });
177
- }
178
- chunkCCGRCYWJ_cjs.validateBody({ message: body.message });
179
- const { message } = body;
180
- const result = await network.loop(message, {
181
- runtimeContext
182
- });
183
- return result;
184
- } catch (error) {
185
- return chunkPZQDCRPV_cjs.handleError(error, "Error looping network");
186
- }
187
- }
188
- async function loopStreamVNextNetworkHandler({
189
- mastra,
190
- networkId,
191
- body,
192
- runtimeContext
193
- }) {
194
- try {
195
- const network = mastra.vnext_getNetwork(networkId);
196
- if (!network) {
197
- throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Network not found" });
198
- }
199
- chunkCCGRCYWJ_cjs.validateBody({ message: body.message });
200
- const { message, threadId, resourceId, maxIterations } = body;
201
- const result = await network.loopStream(message, {
202
- runtimeContext,
203
- threadId,
204
- resourceId,
205
- maxIterations
206
- });
207
- return result;
208
- } catch (error) {
209
- return chunkPZQDCRPV_cjs.handleError(error, "Error streaming network loop");
210
- }
211
- }
212
-
213
- exports.generateVNextNetworkHandler = generateVNextNetworkHandler;
214
- exports.getVNextNetworkByIdHandler = getVNextNetworkByIdHandler;
215
- exports.getVNextNetworksHandler = getVNextNetworksHandler;
216
- exports.loopStreamVNextNetworkHandler = loopStreamVNextNetworkHandler;
217
- exports.loopVNextNetworkHandler = loopVNextNetworkHandler;
218
- exports.streamGenerateVNextNetworkHandler = streamGenerateVNextNetworkHandler;
@@ -1,6 +0,0 @@
1
- export { getVNextNetworksHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { getVNextNetworkByIdHandler } from '../../_tsup-dts-rollup.cjs';
3
- export { generateVNextNetworkHandler } from '../../_tsup-dts-rollup.cjs';
4
- export { streamGenerateVNextNetworkHandler } from '../../_tsup-dts-rollup.cjs';
5
- export { loopVNextNetworkHandler } from '../../_tsup-dts-rollup.cjs';
6
- export { loopStreamVNextNetworkHandler } from '../../_tsup-dts-rollup.cjs';
@@ -1,6 +0,0 @@
1
- export { getVNextNetworksHandler } from '../../_tsup-dts-rollup.js';
2
- export { getVNextNetworkByIdHandler } from '../../_tsup-dts-rollup.js';
3
- export { generateVNextNetworkHandler } from '../../_tsup-dts-rollup.js';
4
- export { streamGenerateVNextNetworkHandler } from '../../_tsup-dts-rollup.js';
5
- export { loopVNextNetworkHandler } from '../../_tsup-dts-rollup.js';
6
- export { loopStreamVNextNetworkHandler } from '../../_tsup-dts-rollup.js';