@mastra/deployer 0.10.2 → 0.10.4-alpha.0
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/build/analyze.js +1 -1
- package/dist/build/bundler.js +1 -1
- package/dist/build/index.js +4 -4
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-KWJ2766I.js → chunk-EXHFPVZH.js} +1 -1
- package/dist/{chunk-AOSWYZKN.js → chunk-HHOCIHND.js} +2 -2
- package/dist/{chunk-2LZRVR53.js → chunk-WGJTOVLL.js} +7 -7
- package/dist/{chunk-UJR423U5.js → chunk-WM2GT75J.js} +3 -3
- package/dist/{chunk-TDWDSZWX.js → chunk-YLTLG56Z.js} +7 -7
- package/dist/{chunk-WVBUOQT6.js → chunk-Z544XXXK.js} +2 -2
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +352 -251
- package/dist/server/index.js +356 -256
- package/dist/validator/custom-resolver.js +4 -4
- package/dist/validator/loader.js +1 -1
- package/package.json +11 -11
package/dist/server/index.cjs
CHANGED
|
@@ -42,9 +42,9 @@ var util__default = /*#__PURE__*/_interopDefault(util);
|
|
|
42
42
|
|
|
43
43
|
// src/server/index.ts
|
|
44
44
|
var RequestError = class extends Error {
|
|
45
|
-
static name = "RequestError";
|
|
46
45
|
constructor(message, options) {
|
|
47
46
|
super(message, options);
|
|
47
|
+
this.name = "RequestError";
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
var toRequestError = (e2) => {
|
|
@@ -197,6 +197,72 @@ var newRequest = (incoming, defaultHostname) => {
|
|
|
197
197
|
req[urlKey] = url.href;
|
|
198
198
|
return req;
|
|
199
199
|
};
|
|
200
|
+
var responseCache = Symbol("responseCache");
|
|
201
|
+
var getResponseCache = Symbol("getResponseCache");
|
|
202
|
+
var cacheKey = Symbol("cache");
|
|
203
|
+
var GlobalResponse = global.Response;
|
|
204
|
+
var Response2 = class _Response {
|
|
205
|
+
#body;
|
|
206
|
+
#init;
|
|
207
|
+
[getResponseCache]() {
|
|
208
|
+
delete this[cacheKey];
|
|
209
|
+
return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
|
|
210
|
+
}
|
|
211
|
+
constructor(body, init) {
|
|
212
|
+
let headers;
|
|
213
|
+
this.#body = body;
|
|
214
|
+
if (init instanceof _Response) {
|
|
215
|
+
const cachedGlobalResponse = init[responseCache];
|
|
216
|
+
if (cachedGlobalResponse) {
|
|
217
|
+
this.#init = cachedGlobalResponse;
|
|
218
|
+
this[getResponseCache]();
|
|
219
|
+
return;
|
|
220
|
+
} else {
|
|
221
|
+
this.#init = init.#init;
|
|
222
|
+
headers = new Headers(init.#init.headers);
|
|
223
|
+
}
|
|
224
|
+
} else {
|
|
225
|
+
this.#init = init;
|
|
226
|
+
}
|
|
227
|
+
if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
|
|
228
|
+
headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" };
|
|
229
|
+
this[cacheKey] = [init?.status || 200, body, headers];
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
get headers() {
|
|
233
|
+
const cache = this[cacheKey];
|
|
234
|
+
if (cache) {
|
|
235
|
+
if (!(cache[2] instanceof Headers)) {
|
|
236
|
+
cache[2] = new Headers(cache[2]);
|
|
237
|
+
}
|
|
238
|
+
return cache[2];
|
|
239
|
+
}
|
|
240
|
+
return this[getResponseCache]().headers;
|
|
241
|
+
}
|
|
242
|
+
get status() {
|
|
243
|
+
return this[cacheKey]?.[0] ?? this[getResponseCache]().status;
|
|
244
|
+
}
|
|
245
|
+
get ok() {
|
|
246
|
+
const status = this.status;
|
|
247
|
+
return status >= 200 && status < 300;
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => {
|
|
251
|
+
Object.defineProperty(Response2.prototype, k, {
|
|
252
|
+
get() {
|
|
253
|
+
return this[getResponseCache]()[k];
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
|
258
|
+
Object.defineProperty(Response2.prototype, k, {
|
|
259
|
+
value: function() {
|
|
260
|
+
return this[getResponseCache]()[k]();
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
Object.setPrototypeOf(Response2, GlobalResponse);
|
|
265
|
+
Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
|
|
200
266
|
function writeFromReadableStream(stream4, writable) {
|
|
201
267
|
if (stream4.locked) {
|
|
202
268
|
throw new TypeError("ReadableStream is locked.");
|
|
@@ -255,83 +321,6 @@ var buildOutgoingHttpHeaders = (headers) => {
|
|
|
255
321
|
res["content-type"] ??= "text/plain; charset=UTF-8";
|
|
256
322
|
return res;
|
|
257
323
|
};
|
|
258
|
-
var responseCache = Symbol("responseCache");
|
|
259
|
-
var getResponseCache = Symbol("getResponseCache");
|
|
260
|
-
var cacheKey = Symbol("cache");
|
|
261
|
-
var GlobalResponse = global.Response;
|
|
262
|
-
var Response2 = class _Response {
|
|
263
|
-
#body;
|
|
264
|
-
#init;
|
|
265
|
-
[getResponseCache]() {
|
|
266
|
-
delete this[cacheKey];
|
|
267
|
-
return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
|
|
268
|
-
}
|
|
269
|
-
constructor(body, init) {
|
|
270
|
-
this.#body = body;
|
|
271
|
-
if (init instanceof _Response) {
|
|
272
|
-
const cachedGlobalResponse = init[responseCache];
|
|
273
|
-
if (cachedGlobalResponse) {
|
|
274
|
-
this.#init = cachedGlobalResponse;
|
|
275
|
-
this[getResponseCache]();
|
|
276
|
-
return;
|
|
277
|
-
} else {
|
|
278
|
-
this.#init = init.#init;
|
|
279
|
-
}
|
|
280
|
-
} else {
|
|
281
|
-
this.#init = init;
|
|
282
|
-
}
|
|
283
|
-
if (typeof body === "string" || typeof body?.getReader !== "undefined") {
|
|
284
|
-
let headers = init?.headers || { "content-type": "text/plain; charset=UTF-8" };
|
|
285
|
-
if (headers instanceof Headers) {
|
|
286
|
-
headers = buildOutgoingHttpHeaders(headers);
|
|
287
|
-
}
|
|
288
|
-
this[cacheKey] = [init?.status || 200, body, headers];
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
[
|
|
293
|
-
"body",
|
|
294
|
-
"bodyUsed",
|
|
295
|
-
"headers",
|
|
296
|
-
"ok",
|
|
297
|
-
"redirected",
|
|
298
|
-
"status",
|
|
299
|
-
"statusText",
|
|
300
|
-
"trailers",
|
|
301
|
-
"type",
|
|
302
|
-
"url"
|
|
303
|
-
].forEach((k) => {
|
|
304
|
-
Object.defineProperty(Response2.prototype, k, {
|
|
305
|
-
get() {
|
|
306
|
-
return this[getResponseCache]()[k];
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
});
|
|
310
|
-
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
|
311
|
-
Object.defineProperty(Response2.prototype, k, {
|
|
312
|
-
value: function() {
|
|
313
|
-
return this[getResponseCache]()[k]();
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
});
|
|
317
|
-
Object.setPrototypeOf(Response2, GlobalResponse);
|
|
318
|
-
Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
|
|
319
|
-
var stateKey = Reflect.ownKeys(new GlobalResponse()).find(
|
|
320
|
-
(k) => typeof k === "symbol" && k.toString() === "Symbol(state)"
|
|
321
|
-
);
|
|
322
|
-
if (!stateKey) {
|
|
323
|
-
console.warn("Failed to find Response internal state key");
|
|
324
|
-
}
|
|
325
|
-
function getInternalBody(response) {
|
|
326
|
-
if (!stateKey) {
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
if (response instanceof Response2) {
|
|
330
|
-
response = response[getResponseCache]();
|
|
331
|
-
}
|
|
332
|
-
const state = response[stateKey];
|
|
333
|
-
return state && state.body || void 0;
|
|
334
|
-
}
|
|
335
324
|
var X_ALREADY_SENT = "x-hono-already-sent";
|
|
336
325
|
var webFetch = global.fetch;
|
|
337
326
|
if (typeof global.crypto === "undefined") {
|
|
@@ -367,14 +356,24 @@ var handleResponseError = (e2, outgoing) => {
|
|
|
367
356
|
outgoing.destroy(err);
|
|
368
357
|
}
|
|
369
358
|
};
|
|
370
|
-
var responseViaCache = (res, outgoing) => {
|
|
371
|
-
|
|
359
|
+
var responseViaCache = async (res, outgoing) => {
|
|
360
|
+
let [status, body, header] = res[cacheKey];
|
|
361
|
+
if (header instanceof Headers) {
|
|
362
|
+
header = buildOutgoingHttpHeaders(header);
|
|
363
|
+
}
|
|
372
364
|
if (typeof body === "string") {
|
|
373
365
|
header["Content-Length"] = Buffer.byteLength(body);
|
|
374
|
-
|
|
366
|
+
} else if (body instanceof Uint8Array) {
|
|
367
|
+
header["Content-Length"] = body.byteLength;
|
|
368
|
+
} else if (body instanceof Blob) {
|
|
369
|
+
header["Content-Length"] = body.size;
|
|
370
|
+
}
|
|
371
|
+
outgoing.writeHead(status, header);
|
|
372
|
+
if (typeof body === "string" || body instanceof Uint8Array) {
|
|
375
373
|
outgoing.end(body);
|
|
374
|
+
} else if (body instanceof Blob) {
|
|
375
|
+
outgoing.end(new Uint8Array(await body.arrayBuffer()));
|
|
376
376
|
} else {
|
|
377
|
-
outgoing.writeHead(status, header);
|
|
378
377
|
return writeFromReadableStream(body, outgoing)?.catch(
|
|
379
378
|
(e2) => handleResponseError(e2, outgoing)
|
|
380
379
|
);
|
|
@@ -400,24 +399,6 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
|
|
400
399
|
return responseViaCache(res, outgoing);
|
|
401
400
|
}
|
|
402
401
|
const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
|
|
403
|
-
const internalBody = getInternalBody(res);
|
|
404
|
-
if (internalBody) {
|
|
405
|
-
const { length, source, stream: stream4 } = internalBody;
|
|
406
|
-
if (source instanceof Uint8Array && source.byteLength !== length) ; else {
|
|
407
|
-
if (length) {
|
|
408
|
-
resHeaderRecord["content-length"] = length;
|
|
409
|
-
}
|
|
410
|
-
outgoing.writeHead(res.status, resHeaderRecord);
|
|
411
|
-
if (typeof source === "string" || source instanceof Uint8Array) {
|
|
412
|
-
outgoing.end(source);
|
|
413
|
-
} else if (source instanceof Blob) {
|
|
414
|
-
outgoing.end(new Uint8Array(await source.arrayBuffer()));
|
|
415
|
-
} else {
|
|
416
|
-
await writeFromReadableStream(stream4, outgoing);
|
|
417
|
-
}
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
402
|
if (res.body) {
|
|
422
403
|
const {
|
|
423
404
|
"transfer-encoding": transferEncoding,
|
|
@@ -748,131 +729,148 @@ var middleware = (options) => async (c2) => {
|
|
|
748
729
|
);
|
|
749
730
|
};
|
|
750
731
|
|
|
751
|
-
// ../../node_modules/.pnpm/hono-openapi@0.4.
|
|
732
|
+
// ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.7.11_openapi-types@12.1.3_zod@3.25.55/node_modules/hono-openapi/utils.js
|
|
752
733
|
var e = Symbol("openapi");
|
|
753
|
-
var
|
|
754
|
-
var
|
|
734
|
+
var n = ["GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE"];
|
|
735
|
+
var s2 = (e2) => e2.charAt(0).toUpperCase() + e2.slice(1);
|
|
755
736
|
var o = /* @__PURE__ */ new Map();
|
|
756
737
|
var a = (e2, t2) => {
|
|
757
|
-
const
|
|
758
|
-
if (o.has(
|
|
738
|
+
const n2 = `${e2}:${t2}`;
|
|
739
|
+
if (o.has(n2)) return o.get(n2);
|
|
759
740
|
let a2 = e2;
|
|
760
741
|
if ("/" === t2) return `${a2}Index`;
|
|
761
|
-
for (const e3 of t2.split("/")) 123 === e3.charCodeAt(0) ? a2 += `By${
|
|
762
|
-
return o.set(
|
|
742
|
+
for (const e3 of t2.split("/")) 123 === e3.charCodeAt(0) ? a2 += `By${s2(e3.slice(1, -1))}` : a2 += s2(e3);
|
|
743
|
+
return o.set(n2, a2), a2;
|
|
763
744
|
};
|
|
764
745
|
var r = /* @__PURE__ */ new Map();
|
|
765
|
-
function c(e2, t2,
|
|
766
|
-
return e2 && t2 in e2 ? e2[t2] ??
|
|
746
|
+
function c(e2, t2, n2) {
|
|
747
|
+
return e2 && t2 in e2 ? e2[t2] ?? n2 : n2;
|
|
767
748
|
}
|
|
768
749
|
function i(...e2) {
|
|
769
750
|
return e2.reduce((e3, t2) => {
|
|
770
751
|
if (!t2) return e3;
|
|
771
|
-
let
|
|
772
|
-
return ("tags" in e3 && e3.tags || "tags" in t2 && t2.tags) && (
|
|
752
|
+
let n2;
|
|
753
|
+
return ("tags" in e3 && e3.tags || "tags" in t2 && t2.tags) && (n2 = Array.from(/* @__PURE__ */ new Set([...c(e3, "tags", []), ...c(t2, "tags", [])]))), { ...e3, ...t2, tags: n2, responses: { ...c(e3, "responses", {}), ...c(t2, "responses", {}) }, parameters: m(e3.parameters, t2.parameters) };
|
|
773
754
|
}, {});
|
|
774
755
|
}
|
|
775
|
-
function p({ path: e2, method: t2, data:
|
|
756
|
+
function p({ path: e2, method: t2, data: n2, schema: s3 }) {
|
|
776
757
|
e2 = ((e3) => e3.split("/").map((e4) => {
|
|
777
758
|
let t3 = e4;
|
|
778
|
-
|
|
759
|
+
if (t3.startsWith(":")) {
|
|
760
|
+
const e5 = t3.match(/^:([^{?]+)(?:{(.+)})?(\?)?$/);
|
|
761
|
+
e5 ? t3 = `{${e5[1]}}` : (t3 = t3.slice(1, t3.length), t3.endsWith("?") && (t3 = t3.slice(0, -1)), t3 = `{${t3}}`);
|
|
762
|
+
}
|
|
763
|
+
return t3;
|
|
779
764
|
}).join("/"))(e2);
|
|
780
765
|
const o2 = t2.toLowerCase();
|
|
781
|
-
if ("all" === o2)
|
|
782
|
-
|
|
783
|
-
r.
|
|
784
|
-
|
|
785
|
-
|
|
766
|
+
if ("all" === o2) {
|
|
767
|
+
if (!n2) return;
|
|
768
|
+
if (r.has(e2)) {
|
|
769
|
+
const t3 = r.get(e2) ?? {};
|
|
770
|
+
r.set(e2, { ...t3, ...n2, parameters: m(t3.parameters, n2.parameters) });
|
|
771
|
+
} else r.set(e2, n2);
|
|
772
|
+
} else {
|
|
786
773
|
const t3 = function(e3) {
|
|
787
774
|
const t4 = Array.from(r.keys());
|
|
788
|
-
let
|
|
789
|
-
for (const
|
|
790
|
-
return
|
|
775
|
+
let n3 = {};
|
|
776
|
+
for (const s4 of t4) e3.match(s4) && (n3 = i(n3, r.get(s4) ?? {}));
|
|
777
|
+
return n3;
|
|
791
778
|
}(e2);
|
|
792
|
-
|
|
779
|
+
s3[e2] = { ...s3[e2] ? s3[e2] : {}, [o2]: { responses: {}, operationId: a(o2, e2), ...i(t3, s3[e2]?.[o2], n2) } };
|
|
793
780
|
}
|
|
794
781
|
}
|
|
795
|
-
var
|
|
782
|
+
var f = (e2) => "$ref" in e2 ? e2.$ref : `${e2.in} ${e2.name}`;
|
|
796
783
|
function m(...e2) {
|
|
797
|
-
const t2 = e2.flatMap((e3) => e3 ?? []).reduce((e3, t3) => (e3.set(
|
|
784
|
+
const t2 = e2.flatMap((e3) => e3 ?? []).reduce((e3, t3) => (e3.set(f(t3), t3), e3), /* @__PURE__ */ new Map());
|
|
798
785
|
return Array.from(t2.values());
|
|
799
786
|
}
|
|
800
|
-
function
|
|
801
|
-
const
|
|
802
|
-
for (const [
|
|
787
|
+
function l(e2, { excludeStaticFile: t2 = true, exclude: n2 = [] }) {
|
|
788
|
+
const s3 = {}, o2 = Array.isArray(n2) ? n2 : [n2];
|
|
789
|
+
for (const [n3, a2] of Object.entries(e2)) if (!o2.some((e3) => "string" == typeof e3 ? n3 === e3 : e3.test(n3)) && (!n3.includes("*") || n3.includes("{")) && (!t2 || (!n3.includes(".") || n3.includes("{")))) {
|
|
803
790
|
for (const e3 of Object.keys(a2)) {
|
|
804
791
|
const t3 = a2[e3];
|
|
805
|
-
if (
|
|
792
|
+
if (n3.includes("{")) {
|
|
806
793
|
t3.parameters || (t3.parameters = []);
|
|
807
|
-
const e4 =
|
|
808
|
-
for (const
|
|
809
|
-
const e5 =
|
|
810
|
-
-1 !==
|
|
794
|
+
const e4 = n3.split("/").filter((e5) => e5.startsWith("{") && !t3.parameters.find((t4) => "path" === t4.in && t4.name === e5.slice(1, e5.length - 1)));
|
|
795
|
+
for (const n4 of e4) {
|
|
796
|
+
const e5 = n4.slice(1, n4.length - 1), s4 = t3.parameters.findIndex((t4) => "param" === t4.in && t4.name === e5);
|
|
797
|
+
-1 !== s4 ? t3.parameters[s4].in = "path" : t3.parameters.push({ schema: { type: "string" }, in: "path", name: e5, required: true });
|
|
811
798
|
}
|
|
812
799
|
}
|
|
813
800
|
t3.responses || (t3.responses = { 200: {} });
|
|
814
801
|
}
|
|
815
|
-
|
|
802
|
+
s3[n3] = a2;
|
|
816
803
|
}
|
|
817
|
-
return
|
|
804
|
+
return s3;
|
|
818
805
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
806
|
+
var u = { documentation: {}, excludeStaticFile: true, exclude: [], excludeMethods: ["OPTIONS"], excludeTags: [] };
|
|
807
|
+
var d = { version: "3.1.0", components: {} };
|
|
808
|
+
function h(e2, t2) {
|
|
809
|
+
const n2 = { version: "3.1.0", components: {} };
|
|
810
|
+
let s3;
|
|
811
|
+
return async (o2) => (s3 || (s3 = await y(e2, t2, n2, o2)), o2.json(s3));
|
|
823
812
|
}
|
|
824
|
-
async function
|
|
825
|
-
const
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
813
|
+
async function y(t2, s3 = u, o2 = d, a2) {
|
|
814
|
+
const r2 = { ...u, ...s3 }, c2 = { ...d, ...o2 }, i2 = r2.documentation ?? {}, f2 = await async function(t3, s4, o3) {
|
|
815
|
+
const a3 = {};
|
|
816
|
+
for (const r3 of t3.routes) {
|
|
817
|
+
if (!(e in r3.handler)) {
|
|
818
|
+
s4.includeEmptyPaths && p({ method: r3.method, path: r3.path, schema: a3 });
|
|
819
|
+
continue;
|
|
820
|
+
}
|
|
821
|
+
if (s4.excludeMethods.includes(r3.method)) continue;
|
|
822
|
+
if (false === n.includes(r3.method) && "ALL" !== r3.method) continue;
|
|
823
|
+
const { resolver: t4, metadata: c3 = {} } = r3.handler[e], i3 = s4.defaultOptions?.[r3.method], { docs: f3, components: m2 } = await t4({ ...o3, ...c3 }, i3);
|
|
824
|
+
o3.components = { ...o3.components, ...m2 ?? {} }, p({ method: r3.method, path: r3.path, data: f3, schema: a3 });
|
|
825
|
+
}
|
|
826
|
+
return a3;
|
|
827
|
+
}(t2, r2, c2);
|
|
828
|
+
for (const e2 in f2) for (const t3 in f2[e2]) {
|
|
829
|
+
const n2 = f2[e2][t3]?.hide;
|
|
830
|
+
if (n2) {
|
|
831
|
+
let s4 = false;
|
|
832
|
+
"boolean" == typeof n2 ? s4 = n2 : "function" == typeof n2 && (a2 ? s4 = n2(a2) : console.warn(`'c' is not defined, cannot evaluate hide function for ${t3} ${e2}`)), s4 && delete f2[e2][t3];
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
return { openapi: c2.version, ...{ ...i2, tags: i2.tags?.filter((e2) => !r2.excludeTags?.includes(e2?.name)), info: { title: "Hono Documentation", description: "Development documentation", version: "0.0.0", ...i2.info }, paths: { ...l(f2, r2), ...i2.paths }, components: { ...i2.components, schemas: { ...c2.components, ...i2.components?.schemas } } } };
|
|
838
836
|
}
|
|
839
|
-
function
|
|
840
|
-
const { validateResponse:
|
|
837
|
+
function w(n2) {
|
|
838
|
+
const { validateResponse: s3, ...o2 } = n2;
|
|
841
839
|
return Object.assign(async (e2, o3) => {
|
|
842
|
-
if (await o3(),
|
|
840
|
+
if (await o3(), s3 && n2.responses) {
|
|
843
841
|
const o4 = e2.res.status, a2 = e2.res.headers.get("content-type");
|
|
844
842
|
if (o4 && a2) {
|
|
845
|
-
const r2 =
|
|
843
|
+
const r2 = n2.responses[o4];
|
|
846
844
|
if (r2 && "content" in r2 && r2.content) {
|
|
847
|
-
const
|
|
845
|
+
const n3 = a2.split(";")[0], o5 = r2.content[n3];
|
|
848
846
|
if (o5?.schema && "validator" in o5.schema) try {
|
|
849
847
|
let t2;
|
|
850
|
-
const
|
|
851
|
-
if ("application/json" ===
|
|
848
|
+
const s4 = e2.res.clone();
|
|
849
|
+
if ("application/json" === n3 ? t2 = await s4.json() : "text/plain" === n3 && (t2 = await s4.text()), !t2) throw new Error("No data to validate!");
|
|
852
850
|
await o5.schema.validator(t2);
|
|
853
851
|
} catch (e3) {
|
|
854
|
-
let
|
|
855
|
-
throw "object" == typeof
|
|
852
|
+
let n4 = { status: 500, message: "Response validation failed!" };
|
|
853
|
+
throw "object" == typeof s3 && (n4 = { ...n4, ...s3 }), new httpException.HTTPException(n4.status, { message: n4.message, cause: e3 });
|
|
856
854
|
}
|
|
857
855
|
}
|
|
858
856
|
}
|
|
859
857
|
}
|
|
860
858
|
}, { [e]: { resolver: (e2, t2) => x(e2, o2, t2) } });
|
|
861
859
|
}
|
|
862
|
-
async function x(e2, t2,
|
|
863
|
-
let
|
|
864
|
-
const o2 = { ...
|
|
860
|
+
async function x(e2, t2, n2 = {}) {
|
|
861
|
+
let s3 = {};
|
|
862
|
+
const o2 = { ...n2, ...t2, responses: { ...n2?.responses, ...t2.responses } };
|
|
865
863
|
if (o2.responses) for (const t3 of Object.keys(o2.responses)) {
|
|
866
|
-
const
|
|
867
|
-
if (
|
|
868
|
-
const o3 =
|
|
864
|
+
const n3 = o2.responses[t3];
|
|
865
|
+
if (n3 && "content" in n3) for (const t4 of Object.keys(n3.content ?? {})) {
|
|
866
|
+
const o3 = n3.content?.[t4];
|
|
869
867
|
if (o3 && (o3.schema && "builder" in o3.schema)) {
|
|
870
868
|
const t5 = await o3.schema.builder(e2);
|
|
871
|
-
o3.schema = t5.schema, t5.components && (
|
|
869
|
+
o3.schema = t5.schema, t5.components && (s3 = { ...s3, ...t5.components });
|
|
872
870
|
}
|
|
873
871
|
}
|
|
874
872
|
}
|
|
875
|
-
return { docs: o2, components:
|
|
873
|
+
return { docs: o2, components: s3 };
|
|
876
874
|
}
|
|
877
875
|
async function getAgentCardByIdHandler(c2) {
|
|
878
876
|
const mastra = c2.get("mastra");
|
|
@@ -1452,10 +1450,19 @@ async function getLegacyWorkflowRunsHandler(c2) {
|
|
|
1452
1450
|
async function getLogsHandler(c2) {
|
|
1453
1451
|
try {
|
|
1454
1452
|
const mastra = c2.get("mastra");
|
|
1455
|
-
const transportId = c2.req.query(
|
|
1453
|
+
const { transportId, fromDate, toDate, logLevel, page, perPage } = c2.req.query();
|
|
1454
|
+
const filters = c2.req.queries("filters");
|
|
1456
1455
|
const logs$1 = await logs.getLogsHandler({
|
|
1457
1456
|
mastra,
|
|
1458
|
-
transportId
|
|
1457
|
+
transportId,
|
|
1458
|
+
params: {
|
|
1459
|
+
fromDate: fromDate ? new Date(fromDate) : void 0,
|
|
1460
|
+
toDate: toDate ? new Date(toDate) : void 0,
|
|
1461
|
+
logLevel: logLevel ? logLevel : void 0,
|
|
1462
|
+
filters,
|
|
1463
|
+
page: page ? Number(page) : void 0,
|
|
1464
|
+
perPage: perPage ? Number(perPage) : void 0
|
|
1465
|
+
}
|
|
1459
1466
|
});
|
|
1460
1467
|
return c2.json(logs$1);
|
|
1461
1468
|
} catch (error) {
|
|
@@ -1466,11 +1473,20 @@ async function getLogsByRunIdHandler(c2) {
|
|
|
1466
1473
|
try {
|
|
1467
1474
|
const mastra = c2.get("mastra");
|
|
1468
1475
|
const runId = c2.req.param("runId");
|
|
1469
|
-
const transportId = c2.req.query(
|
|
1476
|
+
const { transportId, fromDate, toDate, logLevel, page, perPage } = c2.req.query();
|
|
1477
|
+
const filters = c2.req.queries("filters");
|
|
1470
1478
|
const logs$1 = await logs.getLogsByRunIdHandler({
|
|
1471
1479
|
mastra,
|
|
1472
1480
|
runId,
|
|
1473
|
-
transportId
|
|
1481
|
+
transportId,
|
|
1482
|
+
params: {
|
|
1483
|
+
fromDate: fromDate ? new Date(fromDate) : void 0,
|
|
1484
|
+
toDate: toDate ? new Date(toDate) : void 0,
|
|
1485
|
+
logLevel: logLevel ? logLevel : void 0,
|
|
1486
|
+
filters,
|
|
1487
|
+
page: page ? Number(page) : void 0,
|
|
1488
|
+
perPage: perPage ? Number(perPage) : void 0
|
|
1489
|
+
}
|
|
1474
1490
|
});
|
|
1475
1491
|
return c2.json(logs$1);
|
|
1476
1492
|
} catch (error) {
|
|
@@ -4459,8 +4475,14 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4459
4475
|
});
|
|
4460
4476
|
return acc;
|
|
4461
4477
|
}, {});
|
|
4462
|
-
} catch {
|
|
4463
|
-
console.error(
|
|
4478
|
+
} catch (err) {
|
|
4479
|
+
console.error(
|
|
4480
|
+
`Failed to import tools
|
|
4481
|
+
reason: ${err.message}
|
|
4482
|
+
${err.stack.split("\n").slice(1).join("\n")}
|
|
4483
|
+
`,
|
|
4484
|
+
err
|
|
4485
|
+
);
|
|
4464
4486
|
}
|
|
4465
4487
|
app.use("*", async function setTelemetryInfo(c2, next) {
|
|
4466
4488
|
const requestId = c2.req.header("x-request-id") ?? crypto.randomUUID();
|
|
@@ -4552,7 +4574,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4552
4574
|
middlewares.push(...Array.isArray(route.middleware) ? route.middleware : [route.middleware]);
|
|
4553
4575
|
}
|
|
4554
4576
|
if (route.openapi) {
|
|
4555
|
-
middlewares.push(
|
|
4577
|
+
middlewares.push(w(route.openapi));
|
|
4556
4578
|
}
|
|
4557
4579
|
const handler = "handler" in route ? route.handler : await route.createHandler({ mastra });
|
|
4558
4580
|
if (route.method === "GET") {
|
|
@@ -4573,7 +4595,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4573
4595
|
}
|
|
4574
4596
|
app.get(
|
|
4575
4597
|
"/.well-known/:agentId/agent.json",
|
|
4576
|
-
|
|
4598
|
+
w({
|
|
4577
4599
|
description: "Get agent configuration",
|
|
4578
4600
|
tags: ["agents"],
|
|
4579
4601
|
parameters: [
|
|
@@ -4594,7 +4616,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4594
4616
|
);
|
|
4595
4617
|
app.post(
|
|
4596
4618
|
"/a2a/:agentId",
|
|
4597
|
-
|
|
4619
|
+
w({
|
|
4598
4620
|
description: "Execute agent via A2A protocol",
|
|
4599
4621
|
tags: ["agents"],
|
|
4600
4622
|
parameters: [
|
|
@@ -4709,7 +4731,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4709
4731
|
);
|
|
4710
4732
|
app.get(
|
|
4711
4733
|
"/api",
|
|
4712
|
-
|
|
4734
|
+
w({
|
|
4713
4735
|
description: "Get API status",
|
|
4714
4736
|
tags: ["system"],
|
|
4715
4737
|
responses: {
|
|
@@ -4722,7 +4744,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4722
4744
|
);
|
|
4723
4745
|
app.get(
|
|
4724
4746
|
"/api/agents",
|
|
4725
|
-
|
|
4747
|
+
w({
|
|
4726
4748
|
description: "Get all available agents",
|
|
4727
4749
|
tags: ["agents"],
|
|
4728
4750
|
responses: {
|
|
@@ -4735,7 +4757,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4735
4757
|
);
|
|
4736
4758
|
app.get(
|
|
4737
4759
|
"/api/networks",
|
|
4738
|
-
|
|
4760
|
+
w({
|
|
4739
4761
|
description: "Get all available networks",
|
|
4740
4762
|
tags: ["networks"],
|
|
4741
4763
|
responses: {
|
|
@@ -4748,7 +4770,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4748
4770
|
);
|
|
4749
4771
|
app.get(
|
|
4750
4772
|
"/api/networks/:networkId",
|
|
4751
|
-
|
|
4773
|
+
w({
|
|
4752
4774
|
description: "Get network by ID",
|
|
4753
4775
|
tags: ["networks"],
|
|
4754
4776
|
parameters: [
|
|
@@ -4773,7 +4795,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4773
4795
|
app.post(
|
|
4774
4796
|
"/api/networks/:networkId/generate",
|
|
4775
4797
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
4776
|
-
|
|
4798
|
+
w({
|
|
4777
4799
|
description: "Generate a response from a network",
|
|
4778
4800
|
tags: ["networks"],
|
|
4779
4801
|
parameters: [
|
|
@@ -4821,7 +4843,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4821
4843
|
app.post(
|
|
4822
4844
|
"/api/networks/:networkId/stream",
|
|
4823
4845
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
4824
|
-
|
|
4846
|
+
w({
|
|
4825
4847
|
description: "Generate a response from a network",
|
|
4826
4848
|
tags: ["networks"],
|
|
4827
4849
|
parameters: [
|
|
@@ -4868,7 +4890,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4868
4890
|
);
|
|
4869
4891
|
app.get(
|
|
4870
4892
|
"/api/agents/:agentId",
|
|
4871
|
-
|
|
4893
|
+
w({
|
|
4872
4894
|
description: "Get agent by ID",
|
|
4873
4895
|
tags: ["agents"],
|
|
4874
4896
|
parameters: [
|
|
@@ -4892,7 +4914,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4892
4914
|
);
|
|
4893
4915
|
app.get(
|
|
4894
4916
|
"/api/agents/:agentId/evals/ci",
|
|
4895
|
-
|
|
4917
|
+
w({
|
|
4896
4918
|
description: "Get CI evals by agent ID",
|
|
4897
4919
|
tags: ["agents"],
|
|
4898
4920
|
parameters: [
|
|
@@ -4913,7 +4935,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4913
4935
|
);
|
|
4914
4936
|
app.get(
|
|
4915
4937
|
"/api/agents/:agentId/evals/live",
|
|
4916
|
-
|
|
4938
|
+
w({
|
|
4917
4939
|
description: "Get live evals by agent ID",
|
|
4918
4940
|
tags: ["agents"],
|
|
4919
4941
|
parameters: [
|
|
@@ -4935,7 +4957,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4935
4957
|
app.post(
|
|
4936
4958
|
"/api/agents/:agentId/generate",
|
|
4937
4959
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
4938
|
-
|
|
4960
|
+
w({
|
|
4939
4961
|
description: "Generate a response from an agent",
|
|
4940
4962
|
tags: ["agents"],
|
|
4941
4963
|
parameters: [
|
|
@@ -4986,7 +5008,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4986
5008
|
app.post(
|
|
4987
5009
|
"/api/agents/:agentId/stream",
|
|
4988
5010
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
4989
|
-
|
|
5011
|
+
w({
|
|
4990
5012
|
description: "Stream a response from an agent",
|
|
4991
5013
|
tags: ["agents"],
|
|
4992
5014
|
parameters: [
|
|
@@ -5038,7 +5060,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5038
5060
|
app.post(
|
|
5039
5061
|
"/api/agents/:agentId/instructions",
|
|
5040
5062
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
5041
|
-
|
|
5063
|
+
w({
|
|
5042
5064
|
description: "Update an agent's instructions",
|
|
5043
5065
|
tags: ["agents"],
|
|
5044
5066
|
parameters: [
|
|
@@ -5083,7 +5105,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5083
5105
|
app.post(
|
|
5084
5106
|
"/api/agents/:agentId/instructions/enhance",
|
|
5085
5107
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
5086
|
-
|
|
5108
|
+
w({
|
|
5087
5109
|
description: "Generate an improved system prompt from instructions",
|
|
5088
5110
|
tags: ["agents"],
|
|
5089
5111
|
parameters: [
|
|
@@ -5159,7 +5181,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5159
5181
|
c2.header("Link", '</api/agents/:agentId/voice/speakers>; rel="successor-version"');
|
|
5160
5182
|
return next();
|
|
5161
5183
|
},
|
|
5162
|
-
|
|
5184
|
+
w({
|
|
5163
5185
|
description: "[DEPRECATED] Use /api/agents/:agentId/voice/speakers instead. Get available speakers for an agent",
|
|
5164
5186
|
tags: ["agents"],
|
|
5165
5187
|
parameters: [
|
|
@@ -5201,7 +5223,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5201
5223
|
);
|
|
5202
5224
|
app.get(
|
|
5203
5225
|
"/api/agents/:agentId/voice/speakers",
|
|
5204
|
-
|
|
5226
|
+
w({
|
|
5205
5227
|
description: "Get available speakers for an agent",
|
|
5206
5228
|
tags: ["agents"],
|
|
5207
5229
|
parameters: [
|
|
@@ -5250,7 +5272,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5250
5272
|
c2.header("Link", '</api/agents/:agentId/voice/speak>; rel="successor-version"');
|
|
5251
5273
|
return next();
|
|
5252
5274
|
},
|
|
5253
|
-
|
|
5275
|
+
w({
|
|
5254
5276
|
description: "[DEPRECATED] Use /api/agents/:agentId/voice/speak instead. Convert text to speech using the agent's voice provider",
|
|
5255
5277
|
tags: ["agents"],
|
|
5256
5278
|
parameters: [
|
|
@@ -5320,7 +5342,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5320
5342
|
app.post(
|
|
5321
5343
|
"/api/agents/:agentId/voice/speak",
|
|
5322
5344
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
5323
|
-
|
|
5345
|
+
w({
|
|
5324
5346
|
description: "Convert text to speech using the agent's voice provider",
|
|
5325
5347
|
tags: ["agents"],
|
|
5326
5348
|
parameters: [
|
|
@@ -5394,7 +5416,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5394
5416
|
);
|
|
5395
5417
|
app.get(
|
|
5396
5418
|
"/api/agents/:agentId/voice/listener",
|
|
5397
|
-
|
|
5419
|
+
w({
|
|
5398
5420
|
description: "Get available listener for an agent",
|
|
5399
5421
|
tags: ["agents"],
|
|
5400
5422
|
parameters: [
|
|
@@ -5444,7 +5466,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5444
5466
|
c2.header("Link", '</api/agents/:agentId/voice/listen>; rel="successor-version"');
|
|
5445
5467
|
return next();
|
|
5446
5468
|
},
|
|
5447
|
-
|
|
5469
|
+
w({
|
|
5448
5470
|
description: "[DEPRECATED] Use /api/agents/:agentId/voice/listen instead. Convert speech to text using the agent's voice provider. Additional provider-specific options can be passed as query parameters.",
|
|
5449
5471
|
tags: ["agents"],
|
|
5450
5472
|
parameters: [
|
|
@@ -5500,7 +5522,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5500
5522
|
maxSize: 10 * 1024 * 1024
|
|
5501
5523
|
// 10 MB for audio files
|
|
5502
5524
|
}),
|
|
5503
|
-
|
|
5525
|
+
w({
|
|
5504
5526
|
description: "Convert speech to text using the agent's voice provider. Additional provider-specific options can be passed as query parameters.",
|
|
5505
5527
|
tags: ["agents"],
|
|
5506
5528
|
parameters: [
|
|
@@ -5564,7 +5586,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5564
5586
|
app.post(
|
|
5565
5587
|
"/api/agents/:agentId/tools/:toolId/execute",
|
|
5566
5588
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
5567
|
-
|
|
5589
|
+
w({
|
|
5568
5590
|
description: "Execute a tool through an agent",
|
|
5569
5591
|
tags: ["agents"],
|
|
5570
5592
|
parameters: [
|
|
@@ -5610,7 +5632,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5610
5632
|
app.post(
|
|
5611
5633
|
"/api/mcp/:serverId/mcp",
|
|
5612
5634
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
5613
|
-
|
|
5635
|
+
w({
|
|
5614
5636
|
description: "Send a message to an MCP server using Streamable HTTP",
|
|
5615
5637
|
tags: ["mcp"],
|
|
5616
5638
|
parameters: [
|
|
@@ -5639,7 +5661,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5639
5661
|
const mcpSseMessagePath = "/api/mcp/:serverId/messages";
|
|
5640
5662
|
app.get(
|
|
5641
5663
|
mcpSseBasePath,
|
|
5642
|
-
|
|
5664
|
+
w({
|
|
5643
5665
|
description: "Establish an MCP Server-Sent Events (SSE) connection with a server instance.",
|
|
5644
5666
|
tags: ["mcp"],
|
|
5645
5667
|
parameters: [
|
|
@@ -5665,7 +5687,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5665
5687
|
mcpSseMessagePath,
|
|
5666
5688
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
5667
5689
|
// Apply body limit for messages
|
|
5668
|
-
|
|
5690
|
+
w({
|
|
5669
5691
|
description: "Send a message to an MCP server over an established SSE connection.",
|
|
5670
5692
|
tags: ["mcp"],
|
|
5671
5693
|
parameters: [
|
|
@@ -5696,7 +5718,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5696
5718
|
);
|
|
5697
5719
|
app.get(
|
|
5698
5720
|
"/api/mcp/v0/servers",
|
|
5699
|
-
|
|
5721
|
+
w({
|
|
5700
5722
|
description: "List all available MCP server instances with basic information.",
|
|
5701
5723
|
tags: ["mcp"],
|
|
5702
5724
|
parameters: [
|
|
@@ -5773,7 +5795,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5773
5795
|
);
|
|
5774
5796
|
app.get(
|
|
5775
5797
|
"/api/mcp/v0/servers/:id",
|
|
5776
|
-
|
|
5798
|
+
w({
|
|
5777
5799
|
description: "Get detailed information about a specific MCP server instance.",
|
|
5778
5800
|
tags: ["mcp"],
|
|
5779
5801
|
parameters: [
|
|
@@ -5914,7 +5936,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5914
5936
|
);
|
|
5915
5937
|
app.get(
|
|
5916
5938
|
"/api/mcp/:serverId/tools",
|
|
5917
|
-
|
|
5939
|
+
w({
|
|
5918
5940
|
description: "List all tools available on a specific MCP server instance.",
|
|
5919
5941
|
tags: ["mcp"],
|
|
5920
5942
|
parameters: [
|
|
@@ -5937,7 +5959,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5937
5959
|
);
|
|
5938
5960
|
app.get(
|
|
5939
5961
|
"/api/mcp/:serverId/tools/:toolId",
|
|
5940
|
-
|
|
5962
|
+
w({
|
|
5941
5963
|
description: "Get details for a specific tool on an MCP server.",
|
|
5942
5964
|
tags: ["mcp"],
|
|
5943
5965
|
parameters: [
|
|
@@ -5956,7 +5978,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5956
5978
|
app.post(
|
|
5957
5979
|
"/api/mcp/:serverId/tools/:toolId/execute",
|
|
5958
5980
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
5959
|
-
|
|
5981
|
+
w({
|
|
5960
5982
|
description: "Execute a specific tool on an MCP server.",
|
|
5961
5983
|
tags: ["mcp"],
|
|
5962
5984
|
parameters: [
|
|
@@ -5989,7 +6011,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5989
6011
|
);
|
|
5990
6012
|
app.get(
|
|
5991
6013
|
"/api/memory/status",
|
|
5992
|
-
|
|
6014
|
+
w({
|
|
5993
6015
|
description: "Get memory status",
|
|
5994
6016
|
tags: ["memory"],
|
|
5995
6017
|
parameters: [
|
|
@@ -6010,7 +6032,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6010
6032
|
);
|
|
6011
6033
|
app.get(
|
|
6012
6034
|
"/api/memory/threads",
|
|
6013
|
-
|
|
6035
|
+
w({
|
|
6014
6036
|
description: "Get all threads",
|
|
6015
6037
|
tags: ["memory"],
|
|
6016
6038
|
parameters: [
|
|
@@ -6037,7 +6059,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6037
6059
|
);
|
|
6038
6060
|
app.get(
|
|
6039
6061
|
"/api/memory/threads/:threadId",
|
|
6040
|
-
|
|
6062
|
+
w({
|
|
6041
6063
|
description: "Get thread by ID",
|
|
6042
6064
|
tags: ["memory"],
|
|
6043
6065
|
parameters: [
|
|
@@ -6067,7 +6089,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6067
6089
|
);
|
|
6068
6090
|
app.get(
|
|
6069
6091
|
"/api/memory/threads/:threadId/messages",
|
|
6070
|
-
|
|
6092
|
+
w({
|
|
6071
6093
|
description: "Get messages for a thread",
|
|
6072
6094
|
tags: ["memory"],
|
|
6073
6095
|
parameters: [
|
|
@@ -6102,7 +6124,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6102
6124
|
app.post(
|
|
6103
6125
|
"/api/memory/threads",
|
|
6104
6126
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
6105
|
-
|
|
6127
|
+
w({
|
|
6106
6128
|
description: "Create a new thread",
|
|
6107
6129
|
tags: ["memory"],
|
|
6108
6130
|
parameters: [
|
|
@@ -6139,7 +6161,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6139
6161
|
);
|
|
6140
6162
|
app.patch(
|
|
6141
6163
|
"/api/memory/threads/:threadId",
|
|
6142
|
-
|
|
6164
|
+
w({
|
|
6143
6165
|
description: "Update a thread",
|
|
6144
6166
|
tags: ["memory"],
|
|
6145
6167
|
parameters: [
|
|
@@ -6177,7 +6199,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6177
6199
|
);
|
|
6178
6200
|
app.delete(
|
|
6179
6201
|
"/api/memory/threads/:threadId",
|
|
6180
|
-
|
|
6202
|
+
w({
|
|
6181
6203
|
description: "Delete a thread",
|
|
6182
6204
|
tags: ["memory"],
|
|
6183
6205
|
parameters: [
|
|
@@ -6208,7 +6230,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6208
6230
|
app.post(
|
|
6209
6231
|
"/api/memory/save-messages",
|
|
6210
6232
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
6211
|
-
|
|
6233
|
+
w({
|
|
6212
6234
|
description: "Save messages",
|
|
6213
6235
|
tags: ["memory"],
|
|
6214
6236
|
parameters: [
|
|
@@ -6246,7 +6268,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6246
6268
|
);
|
|
6247
6269
|
app.get(
|
|
6248
6270
|
"/api/telemetry",
|
|
6249
|
-
|
|
6271
|
+
w({
|
|
6250
6272
|
description: "Get all traces",
|
|
6251
6273
|
tags: ["telemetry"],
|
|
6252
6274
|
responses: {
|
|
@@ -6259,7 +6281,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6259
6281
|
);
|
|
6260
6282
|
app.post(
|
|
6261
6283
|
"/api/telemetry",
|
|
6262
|
-
|
|
6284
|
+
w({
|
|
6263
6285
|
description: "Store telemetry",
|
|
6264
6286
|
tags: ["telemetry"],
|
|
6265
6287
|
responses: {
|
|
@@ -6272,7 +6294,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6272
6294
|
);
|
|
6273
6295
|
app.get(
|
|
6274
6296
|
"/api/workflows/legacy",
|
|
6275
|
-
|
|
6297
|
+
w({
|
|
6276
6298
|
description: "Get all legacy workflows",
|
|
6277
6299
|
tags: ["legacyWorkflows"],
|
|
6278
6300
|
responses: {
|
|
@@ -6285,7 +6307,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6285
6307
|
);
|
|
6286
6308
|
app.get(
|
|
6287
6309
|
"/api/workflows/legacy/:workflowId",
|
|
6288
|
-
|
|
6310
|
+
w({
|
|
6289
6311
|
description: "Get legacy workflow by ID",
|
|
6290
6312
|
tags: ["legacyWorkflows"],
|
|
6291
6313
|
parameters: [
|
|
@@ -6309,7 +6331,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6309
6331
|
);
|
|
6310
6332
|
app.get(
|
|
6311
6333
|
"/api/workflows/legacy/:workflowId/runs",
|
|
6312
|
-
|
|
6334
|
+
w({
|
|
6313
6335
|
description: "Get all runs for a legacy workflow",
|
|
6314
6336
|
tags: ["legacyWorkflows"],
|
|
6315
6337
|
parameters: [
|
|
@@ -6335,7 +6357,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6335
6357
|
);
|
|
6336
6358
|
app.post(
|
|
6337
6359
|
"/api/workflows/legacy/:workflowId/resume",
|
|
6338
|
-
|
|
6360
|
+
w({
|
|
6339
6361
|
description: "Resume a suspended legacy workflow step",
|
|
6340
6362
|
tags: ["legacyWorkflows"],
|
|
6341
6363
|
parameters: [
|
|
@@ -6372,7 +6394,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6372
6394
|
app.post(
|
|
6373
6395
|
"/api/workflows/legacy/:workflowId/resume-async",
|
|
6374
6396
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
6375
|
-
|
|
6397
|
+
w({
|
|
6376
6398
|
description: "Resume a suspended legacy workflow step",
|
|
6377
6399
|
tags: ["legacyWorkflows"],
|
|
6378
6400
|
parameters: [
|
|
@@ -6408,7 +6430,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6408
6430
|
);
|
|
6409
6431
|
app.post(
|
|
6410
6432
|
"/api/workflows/legacy/:workflowId/create-run",
|
|
6411
|
-
|
|
6433
|
+
w({
|
|
6412
6434
|
description: "Create a new legacy workflow run",
|
|
6413
6435
|
tags: ["legacyWorkflows"],
|
|
6414
6436
|
parameters: [
|
|
@@ -6436,7 +6458,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6436
6458
|
app.post(
|
|
6437
6459
|
"/api/workflows/legacy/:workflowId/start-async",
|
|
6438
6460
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
6439
|
-
|
|
6461
|
+
w({
|
|
6440
6462
|
description: "Execute/Start a legacy workflow",
|
|
6441
6463
|
tags: ["legacyWorkflows"],
|
|
6442
6464
|
parameters: [
|
|
@@ -6479,7 +6501,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6479
6501
|
);
|
|
6480
6502
|
app.post(
|
|
6481
6503
|
"/api/workflows/legacy/:workflowId/start",
|
|
6482
|
-
|
|
6504
|
+
w({
|
|
6483
6505
|
description: "Create and start a new legacy workflow run",
|
|
6484
6506
|
tags: ["legacyWorkflows"],
|
|
6485
6507
|
parameters: [
|
|
@@ -6522,7 +6544,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6522
6544
|
);
|
|
6523
6545
|
app.get(
|
|
6524
6546
|
"/api/workflows/legacy/:workflowId/watch",
|
|
6525
|
-
|
|
6547
|
+
w({
|
|
6526
6548
|
description: "Watch legacy workflow transitions in real-time",
|
|
6527
6549
|
parameters: [
|
|
6528
6550
|
{
|
|
@@ -6549,7 +6571,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6549
6571
|
);
|
|
6550
6572
|
app.post(
|
|
6551
6573
|
"/api/workflows/:workflowId/stream",
|
|
6552
|
-
|
|
6574
|
+
w({
|
|
6553
6575
|
description: "Stream workflow in real-time",
|
|
6554
6576
|
parameters: [
|
|
6555
6577
|
{
|
|
@@ -6596,7 +6618,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6596
6618
|
);
|
|
6597
6619
|
app.get(
|
|
6598
6620
|
"/api/workflows",
|
|
6599
|
-
|
|
6621
|
+
w({
|
|
6600
6622
|
description: "Get all workflows",
|
|
6601
6623
|
tags: ["workflows"],
|
|
6602
6624
|
responses: {
|
|
@@ -6609,7 +6631,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6609
6631
|
);
|
|
6610
6632
|
app.get(
|
|
6611
6633
|
"/api/workflows/:workflowId",
|
|
6612
|
-
|
|
6634
|
+
w({
|
|
6613
6635
|
description: "Get workflow by ID",
|
|
6614
6636
|
tags: ["workflows"],
|
|
6615
6637
|
parameters: [
|
|
@@ -6633,7 +6655,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6633
6655
|
);
|
|
6634
6656
|
app.get(
|
|
6635
6657
|
"/api/workflows/:workflowId/runs",
|
|
6636
|
-
|
|
6658
|
+
w({
|
|
6637
6659
|
description: "Get all runs for a workflow",
|
|
6638
6660
|
tags: ["workflows"],
|
|
6639
6661
|
parameters: [
|
|
@@ -6659,7 +6681,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6659
6681
|
);
|
|
6660
6682
|
app.post(
|
|
6661
6683
|
"/api/workflows/:workflowId/resume",
|
|
6662
|
-
|
|
6684
|
+
w({
|
|
6663
6685
|
description: "Resume a suspended workflow step",
|
|
6664
6686
|
tags: ["workflows"],
|
|
6665
6687
|
parameters: [
|
|
@@ -6703,7 +6725,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6703
6725
|
app.post(
|
|
6704
6726
|
"/api/workflows/:workflowId/resume-async",
|
|
6705
6727
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
6706
|
-
|
|
6728
|
+
w({
|
|
6707
6729
|
description: "Resume a suspended workflow step",
|
|
6708
6730
|
tags: ["workflows"],
|
|
6709
6731
|
parameters: [
|
|
@@ -6747,7 +6769,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6747
6769
|
app.post(
|
|
6748
6770
|
"/api/workflows/:workflowId/create-run",
|
|
6749
6771
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
6750
|
-
|
|
6772
|
+
w({
|
|
6751
6773
|
description: "Create a new workflow run",
|
|
6752
6774
|
tags: ["workflows"],
|
|
6753
6775
|
parameters: [
|
|
@@ -6775,7 +6797,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6775
6797
|
app.post(
|
|
6776
6798
|
"/api/workflows/:workflowId/start-async",
|
|
6777
6799
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
6778
|
-
|
|
6800
|
+
w({
|
|
6779
6801
|
description: "Execute/Start a workflow",
|
|
6780
6802
|
tags: ["workflows"],
|
|
6781
6803
|
parameters: [
|
|
@@ -6822,7 +6844,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6822
6844
|
);
|
|
6823
6845
|
app.post(
|
|
6824
6846
|
"/api/workflows/:workflowId/start",
|
|
6825
|
-
|
|
6847
|
+
w({
|
|
6826
6848
|
description: "Create and start a new workflow run",
|
|
6827
6849
|
tags: ["workflows"],
|
|
6828
6850
|
parameters: [
|
|
@@ -6869,7 +6891,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6869
6891
|
);
|
|
6870
6892
|
app.get(
|
|
6871
6893
|
"/api/workflows/:workflowId/watch",
|
|
6872
|
-
|
|
6894
|
+
w({
|
|
6873
6895
|
description: "Watch workflow transitions in real-time",
|
|
6874
6896
|
parameters: [
|
|
6875
6897
|
{
|
|
@@ -6896,7 +6918,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6896
6918
|
);
|
|
6897
6919
|
app.get(
|
|
6898
6920
|
"/api/logs",
|
|
6899
|
-
|
|
6921
|
+
w({
|
|
6900
6922
|
description: "Get all logs",
|
|
6901
6923
|
tags: ["logs"],
|
|
6902
6924
|
parameters: [
|
|
@@ -6905,11 +6927,47 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6905
6927
|
in: "query",
|
|
6906
6928
|
required: true,
|
|
6907
6929
|
schema: { type: "string" }
|
|
6930
|
+
},
|
|
6931
|
+
{
|
|
6932
|
+
name: "fromDate",
|
|
6933
|
+
in: "query",
|
|
6934
|
+
required: false,
|
|
6935
|
+
schema: { type: "string" }
|
|
6936
|
+
},
|
|
6937
|
+
{
|
|
6938
|
+
name: "toDate",
|
|
6939
|
+
in: "query",
|
|
6940
|
+
required: false,
|
|
6941
|
+
schema: { type: "string" }
|
|
6942
|
+
},
|
|
6943
|
+
{
|
|
6944
|
+
name: "logLevel",
|
|
6945
|
+
in: "query",
|
|
6946
|
+
required: false,
|
|
6947
|
+
schema: { type: "string" }
|
|
6948
|
+
},
|
|
6949
|
+
{
|
|
6950
|
+
name: "filters",
|
|
6951
|
+
in: "query",
|
|
6952
|
+
required: false,
|
|
6953
|
+
schema: { type: "string" }
|
|
6954
|
+
},
|
|
6955
|
+
{
|
|
6956
|
+
name: "page",
|
|
6957
|
+
in: "query",
|
|
6958
|
+
required: false,
|
|
6959
|
+
schema: { type: "number" }
|
|
6960
|
+
},
|
|
6961
|
+
{
|
|
6962
|
+
name: "perPage",
|
|
6963
|
+
in: "query",
|
|
6964
|
+
required: false,
|
|
6965
|
+
schema: { type: "number" }
|
|
6908
6966
|
}
|
|
6909
6967
|
],
|
|
6910
6968
|
responses: {
|
|
6911
6969
|
200: {
|
|
6912
|
-
description: "
|
|
6970
|
+
description: "Paginated list of all logs"
|
|
6913
6971
|
}
|
|
6914
6972
|
}
|
|
6915
6973
|
}),
|
|
@@ -6917,7 +6975,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6917
6975
|
);
|
|
6918
6976
|
app.get(
|
|
6919
6977
|
"/api/logs/transports",
|
|
6920
|
-
|
|
6978
|
+
w({
|
|
6921
6979
|
description: "List of all log transports",
|
|
6922
6980
|
tags: ["logs"],
|
|
6923
6981
|
responses: {
|
|
@@ -6930,7 +6988,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6930
6988
|
);
|
|
6931
6989
|
app.get(
|
|
6932
6990
|
"/api/logs/:runId",
|
|
6933
|
-
|
|
6991
|
+
w({
|
|
6934
6992
|
description: "Get logs by run ID",
|
|
6935
6993
|
tags: ["logs"],
|
|
6936
6994
|
parameters: [
|
|
@@ -6945,11 +7003,47 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6945
7003
|
in: "query",
|
|
6946
7004
|
required: true,
|
|
6947
7005
|
schema: { type: "string" }
|
|
7006
|
+
},
|
|
7007
|
+
{
|
|
7008
|
+
name: "fromDate",
|
|
7009
|
+
in: "query",
|
|
7010
|
+
required: false,
|
|
7011
|
+
schema: { type: "string" }
|
|
7012
|
+
},
|
|
7013
|
+
{
|
|
7014
|
+
name: "toDate",
|
|
7015
|
+
in: "query",
|
|
7016
|
+
required: false,
|
|
7017
|
+
schema: { type: "string" }
|
|
7018
|
+
},
|
|
7019
|
+
{
|
|
7020
|
+
name: "logLevel",
|
|
7021
|
+
in: "query",
|
|
7022
|
+
required: false,
|
|
7023
|
+
schema: { type: "string" }
|
|
7024
|
+
},
|
|
7025
|
+
{
|
|
7026
|
+
name: "filters",
|
|
7027
|
+
in: "query",
|
|
7028
|
+
required: false,
|
|
7029
|
+
schema: { type: "string" }
|
|
7030
|
+
},
|
|
7031
|
+
{
|
|
7032
|
+
name: "page",
|
|
7033
|
+
in: "query",
|
|
7034
|
+
required: false,
|
|
7035
|
+
schema: { type: "number" }
|
|
7036
|
+
},
|
|
7037
|
+
{
|
|
7038
|
+
name: "perPage",
|
|
7039
|
+
in: "query",
|
|
7040
|
+
required: false,
|
|
7041
|
+
schema: { type: "number" }
|
|
6948
7042
|
}
|
|
6949
7043
|
],
|
|
6950
7044
|
responses: {
|
|
6951
7045
|
200: {
|
|
6952
|
-
description: "
|
|
7046
|
+
description: "Paginated list of logs for run ID"
|
|
6953
7047
|
}
|
|
6954
7048
|
}
|
|
6955
7049
|
}),
|
|
@@ -6957,7 +7051,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6957
7051
|
);
|
|
6958
7052
|
app.get(
|
|
6959
7053
|
"/api/tools",
|
|
6960
|
-
|
|
7054
|
+
w({
|
|
6961
7055
|
description: "Get all tools",
|
|
6962
7056
|
tags: ["tools"],
|
|
6963
7057
|
responses: {
|
|
@@ -6970,7 +7064,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6970
7064
|
);
|
|
6971
7065
|
app.get(
|
|
6972
7066
|
"/api/tools/:toolId",
|
|
6973
|
-
|
|
7067
|
+
w({
|
|
6974
7068
|
description: "Get tool by ID",
|
|
6975
7069
|
tags: ["tools"],
|
|
6976
7070
|
parameters: [
|
|
@@ -6995,7 +7089,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
6995
7089
|
app.post(
|
|
6996
7090
|
"/api/tools/:toolId/execute",
|
|
6997
7091
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
6998
|
-
|
|
7092
|
+
w({
|
|
6999
7093
|
description: "Execute a tool",
|
|
7000
7094
|
tags: ["tools"],
|
|
7001
7095
|
parameters: [
|
|
@@ -7041,7 +7135,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
7041
7135
|
app.post(
|
|
7042
7136
|
"/api/vector/:vectorName/upsert",
|
|
7043
7137
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
7044
|
-
|
|
7138
|
+
w({
|
|
7045
7139
|
description: "Upsert vectors into an index",
|
|
7046
7140
|
tags: ["vector"],
|
|
7047
7141
|
parameters: [
|
|
@@ -7092,7 +7186,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
7092
7186
|
app.post(
|
|
7093
7187
|
"/api/vector/:vectorName/create-index",
|
|
7094
7188
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
7095
|
-
|
|
7189
|
+
w({
|
|
7096
7190
|
description: "Create a new vector index",
|
|
7097
7191
|
tags: ["vector"],
|
|
7098
7192
|
parameters: [
|
|
@@ -7133,7 +7227,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
7133
7227
|
app.post(
|
|
7134
7228
|
"/api/vector/:vectorName/query",
|
|
7135
7229
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
7136
|
-
|
|
7230
|
+
w({
|
|
7137
7231
|
description: "Query vectors from an index",
|
|
7138
7232
|
tags: ["vector"],
|
|
7139
7233
|
parameters: [
|
|
@@ -7175,7 +7269,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
7175
7269
|
);
|
|
7176
7270
|
app.get(
|
|
7177
7271
|
"/api/vector/:vectorName/indexes",
|
|
7178
|
-
|
|
7272
|
+
w({
|
|
7179
7273
|
description: "List all indexes for a vector store",
|
|
7180
7274
|
tags: ["vector"],
|
|
7181
7275
|
parameters: [
|
|
@@ -7196,7 +7290,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
7196
7290
|
);
|
|
7197
7291
|
app.get(
|
|
7198
7292
|
"/api/vector/:vectorName/indexes/:indexName",
|
|
7199
|
-
|
|
7293
|
+
w({
|
|
7200
7294
|
description: "Get details about a specific index",
|
|
7201
7295
|
tags: ["vector"],
|
|
7202
7296
|
parameters: [
|
|
@@ -7223,7 +7317,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
7223
7317
|
);
|
|
7224
7318
|
app.delete(
|
|
7225
7319
|
"/api/vector/:vectorName/indexes/:indexName",
|
|
7226
|
-
|
|
7320
|
+
w({
|
|
7227
7321
|
description: "Delete a specific index",
|
|
7228
7322
|
tags: ["vector"],
|
|
7229
7323
|
parameters: [
|
|
@@ -7251,7 +7345,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
7251
7345
|
if (options?.isDev || server?.build?.openAPIDocs || server?.build?.swaggerUI) {
|
|
7252
7346
|
app.get(
|
|
7253
7347
|
"/openapi.json",
|
|
7254
|
-
|
|
7348
|
+
h(app, {
|
|
7255
7349
|
documentation: {
|
|
7256
7350
|
info: { title: "Mastra API", version: "1.0.0", description: "Mastra API" }
|
|
7257
7351
|
}
|
|
@@ -7325,6 +7419,13 @@ async function createNodeServer(mastra, options = {}) {
|
|
|
7325
7419
|
if (options?.playground) {
|
|
7326
7420
|
logger2.info(`\u{1F468}\u200D\u{1F4BB} Playground available at http://${host}:${port}/`);
|
|
7327
7421
|
}
|
|
7422
|
+
if (process.send) {
|
|
7423
|
+
process.send({
|
|
7424
|
+
type: "server-ready",
|
|
7425
|
+
port,
|
|
7426
|
+
host
|
|
7427
|
+
});
|
|
7428
|
+
}
|
|
7328
7429
|
}
|
|
7329
7430
|
);
|
|
7330
7431
|
return server;
|