@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.
@@ -3,7 +3,7 @@ import { readFile } from 'fs/promises';
3
3
  import { join } from 'path/posix';
4
4
  import { createServer } from 'http';
5
5
  import { Http2ServerRequest } from 'http2';
6
- import { Readable } from 'stream';
6
+ import { Writable, Readable } from 'stream';
7
7
  import { getFilePathWithoutDefaultDocument, getFilePath } from 'hono/utils/filepath';
8
8
  import { getMimeType } from 'hono/utils/mime';
9
9
  import { createReadStream, lstatSync } from 'fs';
@@ -21,9 +21,8 @@ import { stream } from 'hono/streaming';
21
21
  import { getAgentsHandler as getAgentsHandler$1, getAgentByIdHandler as getAgentByIdHandler$1, getEvalsByAgentIdHandler as getEvalsByAgentIdHandler$1, getLiveEvalsByAgentIdHandler as getLiveEvalsByAgentIdHandler$1, generateHandler as generateHandler$2, streamGenerateHandler as streamGenerateHandler$2 } from '@mastra/server/handlers/agents';
22
22
  import { getLegacyWorkflowsHandler as getLegacyWorkflowsHandler$1, getLegacyWorkflowByIdHandler as getLegacyWorkflowByIdHandler$1, getLegacyWorkflowRunsHandler as getLegacyWorkflowRunsHandler$1, resumeLegacyWorkflowHandler as resumeLegacyWorkflowHandler$1, resumeAsyncLegacyWorkflowHandler as resumeAsyncLegacyWorkflowHandler$1, createLegacyWorkflowRunHandler as createLegacyWorkflowRunHandler$1, startAsyncLegacyWorkflowHandler as startAsyncLegacyWorkflowHandler$1, startLegacyWorkflowRunHandler as startLegacyWorkflowRunHandler$1, watchLegacyWorkflowHandler as watchLegacyWorkflowHandler$1 } from '@mastra/server/handlers/legacyWorkflows';
23
23
  import { getLogsHandler as getLogsHandler$1, getLogTransports as getLogTransports$1, getLogsByRunIdHandler as getLogsByRunIdHandler$1 } from '@mastra/server/handlers/logs';
24
- import { Writable, Readable as Readable$1 } from 'node:stream';
25
- import util from 'node:util';
26
- import { Buffer as Buffer$1 } from 'node:buffer';
24
+ import util from 'util';
25
+ import { Buffer as Buffer$1 } from 'buffer';
27
26
  import { getMemoryStatusHandler as getMemoryStatusHandler$1, getThreadsHandler as getThreadsHandler$1, getThreadByIdHandler as getThreadByIdHandler$1, getMessagesHandler as getMessagesHandler$1, createThreadHandler as createThreadHandler$1, updateThreadHandler as updateThreadHandler$1, deleteThreadHandler as deleteThreadHandler$1, saveMessagesHandler as saveMessagesHandler$1 } from '@mastra/server/handlers/memory';
28
27
  import { getNetworksHandler as getNetworksHandler$1, getNetworkByIdHandler as getNetworkByIdHandler$1, generateHandler as generateHandler$1, streamGenerateHandler as streamGenerateHandler$1 } from '@mastra/server/handlers/network';
29
28
  import { Agent } from '@mastra/core/agent';
@@ -36,9 +35,9 @@ import { streamWorkflowHandler as streamWorkflowHandler$1, getWorkflowsHandler a
36
35
 
37
36
  // src/server/index.ts
38
37
  var RequestError = class extends Error {
39
- static name = "RequestError";
40
38
  constructor(message, options) {
41
39
  super(message, options);
40
+ this.name = "RequestError";
42
41
  }
43
42
  };
44
43
  var toRequestError = (e2) => {
@@ -191,6 +190,72 @@ var newRequest = (incoming, defaultHostname) => {
191
190
  req[urlKey] = url.href;
192
191
  return req;
193
192
  };
193
+ var responseCache = Symbol("responseCache");
194
+ var getResponseCache = Symbol("getResponseCache");
195
+ var cacheKey = Symbol("cache");
196
+ var GlobalResponse = global.Response;
197
+ var Response2 = class _Response {
198
+ #body;
199
+ #init;
200
+ [getResponseCache]() {
201
+ delete this[cacheKey];
202
+ return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
203
+ }
204
+ constructor(body, init) {
205
+ let headers;
206
+ this.#body = body;
207
+ if (init instanceof _Response) {
208
+ const cachedGlobalResponse = init[responseCache];
209
+ if (cachedGlobalResponse) {
210
+ this.#init = cachedGlobalResponse;
211
+ this[getResponseCache]();
212
+ return;
213
+ } else {
214
+ this.#init = init.#init;
215
+ headers = new Headers(init.#init.headers);
216
+ }
217
+ } else {
218
+ this.#init = init;
219
+ }
220
+ if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
221
+ headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" };
222
+ this[cacheKey] = [init?.status || 200, body, headers];
223
+ }
224
+ }
225
+ get headers() {
226
+ const cache = this[cacheKey];
227
+ if (cache) {
228
+ if (!(cache[2] instanceof Headers)) {
229
+ cache[2] = new Headers(cache[2]);
230
+ }
231
+ return cache[2];
232
+ }
233
+ return this[getResponseCache]().headers;
234
+ }
235
+ get status() {
236
+ return this[cacheKey]?.[0] ?? this[getResponseCache]().status;
237
+ }
238
+ get ok() {
239
+ const status = this.status;
240
+ return status >= 200 && status < 300;
241
+ }
242
+ };
243
+ ["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => {
244
+ Object.defineProperty(Response2.prototype, k, {
245
+ get() {
246
+ return this[getResponseCache]()[k];
247
+ }
248
+ });
249
+ });
250
+ ["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
251
+ Object.defineProperty(Response2.prototype, k, {
252
+ value: function() {
253
+ return this[getResponseCache]()[k]();
254
+ }
255
+ });
256
+ });
257
+ Object.setPrototypeOf(Response2, GlobalResponse);
258
+ Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
194
259
  function writeFromReadableStream(stream4, writable) {
195
260
  if (stream4.locked) {
196
261
  throw new TypeError("ReadableStream is locked.");
@@ -249,83 +314,6 @@ var buildOutgoingHttpHeaders = (headers) => {
249
314
  res["content-type"] ??= "text/plain; charset=UTF-8";
250
315
  return res;
251
316
  };
252
- var responseCache = Symbol("responseCache");
253
- var getResponseCache = Symbol("getResponseCache");
254
- var cacheKey = Symbol("cache");
255
- var GlobalResponse = global.Response;
256
- var Response2 = class _Response {
257
- #body;
258
- #init;
259
- [getResponseCache]() {
260
- delete this[cacheKey];
261
- return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
262
- }
263
- constructor(body, init) {
264
- this.#body = body;
265
- if (init instanceof _Response) {
266
- const cachedGlobalResponse = init[responseCache];
267
- if (cachedGlobalResponse) {
268
- this.#init = cachedGlobalResponse;
269
- this[getResponseCache]();
270
- return;
271
- } else {
272
- this.#init = init.#init;
273
- }
274
- } else {
275
- this.#init = init;
276
- }
277
- if (typeof body === "string" || typeof body?.getReader !== "undefined") {
278
- let headers = init?.headers || { "content-type": "text/plain; charset=UTF-8" };
279
- if (headers instanceof Headers) {
280
- headers = buildOutgoingHttpHeaders(headers);
281
- }
282
- this[cacheKey] = [init?.status || 200, body, headers];
283
- }
284
- }
285
- };
286
- [
287
- "body",
288
- "bodyUsed",
289
- "headers",
290
- "ok",
291
- "redirected",
292
- "status",
293
- "statusText",
294
- "trailers",
295
- "type",
296
- "url"
297
- ].forEach((k) => {
298
- Object.defineProperty(Response2.prototype, k, {
299
- get() {
300
- return this[getResponseCache]()[k];
301
- }
302
- });
303
- });
304
- ["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
305
- Object.defineProperty(Response2.prototype, k, {
306
- value: function() {
307
- return this[getResponseCache]()[k]();
308
- }
309
- });
310
- });
311
- Object.setPrototypeOf(Response2, GlobalResponse);
312
- Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
313
- var stateKey = Reflect.ownKeys(new GlobalResponse()).find(
314
- (k) => typeof k === "symbol" && k.toString() === "Symbol(state)"
315
- );
316
- if (!stateKey) {
317
- console.warn("Failed to find Response internal state key");
318
- }
319
- function getInternalBody(response) {
320
- if (!stateKey) {
321
- return;
322
- }
323
- if (response instanceof Response2) {
324
- response = response[getResponseCache]();
325
- }
326
- const state = response[stateKey];
327
- return state && state.body || void 0;
328
- }
329
317
  var X_ALREADY_SENT = "x-hono-already-sent";
330
318
  var webFetch = global.fetch;
331
319
  if (typeof global.crypto === "undefined") {
@@ -361,14 +349,24 @@ var handleResponseError = (e2, outgoing) => {
361
349
  outgoing.destroy(err);
362
350
  }
363
351
  };
364
- var responseViaCache = (res, outgoing) => {
365
- const [status, body, header] = res[cacheKey];
352
+ var responseViaCache = async (res, outgoing) => {
353
+ let [status, body, header] = res[cacheKey];
354
+ if (header instanceof Headers) {
355
+ header = buildOutgoingHttpHeaders(header);
356
+ }
366
357
  if (typeof body === "string") {
367
358
  header["Content-Length"] = Buffer.byteLength(body);
368
- outgoing.writeHead(status, header);
359
+ } else if (body instanceof Uint8Array) {
360
+ header["Content-Length"] = body.byteLength;
361
+ } else if (body instanceof Blob) {
362
+ header["Content-Length"] = body.size;
363
+ }
364
+ outgoing.writeHead(status, header);
365
+ if (typeof body === "string" || body instanceof Uint8Array) {
369
366
  outgoing.end(body);
367
+ } else if (body instanceof Blob) {
368
+ outgoing.end(new Uint8Array(await body.arrayBuffer()));
370
369
  } else {
371
- outgoing.writeHead(status, header);
372
370
  return writeFromReadableStream(body, outgoing)?.catch(
373
371
  (e2) => handleResponseError(e2, outgoing)
374
372
  );
@@ -394,24 +392,6 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
394
392
  return responseViaCache(res, outgoing);
395
393
  }
396
394
  const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
397
- const internalBody = getInternalBody(res);
398
- if (internalBody) {
399
- const { length, source, stream: stream4 } = internalBody;
400
- if (source instanceof Uint8Array && source.byteLength !== length) ; else {
401
- if (length) {
402
- resHeaderRecord["content-length"] = length;
403
- }
404
- outgoing.writeHead(res.status, resHeaderRecord);
405
- if (typeof source === "string" || source instanceof Uint8Array) {
406
- outgoing.end(source);
407
- } else if (source instanceof Blob) {
408
- outgoing.end(new Uint8Array(await source.arrayBuffer()));
409
- } else {
410
- await writeFromReadableStream(stream4, outgoing);
411
- }
412
- return;
413
- }
414
- }
415
395
  if (res.body) {
416
396
  const {
417
397
  "transfer-encoding": transferEncoding,
@@ -742,131 +722,148 @@ var middleware = (options) => async (c2) => {
742
722
  );
743
723
  };
744
724
 
745
- // ../../node_modules/.pnpm/hono-openapi@0.4.6_hono@4.7.7_openapi-types@12.1.3_zod@3.24.4/node_modules/hono-openapi/utils.js
725
+ // ../../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
746
726
  var e = Symbol("openapi");
747
- var s2 = ["GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE"];
748
- var n = (e2) => e2.charAt(0).toUpperCase() + e2.slice(1);
727
+ var n = ["GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE"];
728
+ var s2 = (e2) => e2.charAt(0).toUpperCase() + e2.slice(1);
749
729
  var o = /* @__PURE__ */ new Map();
750
730
  var a = (e2, t2) => {
751
- const s3 = `${e2}:${t2}`;
752
- if (o.has(s3)) return o.get(s3);
731
+ const n2 = `${e2}:${t2}`;
732
+ if (o.has(n2)) return o.get(n2);
753
733
  let a2 = e2;
754
734
  if ("/" === t2) return `${a2}Index`;
755
- for (const e3 of t2.split("/")) 123 === e3.charCodeAt(0) ? a2 += `By${n(e3.slice(1, -1))}` : a2 += n(e3);
756
- return o.set(s3, a2), a2;
735
+ for (const e3 of t2.split("/")) 123 === e3.charCodeAt(0) ? a2 += `By${s2(e3.slice(1, -1))}` : a2 += s2(e3);
736
+ return o.set(n2, a2), a2;
757
737
  };
758
738
  var r = /* @__PURE__ */ new Map();
759
- function c(e2, t2, s3) {
760
- return e2 && t2 in e2 ? e2[t2] ?? s3 : s3;
739
+ function c(e2, t2, n2) {
740
+ return e2 && t2 in e2 ? e2[t2] ?? n2 : n2;
761
741
  }
762
742
  function i(...e2) {
763
743
  return e2.reduce((e3, t2) => {
764
744
  if (!t2) return e3;
765
- let s3;
766
- return ("tags" in e3 && e3.tags || "tags" in t2 && t2.tags) && (s3 = [...c(e3, "tags", []), ...c(t2, "tags", [])]), { ...e3, ...t2, tags: s3, responses: { ...c(e3, "responses", {}), ...c(t2, "responses", {}) }, parameters: m(e3.parameters, t2.parameters) };
745
+ let n2;
746
+ 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) };
767
747
  }, {});
768
748
  }
769
- function p({ path: e2, method: t2, data: s3, schema: n2 }) {
749
+ function p({ path: e2, method: t2, data: n2, schema: s3 }) {
770
750
  e2 = ((e3) => e3.split("/").map((e4) => {
771
751
  let t3 = e4;
772
- return t3.startsWith(":") && (t3 = t3.slice(1, t3.length), t3.endsWith("?") && (t3 = t3.slice(0, -1)), t3 = `{${t3}}`), t3;
752
+ if (t3.startsWith(":")) {
753
+ const e5 = t3.match(/^:([^{?]+)(?:{(.+)})?(\?)?$/);
754
+ e5 ? t3 = `{${e5[1]}}` : (t3 = t3.slice(1, t3.length), t3.endsWith("?") && (t3 = t3.slice(0, -1)), t3 = `{${t3}}`);
755
+ }
756
+ return t3;
773
757
  }).join("/"))(e2);
774
758
  const o2 = t2.toLowerCase();
775
- if ("all" === o2) if (r.has(e2)) {
776
- const t3 = r.get(e2) ?? {};
777
- r.set(e2, { ...t3, ...s3, parameters: m(t3.parameters, s3.parameters) });
778
- } else r.set(e2, s3);
779
- else {
759
+ if ("all" === o2) {
760
+ if (!n2) return;
761
+ if (r.has(e2)) {
762
+ const t3 = r.get(e2) ?? {};
763
+ r.set(e2, { ...t3, ...n2, parameters: m(t3.parameters, n2.parameters) });
764
+ } else r.set(e2, n2);
765
+ } else {
780
766
  const t3 = function(e3) {
781
767
  const t4 = Array.from(r.keys());
782
- let s4 = {};
783
- for (const n3 of t4) e3.match(n3) && (s4 = i(s4, r.get(n3) ?? {}));
784
- return s4;
768
+ let n3 = {};
769
+ for (const s4 of t4) e3.match(s4) && (n3 = i(n3, r.get(s4) ?? {}));
770
+ return n3;
785
771
  }(e2);
786
- n2[e2] = { ...n2[e2] ? n2[e2] : {}, [o2]: { responses: {}, operationId: a(o2, e2), ...i(t3, n2[e2]?.[o2], s3) } };
772
+ s3[e2] = { ...s3[e2] ? s3[e2] : {}, [o2]: { responses: {}, operationId: a(o2, e2), ...i(t3, s3[e2]?.[o2], n2) } };
787
773
  }
788
774
  }
789
- var l = (e2) => "$ref" in e2 ? e2.$ref : `${e2.in} ${e2.name}`;
775
+ var f = (e2) => "$ref" in e2 ? e2.$ref : `${e2.in} ${e2.name}`;
790
776
  function m(...e2) {
791
- const t2 = e2.flatMap((e3) => e3 ?? []).reduce((e3, t3) => (e3.set(l(t3), t3), e3), /* @__PURE__ */ new Map());
777
+ const t2 = e2.flatMap((e3) => e3 ?? []).reduce((e3, t3) => (e3.set(f(t3), t3), e3), /* @__PURE__ */ new Map());
792
778
  return Array.from(t2.values());
793
779
  }
794
- function u(e2, { excludeStaticFile: t2 = true, exclude: s3 = [] }) {
795
- const n2 = {}, o2 = Array.isArray(s3) ? s3 : [s3];
796
- for (const [s4, a2] of Object.entries(e2)) if (!(o2.some((e3) => "string" == typeof e3 ? s4 === e3 : e3.test(s4)) || s4.includes("*") || t2 && s4.includes("."))) {
780
+ function l(e2, { excludeStaticFile: t2 = true, exclude: n2 = [] }) {
781
+ const s3 = {}, o2 = Array.isArray(n2) ? n2 : [n2];
782
+ 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("{")))) {
797
783
  for (const e3 of Object.keys(a2)) {
798
784
  const t3 = a2[e3];
799
- if (s4.includes("{")) {
785
+ if (n3.includes("{")) {
800
786
  t3.parameters || (t3.parameters = []);
801
- const e4 = s4.split("/").filter((e5) => e5.startsWith("{") && !t3.parameters.find((t4) => "path" === t4.in && t4.name === e5.slice(1, e5.length - 1)));
802
- for (const s5 of e4) {
803
- const e5 = s5.slice(1, s5.length - 1), n3 = t3.parameters.findIndex((t4) => "param" === t4.in && t4.name === e5);
804
- -1 !== n3 ? t3.parameters[n3].in = "path" : t3.parameters.push({ schema: { type: "string" }, in: "path", name: e5, required: true });
787
+ const e4 = n3.split("/").filter((e5) => e5.startsWith("{") && !t3.parameters.find((t4) => "path" === t4.in && t4.name === e5.slice(1, e5.length - 1)));
788
+ for (const n4 of e4) {
789
+ const e5 = n4.slice(1, n4.length - 1), s4 = t3.parameters.findIndex((t4) => "param" === t4.in && t4.name === e5);
790
+ -1 !== s4 ? t3.parameters[s4].in = "path" : t3.parameters.push({ schema: { type: "string" }, in: "path", name: e5, required: true });
805
791
  }
806
792
  }
807
793
  t3.responses || (t3.responses = { 200: {} });
808
794
  }
809
- n2[s4] = a2;
795
+ s3[n3] = a2;
810
796
  }
811
- return n2;
797
+ return s3;
812
798
  }
813
- function f(e2, t2) {
814
- const s3 = { version: "3.1.0", components: {} };
815
- let n2 = null;
816
- return async (o2) => (n2 || (n2 = await d(e2, t2, s3, o2)), o2.json(n2));
799
+ var u = { documentation: {}, excludeStaticFile: true, exclude: [], excludeMethods: ["OPTIONS"], excludeTags: [] };
800
+ var d = { version: "3.1.0", components: {} };
801
+ function h(e2, t2) {
802
+ const n2 = { version: "3.1.0", components: {} };
803
+ let s3;
804
+ return async (o2) => (s3 || (s3 = await y(e2, t2, n2, o2)), o2.json(s3));
817
805
  }
818
- async function d(t2, { documentation: n2 = {}, excludeStaticFile: o2 = true, exclude: a2 = [], excludeMethods: r2 = ["OPTIONS"], excludeTags: c2 = [], defaultOptions: i2 } = { documentation: {}, excludeStaticFile: true, exclude: [], excludeMethods: ["OPTIONS"], excludeTags: [] }, { version: l2 = "3.1.0", components: m2 = {} } = { version: "3.1.0", components: {} }, f2) {
819
- const d2 = { version: l2, components: m2 }, h2 = {};
820
- for (const n3 of t2.routes) {
821
- if (!(e in n3.handler)) continue;
822
- if (r2.includes(n3.method)) continue;
823
- if (false === s2.includes(n3.method) && "ALL" !== n3.method) continue;
824
- const { resolver: t3, metadata: o3 = {} } = n3.handler[e], a3 = i2?.[n3.method], { docs: c3, components: l3 } = await t3({ ...d2, ...o3 }, a3);
825
- d2.components = { ...d2.components, ...l3 ?? {} }, p({ method: n3.method, path: n3.path, data: c3, schema: h2 });
826
- }
827
- for (const e2 in h2) for (const t3 in h2[e2]) {
828
- const s3 = h2[e2][t3]?.hide;
829
- s3 && ("boolean" == typeof s3 ? s3 : f2 && s3(f2)) && delete h2[e2][t3];
830
- }
831
- return { openapi: d2.version, ...{ ...n2, tags: n2.tags?.filter((e2) => !c2?.includes(e2?.name)), info: { title: "Hono Documentation", description: "Development documentation", version: "0.0.0", ...n2.info }, paths: { ...u(h2, { excludeStaticFile: o2, exclude: a2 }), ...n2.paths }, components: { ...n2.components, schemas: { ...d2.components, ...n2.components?.schemas } } } };
806
+ async function y(t2, s3 = u, o2 = d, a2) {
807
+ const r2 = { ...u, ...s3 }, c2 = { ...d, ...o2 }, i2 = r2.documentation ?? {}, f2 = await async function(t3, s4, o3) {
808
+ const a3 = {};
809
+ for (const r3 of t3.routes) {
810
+ if (!(e in r3.handler)) {
811
+ s4.includeEmptyPaths && p({ method: r3.method, path: r3.path, schema: a3 });
812
+ continue;
813
+ }
814
+ if (s4.excludeMethods.includes(r3.method)) continue;
815
+ if (false === n.includes(r3.method) && "ALL" !== r3.method) continue;
816
+ const { resolver: t4, metadata: c3 = {} } = r3.handler[e], i3 = s4.defaultOptions?.[r3.method], { docs: f3, components: m2 } = await t4({ ...o3, ...c3 }, i3);
817
+ o3.components = { ...o3.components, ...m2 ?? {} }, p({ method: r3.method, path: r3.path, data: f3, schema: a3 });
818
+ }
819
+ return a3;
820
+ }(t2, r2, c2);
821
+ for (const e2 in f2) for (const t3 in f2[e2]) {
822
+ const n2 = f2[e2][t3]?.hide;
823
+ if (n2) {
824
+ let s4 = false;
825
+ "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];
826
+ }
827
+ }
828
+ 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 } } } };
832
829
  }
833
- function h(s3) {
834
- const { validateResponse: n2, ...o2 } = s3;
830
+ function w(n2) {
831
+ const { validateResponse: s3, ...o2 } = n2;
835
832
  return Object.assign(async (e2, o3) => {
836
- if (await o3(), n2 && s3.responses) {
833
+ if (await o3(), s3 && n2.responses) {
837
834
  const o4 = e2.res.status, a2 = e2.res.headers.get("content-type");
838
835
  if (o4 && a2) {
839
- const r2 = s3.responses[o4];
836
+ const r2 = n2.responses[o4];
840
837
  if (r2 && "content" in r2 && r2.content) {
841
- const s4 = a2.split(";")[0], o5 = r2.content[s4];
838
+ const n3 = a2.split(";")[0], o5 = r2.content[n3];
842
839
  if (o5?.schema && "validator" in o5.schema) try {
843
840
  let t2;
844
- const n3 = e2.res.clone();
845
- if ("application/json" === s4 ? t2 = await n3.json() : "text/plain" === s4 && (t2 = await n3.text()), !t2) throw new Error("No data to validate!");
841
+ const s4 = e2.res.clone();
842
+ if ("application/json" === n3 ? t2 = await s4.json() : "text/plain" === n3 && (t2 = await s4.text()), !t2) throw new Error("No data to validate!");
846
843
  await o5.schema.validator(t2);
847
844
  } catch (e3) {
848
- let s5 = { status: 500, message: "Response validation failed!" };
849
- throw "object" == typeof n2 && (s5 = { ...s5, ...n2 }), new HTTPException(s5.status, { message: s5.message, cause: e3 });
845
+ let n4 = { status: 500, message: "Response validation failed!" };
846
+ throw "object" == typeof s3 && (n4 = { ...n4, ...s3 }), new HTTPException(n4.status, { message: n4.message, cause: e3 });
850
847
  }
851
848
  }
852
849
  }
853
850
  }
854
851
  }, { [e]: { resolver: (e2, t2) => x(e2, o2, t2) } });
855
852
  }
856
- async function x(e2, t2, s3 = {}) {
857
- let n2 = {};
858
- const o2 = { ...s3, ...t2, responses: { ...s3?.responses, ...t2.responses } };
853
+ async function x(e2, t2, n2 = {}) {
854
+ let s3 = {};
855
+ const o2 = { ...n2, ...t2, responses: { ...n2?.responses, ...t2.responses } };
859
856
  if (o2.responses) for (const t3 of Object.keys(o2.responses)) {
860
- const s4 = o2.responses[t3];
861
- if (s4 && "content" in s4) for (const t4 of Object.keys(s4.content ?? {})) {
862
- const o3 = s4.content?.[t4];
857
+ const n3 = o2.responses[t3];
858
+ if (n3 && "content" in n3) for (const t4 of Object.keys(n3.content ?? {})) {
859
+ const o3 = n3.content?.[t4];
863
860
  if (o3 && (o3.schema && "builder" in o3.schema)) {
864
861
  const t5 = await o3.schema.builder(e2);
865
- o3.schema = t5.schema, t5.components && (n2 = { ...n2, ...t5.components });
862
+ o3.schema = t5.schema, t5.components && (s3 = { ...s3, ...t5.components });
866
863
  }
867
864
  }
868
865
  }
869
- return { docs: o2, components: n2 };
866
+ return { docs: o2, components: s3 };
870
867
  }
871
868
  async function getAgentCardByIdHandler(c2) {
872
869
  const mastra = c2.get("mastra");
@@ -1446,10 +1443,19 @@ async function getLegacyWorkflowRunsHandler(c2) {
1446
1443
  async function getLogsHandler(c2) {
1447
1444
  try {
1448
1445
  const mastra = c2.get("mastra");
1449
- const transportId = c2.req.query("transportId");
1446
+ const { transportId, fromDate, toDate, logLevel, page, perPage } = c2.req.query();
1447
+ const filters = c2.req.queries("filters");
1450
1448
  const logs = await getLogsHandler$1({
1451
1449
  mastra,
1452
- transportId
1450
+ transportId,
1451
+ params: {
1452
+ fromDate: fromDate ? new Date(fromDate) : void 0,
1453
+ toDate: toDate ? new Date(toDate) : void 0,
1454
+ logLevel: logLevel ? logLevel : void 0,
1455
+ filters,
1456
+ page: page ? Number(page) : void 0,
1457
+ perPage: perPage ? Number(perPage) : void 0
1458
+ }
1453
1459
  });
1454
1460
  return c2.json(logs);
1455
1461
  } catch (error) {
@@ -1460,11 +1466,20 @@ async function getLogsByRunIdHandler(c2) {
1460
1466
  try {
1461
1467
  const mastra = c2.get("mastra");
1462
1468
  const runId = c2.req.param("runId");
1463
- const transportId = c2.req.query("transportId");
1469
+ const { transportId, fromDate, toDate, logLevel, page, perPage } = c2.req.query();
1470
+ const filters = c2.req.queries("filters");
1464
1471
  const logs = await getLogsByRunIdHandler$1({
1465
1472
  mastra,
1466
1473
  runId,
1467
- transportId
1474
+ transportId,
1475
+ params: {
1476
+ fromDate: fromDate ? new Date(fromDate) : void 0,
1477
+ toDate: toDate ? new Date(toDate) : void 0,
1478
+ logLevel: logLevel ? logLevel : void 0,
1479
+ filters,
1480
+ page: page ? Number(page) : void 0,
1481
+ perPage: perPage ? Number(perPage) : void 0
1482
+ }
1468
1483
  });
1469
1484
  return c2.json(logs);
1470
1485
  } catch (error) {
@@ -1681,7 +1696,7 @@ var kHeadersCount = Symbol("kHeadersCount");
1681
1696
  var kTrailers = Symbol("kTrailers");
1682
1697
  var kTrailersDistinct = Symbol("kTrailersDistinct");
1683
1698
  var kTrailersCount = Symbol("kTrailersCount");
1684
- var FetchIncomingMessage = class extends Readable$1 {
1699
+ var FetchIncomingMessage = class extends Readable {
1685
1700
  get socket() {
1686
1701
  return null;
1687
1702
  }
@@ -4453,8 +4468,14 @@ async function createHonoServer(mastra, options = {}) {
4453
4468
  });
4454
4469
  return acc;
4455
4470
  }, {});
4456
- } catch {
4457
- console.error("Failed to import tools");
4471
+ } catch (err) {
4472
+ console.error(
4473
+ `Failed to import tools
4474
+ reason: ${err.message}
4475
+ ${err.stack.split("\n").slice(1).join("\n")}
4476
+ `,
4477
+ err
4478
+ );
4458
4479
  }
4459
4480
  app.use("*", async function setTelemetryInfo(c2, next) {
4460
4481
  const requestId = c2.req.header("x-request-id") ?? randomUUID();
@@ -4546,7 +4567,7 @@ async function createHonoServer(mastra, options = {}) {
4546
4567
  middlewares.push(...Array.isArray(route.middleware) ? route.middleware : [route.middleware]);
4547
4568
  }
4548
4569
  if (route.openapi) {
4549
- middlewares.push(h(route.openapi));
4570
+ middlewares.push(w(route.openapi));
4550
4571
  }
4551
4572
  const handler = "handler" in route ? route.handler : await route.createHandler({ mastra });
4552
4573
  if (route.method === "GET") {
@@ -4567,7 +4588,7 @@ async function createHonoServer(mastra, options = {}) {
4567
4588
  }
4568
4589
  app.get(
4569
4590
  "/.well-known/:agentId/agent.json",
4570
- h({
4591
+ w({
4571
4592
  description: "Get agent configuration",
4572
4593
  tags: ["agents"],
4573
4594
  parameters: [
@@ -4588,7 +4609,7 @@ async function createHonoServer(mastra, options = {}) {
4588
4609
  );
4589
4610
  app.post(
4590
4611
  "/a2a/:agentId",
4591
- h({
4612
+ w({
4592
4613
  description: "Execute agent via A2A protocol",
4593
4614
  tags: ["agents"],
4594
4615
  parameters: [
@@ -4703,7 +4724,7 @@ async function createHonoServer(mastra, options = {}) {
4703
4724
  );
4704
4725
  app.get(
4705
4726
  "/api",
4706
- h({
4727
+ w({
4707
4728
  description: "Get API status",
4708
4729
  tags: ["system"],
4709
4730
  responses: {
@@ -4716,7 +4737,7 @@ async function createHonoServer(mastra, options = {}) {
4716
4737
  );
4717
4738
  app.get(
4718
4739
  "/api/agents",
4719
- h({
4740
+ w({
4720
4741
  description: "Get all available agents",
4721
4742
  tags: ["agents"],
4722
4743
  responses: {
@@ -4729,7 +4750,7 @@ async function createHonoServer(mastra, options = {}) {
4729
4750
  );
4730
4751
  app.get(
4731
4752
  "/api/networks",
4732
- h({
4753
+ w({
4733
4754
  description: "Get all available networks",
4734
4755
  tags: ["networks"],
4735
4756
  responses: {
@@ -4742,7 +4763,7 @@ async function createHonoServer(mastra, options = {}) {
4742
4763
  );
4743
4764
  app.get(
4744
4765
  "/api/networks/:networkId",
4745
- h({
4766
+ w({
4746
4767
  description: "Get network by ID",
4747
4768
  tags: ["networks"],
4748
4769
  parameters: [
@@ -4767,7 +4788,7 @@ async function createHonoServer(mastra, options = {}) {
4767
4788
  app.post(
4768
4789
  "/api/networks/:networkId/generate",
4769
4790
  bodyLimit(bodyLimitOptions),
4770
- h({
4791
+ w({
4771
4792
  description: "Generate a response from a network",
4772
4793
  tags: ["networks"],
4773
4794
  parameters: [
@@ -4815,7 +4836,7 @@ async function createHonoServer(mastra, options = {}) {
4815
4836
  app.post(
4816
4837
  "/api/networks/:networkId/stream",
4817
4838
  bodyLimit(bodyLimitOptions),
4818
- h({
4839
+ w({
4819
4840
  description: "Generate a response from a network",
4820
4841
  tags: ["networks"],
4821
4842
  parameters: [
@@ -4862,7 +4883,7 @@ async function createHonoServer(mastra, options = {}) {
4862
4883
  );
4863
4884
  app.get(
4864
4885
  "/api/agents/:agentId",
4865
- h({
4886
+ w({
4866
4887
  description: "Get agent by ID",
4867
4888
  tags: ["agents"],
4868
4889
  parameters: [
@@ -4886,7 +4907,7 @@ async function createHonoServer(mastra, options = {}) {
4886
4907
  );
4887
4908
  app.get(
4888
4909
  "/api/agents/:agentId/evals/ci",
4889
- h({
4910
+ w({
4890
4911
  description: "Get CI evals by agent ID",
4891
4912
  tags: ["agents"],
4892
4913
  parameters: [
@@ -4907,7 +4928,7 @@ async function createHonoServer(mastra, options = {}) {
4907
4928
  );
4908
4929
  app.get(
4909
4930
  "/api/agents/:agentId/evals/live",
4910
- h({
4931
+ w({
4911
4932
  description: "Get live evals by agent ID",
4912
4933
  tags: ["agents"],
4913
4934
  parameters: [
@@ -4929,7 +4950,7 @@ async function createHonoServer(mastra, options = {}) {
4929
4950
  app.post(
4930
4951
  "/api/agents/:agentId/generate",
4931
4952
  bodyLimit(bodyLimitOptions),
4932
- h({
4953
+ w({
4933
4954
  description: "Generate a response from an agent",
4934
4955
  tags: ["agents"],
4935
4956
  parameters: [
@@ -4980,7 +5001,7 @@ async function createHonoServer(mastra, options = {}) {
4980
5001
  app.post(
4981
5002
  "/api/agents/:agentId/stream",
4982
5003
  bodyLimit(bodyLimitOptions),
4983
- h({
5004
+ w({
4984
5005
  description: "Stream a response from an agent",
4985
5006
  tags: ["agents"],
4986
5007
  parameters: [
@@ -5032,7 +5053,7 @@ async function createHonoServer(mastra, options = {}) {
5032
5053
  app.post(
5033
5054
  "/api/agents/:agentId/instructions",
5034
5055
  bodyLimit(bodyLimitOptions),
5035
- h({
5056
+ w({
5036
5057
  description: "Update an agent's instructions",
5037
5058
  tags: ["agents"],
5038
5059
  parameters: [
@@ -5077,7 +5098,7 @@ async function createHonoServer(mastra, options = {}) {
5077
5098
  app.post(
5078
5099
  "/api/agents/:agentId/instructions/enhance",
5079
5100
  bodyLimit(bodyLimitOptions),
5080
- h({
5101
+ w({
5081
5102
  description: "Generate an improved system prompt from instructions",
5082
5103
  tags: ["agents"],
5083
5104
  parameters: [
@@ -5153,7 +5174,7 @@ async function createHonoServer(mastra, options = {}) {
5153
5174
  c2.header("Link", '</api/agents/:agentId/voice/speakers>; rel="successor-version"');
5154
5175
  return next();
5155
5176
  },
5156
- h({
5177
+ w({
5157
5178
  description: "[DEPRECATED] Use /api/agents/:agentId/voice/speakers instead. Get available speakers for an agent",
5158
5179
  tags: ["agents"],
5159
5180
  parameters: [
@@ -5195,7 +5216,7 @@ async function createHonoServer(mastra, options = {}) {
5195
5216
  );
5196
5217
  app.get(
5197
5218
  "/api/agents/:agentId/voice/speakers",
5198
- h({
5219
+ w({
5199
5220
  description: "Get available speakers for an agent",
5200
5221
  tags: ["agents"],
5201
5222
  parameters: [
@@ -5244,7 +5265,7 @@ async function createHonoServer(mastra, options = {}) {
5244
5265
  c2.header("Link", '</api/agents/:agentId/voice/speak>; rel="successor-version"');
5245
5266
  return next();
5246
5267
  },
5247
- h({
5268
+ w({
5248
5269
  description: "[DEPRECATED] Use /api/agents/:agentId/voice/speak instead. Convert text to speech using the agent's voice provider",
5249
5270
  tags: ["agents"],
5250
5271
  parameters: [
@@ -5314,7 +5335,7 @@ async function createHonoServer(mastra, options = {}) {
5314
5335
  app.post(
5315
5336
  "/api/agents/:agentId/voice/speak",
5316
5337
  bodyLimit(bodyLimitOptions),
5317
- h({
5338
+ w({
5318
5339
  description: "Convert text to speech using the agent's voice provider",
5319
5340
  tags: ["agents"],
5320
5341
  parameters: [
@@ -5388,7 +5409,7 @@ async function createHonoServer(mastra, options = {}) {
5388
5409
  );
5389
5410
  app.get(
5390
5411
  "/api/agents/:agentId/voice/listener",
5391
- h({
5412
+ w({
5392
5413
  description: "Get available listener for an agent",
5393
5414
  tags: ["agents"],
5394
5415
  parameters: [
@@ -5438,7 +5459,7 @@ async function createHonoServer(mastra, options = {}) {
5438
5459
  c2.header("Link", '</api/agents/:agentId/voice/listen>; rel="successor-version"');
5439
5460
  return next();
5440
5461
  },
5441
- h({
5462
+ w({
5442
5463
  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.",
5443
5464
  tags: ["agents"],
5444
5465
  parameters: [
@@ -5494,7 +5515,7 @@ async function createHonoServer(mastra, options = {}) {
5494
5515
  maxSize: 10 * 1024 * 1024
5495
5516
  // 10 MB for audio files
5496
5517
  }),
5497
- h({
5518
+ w({
5498
5519
  description: "Convert speech to text using the agent's voice provider. Additional provider-specific options can be passed as query parameters.",
5499
5520
  tags: ["agents"],
5500
5521
  parameters: [
@@ -5558,7 +5579,7 @@ async function createHonoServer(mastra, options = {}) {
5558
5579
  app.post(
5559
5580
  "/api/agents/:agentId/tools/:toolId/execute",
5560
5581
  bodyLimit(bodyLimitOptions),
5561
- h({
5582
+ w({
5562
5583
  description: "Execute a tool through an agent",
5563
5584
  tags: ["agents"],
5564
5585
  parameters: [
@@ -5604,7 +5625,7 @@ async function createHonoServer(mastra, options = {}) {
5604
5625
  app.post(
5605
5626
  "/api/mcp/:serverId/mcp",
5606
5627
  bodyLimit(bodyLimitOptions),
5607
- h({
5628
+ w({
5608
5629
  description: "Send a message to an MCP server using Streamable HTTP",
5609
5630
  tags: ["mcp"],
5610
5631
  parameters: [
@@ -5633,7 +5654,7 @@ async function createHonoServer(mastra, options = {}) {
5633
5654
  const mcpSseMessagePath = "/api/mcp/:serverId/messages";
5634
5655
  app.get(
5635
5656
  mcpSseBasePath,
5636
- h({
5657
+ w({
5637
5658
  description: "Establish an MCP Server-Sent Events (SSE) connection with a server instance.",
5638
5659
  tags: ["mcp"],
5639
5660
  parameters: [
@@ -5659,7 +5680,7 @@ async function createHonoServer(mastra, options = {}) {
5659
5680
  mcpSseMessagePath,
5660
5681
  bodyLimit(bodyLimitOptions),
5661
5682
  // Apply body limit for messages
5662
- h({
5683
+ w({
5663
5684
  description: "Send a message to an MCP server over an established SSE connection.",
5664
5685
  tags: ["mcp"],
5665
5686
  parameters: [
@@ -5690,7 +5711,7 @@ async function createHonoServer(mastra, options = {}) {
5690
5711
  );
5691
5712
  app.get(
5692
5713
  "/api/mcp/v0/servers",
5693
- h({
5714
+ w({
5694
5715
  description: "List all available MCP server instances with basic information.",
5695
5716
  tags: ["mcp"],
5696
5717
  parameters: [
@@ -5767,7 +5788,7 @@ async function createHonoServer(mastra, options = {}) {
5767
5788
  );
5768
5789
  app.get(
5769
5790
  "/api/mcp/v0/servers/:id",
5770
- h({
5791
+ w({
5771
5792
  description: "Get detailed information about a specific MCP server instance.",
5772
5793
  tags: ["mcp"],
5773
5794
  parameters: [
@@ -5908,7 +5929,7 @@ async function createHonoServer(mastra, options = {}) {
5908
5929
  );
5909
5930
  app.get(
5910
5931
  "/api/mcp/:serverId/tools",
5911
- h({
5932
+ w({
5912
5933
  description: "List all tools available on a specific MCP server instance.",
5913
5934
  tags: ["mcp"],
5914
5935
  parameters: [
@@ -5931,7 +5952,7 @@ async function createHonoServer(mastra, options = {}) {
5931
5952
  );
5932
5953
  app.get(
5933
5954
  "/api/mcp/:serverId/tools/:toolId",
5934
- h({
5955
+ w({
5935
5956
  description: "Get details for a specific tool on an MCP server.",
5936
5957
  tags: ["mcp"],
5937
5958
  parameters: [
@@ -5950,7 +5971,7 @@ async function createHonoServer(mastra, options = {}) {
5950
5971
  app.post(
5951
5972
  "/api/mcp/:serverId/tools/:toolId/execute",
5952
5973
  bodyLimit(bodyLimitOptions),
5953
- h({
5974
+ w({
5954
5975
  description: "Execute a specific tool on an MCP server.",
5955
5976
  tags: ["mcp"],
5956
5977
  parameters: [
@@ -5983,7 +6004,7 @@ async function createHonoServer(mastra, options = {}) {
5983
6004
  );
5984
6005
  app.get(
5985
6006
  "/api/memory/status",
5986
- h({
6007
+ w({
5987
6008
  description: "Get memory status",
5988
6009
  tags: ["memory"],
5989
6010
  parameters: [
@@ -6004,7 +6025,7 @@ async function createHonoServer(mastra, options = {}) {
6004
6025
  );
6005
6026
  app.get(
6006
6027
  "/api/memory/threads",
6007
- h({
6028
+ w({
6008
6029
  description: "Get all threads",
6009
6030
  tags: ["memory"],
6010
6031
  parameters: [
@@ -6031,7 +6052,7 @@ async function createHonoServer(mastra, options = {}) {
6031
6052
  );
6032
6053
  app.get(
6033
6054
  "/api/memory/threads/:threadId",
6034
- h({
6055
+ w({
6035
6056
  description: "Get thread by ID",
6036
6057
  tags: ["memory"],
6037
6058
  parameters: [
@@ -6061,7 +6082,7 @@ async function createHonoServer(mastra, options = {}) {
6061
6082
  );
6062
6083
  app.get(
6063
6084
  "/api/memory/threads/:threadId/messages",
6064
- h({
6085
+ w({
6065
6086
  description: "Get messages for a thread",
6066
6087
  tags: ["memory"],
6067
6088
  parameters: [
@@ -6096,7 +6117,7 @@ async function createHonoServer(mastra, options = {}) {
6096
6117
  app.post(
6097
6118
  "/api/memory/threads",
6098
6119
  bodyLimit(bodyLimitOptions),
6099
- h({
6120
+ w({
6100
6121
  description: "Create a new thread",
6101
6122
  tags: ["memory"],
6102
6123
  parameters: [
@@ -6133,7 +6154,7 @@ async function createHonoServer(mastra, options = {}) {
6133
6154
  );
6134
6155
  app.patch(
6135
6156
  "/api/memory/threads/:threadId",
6136
- h({
6157
+ w({
6137
6158
  description: "Update a thread",
6138
6159
  tags: ["memory"],
6139
6160
  parameters: [
@@ -6171,7 +6192,7 @@ async function createHonoServer(mastra, options = {}) {
6171
6192
  );
6172
6193
  app.delete(
6173
6194
  "/api/memory/threads/:threadId",
6174
- h({
6195
+ w({
6175
6196
  description: "Delete a thread",
6176
6197
  tags: ["memory"],
6177
6198
  parameters: [
@@ -6202,7 +6223,7 @@ async function createHonoServer(mastra, options = {}) {
6202
6223
  app.post(
6203
6224
  "/api/memory/save-messages",
6204
6225
  bodyLimit(bodyLimitOptions),
6205
- h({
6226
+ w({
6206
6227
  description: "Save messages",
6207
6228
  tags: ["memory"],
6208
6229
  parameters: [
@@ -6240,7 +6261,7 @@ async function createHonoServer(mastra, options = {}) {
6240
6261
  );
6241
6262
  app.get(
6242
6263
  "/api/telemetry",
6243
- h({
6264
+ w({
6244
6265
  description: "Get all traces",
6245
6266
  tags: ["telemetry"],
6246
6267
  responses: {
@@ -6253,7 +6274,7 @@ async function createHonoServer(mastra, options = {}) {
6253
6274
  );
6254
6275
  app.post(
6255
6276
  "/api/telemetry",
6256
- h({
6277
+ w({
6257
6278
  description: "Store telemetry",
6258
6279
  tags: ["telemetry"],
6259
6280
  responses: {
@@ -6266,7 +6287,7 @@ async function createHonoServer(mastra, options = {}) {
6266
6287
  );
6267
6288
  app.get(
6268
6289
  "/api/workflows/legacy",
6269
- h({
6290
+ w({
6270
6291
  description: "Get all legacy workflows",
6271
6292
  tags: ["legacyWorkflows"],
6272
6293
  responses: {
@@ -6279,7 +6300,7 @@ async function createHonoServer(mastra, options = {}) {
6279
6300
  );
6280
6301
  app.get(
6281
6302
  "/api/workflows/legacy/:workflowId",
6282
- h({
6303
+ w({
6283
6304
  description: "Get legacy workflow by ID",
6284
6305
  tags: ["legacyWorkflows"],
6285
6306
  parameters: [
@@ -6303,7 +6324,7 @@ async function createHonoServer(mastra, options = {}) {
6303
6324
  );
6304
6325
  app.get(
6305
6326
  "/api/workflows/legacy/:workflowId/runs",
6306
- h({
6327
+ w({
6307
6328
  description: "Get all runs for a legacy workflow",
6308
6329
  tags: ["legacyWorkflows"],
6309
6330
  parameters: [
@@ -6329,7 +6350,7 @@ async function createHonoServer(mastra, options = {}) {
6329
6350
  );
6330
6351
  app.post(
6331
6352
  "/api/workflows/legacy/:workflowId/resume",
6332
- h({
6353
+ w({
6333
6354
  description: "Resume a suspended legacy workflow step",
6334
6355
  tags: ["legacyWorkflows"],
6335
6356
  parameters: [
@@ -6366,7 +6387,7 @@ async function createHonoServer(mastra, options = {}) {
6366
6387
  app.post(
6367
6388
  "/api/workflows/legacy/:workflowId/resume-async",
6368
6389
  bodyLimit(bodyLimitOptions),
6369
- h({
6390
+ w({
6370
6391
  description: "Resume a suspended legacy workflow step",
6371
6392
  tags: ["legacyWorkflows"],
6372
6393
  parameters: [
@@ -6402,7 +6423,7 @@ async function createHonoServer(mastra, options = {}) {
6402
6423
  );
6403
6424
  app.post(
6404
6425
  "/api/workflows/legacy/:workflowId/create-run",
6405
- h({
6426
+ w({
6406
6427
  description: "Create a new legacy workflow run",
6407
6428
  tags: ["legacyWorkflows"],
6408
6429
  parameters: [
@@ -6430,7 +6451,7 @@ async function createHonoServer(mastra, options = {}) {
6430
6451
  app.post(
6431
6452
  "/api/workflows/legacy/:workflowId/start-async",
6432
6453
  bodyLimit(bodyLimitOptions),
6433
- h({
6454
+ w({
6434
6455
  description: "Execute/Start a legacy workflow",
6435
6456
  tags: ["legacyWorkflows"],
6436
6457
  parameters: [
@@ -6473,7 +6494,7 @@ async function createHonoServer(mastra, options = {}) {
6473
6494
  );
6474
6495
  app.post(
6475
6496
  "/api/workflows/legacy/:workflowId/start",
6476
- h({
6497
+ w({
6477
6498
  description: "Create and start a new legacy workflow run",
6478
6499
  tags: ["legacyWorkflows"],
6479
6500
  parameters: [
@@ -6516,7 +6537,7 @@ async function createHonoServer(mastra, options = {}) {
6516
6537
  );
6517
6538
  app.get(
6518
6539
  "/api/workflows/legacy/:workflowId/watch",
6519
- h({
6540
+ w({
6520
6541
  description: "Watch legacy workflow transitions in real-time",
6521
6542
  parameters: [
6522
6543
  {
@@ -6543,7 +6564,7 @@ async function createHonoServer(mastra, options = {}) {
6543
6564
  );
6544
6565
  app.post(
6545
6566
  "/api/workflows/:workflowId/stream",
6546
- h({
6567
+ w({
6547
6568
  description: "Stream workflow in real-time",
6548
6569
  parameters: [
6549
6570
  {
@@ -6590,7 +6611,7 @@ async function createHonoServer(mastra, options = {}) {
6590
6611
  );
6591
6612
  app.get(
6592
6613
  "/api/workflows",
6593
- h({
6614
+ w({
6594
6615
  description: "Get all workflows",
6595
6616
  tags: ["workflows"],
6596
6617
  responses: {
@@ -6603,7 +6624,7 @@ async function createHonoServer(mastra, options = {}) {
6603
6624
  );
6604
6625
  app.get(
6605
6626
  "/api/workflows/:workflowId",
6606
- h({
6627
+ w({
6607
6628
  description: "Get workflow by ID",
6608
6629
  tags: ["workflows"],
6609
6630
  parameters: [
@@ -6627,7 +6648,7 @@ async function createHonoServer(mastra, options = {}) {
6627
6648
  );
6628
6649
  app.get(
6629
6650
  "/api/workflows/:workflowId/runs",
6630
- h({
6651
+ w({
6631
6652
  description: "Get all runs for a workflow",
6632
6653
  tags: ["workflows"],
6633
6654
  parameters: [
@@ -6653,7 +6674,7 @@ async function createHonoServer(mastra, options = {}) {
6653
6674
  );
6654
6675
  app.post(
6655
6676
  "/api/workflows/:workflowId/resume",
6656
- h({
6677
+ w({
6657
6678
  description: "Resume a suspended workflow step",
6658
6679
  tags: ["workflows"],
6659
6680
  parameters: [
@@ -6697,7 +6718,7 @@ async function createHonoServer(mastra, options = {}) {
6697
6718
  app.post(
6698
6719
  "/api/workflows/:workflowId/resume-async",
6699
6720
  bodyLimit(bodyLimitOptions),
6700
- h({
6721
+ w({
6701
6722
  description: "Resume a suspended workflow step",
6702
6723
  tags: ["workflows"],
6703
6724
  parameters: [
@@ -6741,7 +6762,7 @@ async function createHonoServer(mastra, options = {}) {
6741
6762
  app.post(
6742
6763
  "/api/workflows/:workflowId/create-run",
6743
6764
  bodyLimit(bodyLimitOptions),
6744
- h({
6765
+ w({
6745
6766
  description: "Create a new workflow run",
6746
6767
  tags: ["workflows"],
6747
6768
  parameters: [
@@ -6769,7 +6790,7 @@ async function createHonoServer(mastra, options = {}) {
6769
6790
  app.post(
6770
6791
  "/api/workflows/:workflowId/start-async",
6771
6792
  bodyLimit(bodyLimitOptions),
6772
- h({
6793
+ w({
6773
6794
  description: "Execute/Start a workflow",
6774
6795
  tags: ["workflows"],
6775
6796
  parameters: [
@@ -6816,7 +6837,7 @@ async function createHonoServer(mastra, options = {}) {
6816
6837
  );
6817
6838
  app.post(
6818
6839
  "/api/workflows/:workflowId/start",
6819
- h({
6840
+ w({
6820
6841
  description: "Create and start a new workflow run",
6821
6842
  tags: ["workflows"],
6822
6843
  parameters: [
@@ -6863,7 +6884,7 @@ async function createHonoServer(mastra, options = {}) {
6863
6884
  );
6864
6885
  app.get(
6865
6886
  "/api/workflows/:workflowId/watch",
6866
- h({
6887
+ w({
6867
6888
  description: "Watch workflow transitions in real-time",
6868
6889
  parameters: [
6869
6890
  {
@@ -6890,7 +6911,7 @@ async function createHonoServer(mastra, options = {}) {
6890
6911
  );
6891
6912
  app.get(
6892
6913
  "/api/logs",
6893
- h({
6914
+ w({
6894
6915
  description: "Get all logs",
6895
6916
  tags: ["logs"],
6896
6917
  parameters: [
@@ -6899,11 +6920,47 @@ async function createHonoServer(mastra, options = {}) {
6899
6920
  in: "query",
6900
6921
  required: true,
6901
6922
  schema: { type: "string" }
6923
+ },
6924
+ {
6925
+ name: "fromDate",
6926
+ in: "query",
6927
+ required: false,
6928
+ schema: { type: "string" }
6929
+ },
6930
+ {
6931
+ name: "toDate",
6932
+ in: "query",
6933
+ required: false,
6934
+ schema: { type: "string" }
6935
+ },
6936
+ {
6937
+ name: "logLevel",
6938
+ in: "query",
6939
+ required: false,
6940
+ schema: { type: "string" }
6941
+ },
6942
+ {
6943
+ name: "filters",
6944
+ in: "query",
6945
+ required: false,
6946
+ schema: { type: "string" }
6947
+ },
6948
+ {
6949
+ name: "page",
6950
+ in: "query",
6951
+ required: false,
6952
+ schema: { type: "number" }
6953
+ },
6954
+ {
6955
+ name: "perPage",
6956
+ in: "query",
6957
+ required: false,
6958
+ schema: { type: "number" }
6902
6959
  }
6903
6960
  ],
6904
6961
  responses: {
6905
6962
  200: {
6906
- description: "List of all logs"
6963
+ description: "Paginated list of all logs"
6907
6964
  }
6908
6965
  }
6909
6966
  }),
@@ -6911,7 +6968,7 @@ async function createHonoServer(mastra, options = {}) {
6911
6968
  );
6912
6969
  app.get(
6913
6970
  "/api/logs/transports",
6914
- h({
6971
+ w({
6915
6972
  description: "List of all log transports",
6916
6973
  tags: ["logs"],
6917
6974
  responses: {
@@ -6924,7 +6981,7 @@ async function createHonoServer(mastra, options = {}) {
6924
6981
  );
6925
6982
  app.get(
6926
6983
  "/api/logs/:runId",
6927
- h({
6984
+ w({
6928
6985
  description: "Get logs by run ID",
6929
6986
  tags: ["logs"],
6930
6987
  parameters: [
@@ -6939,11 +6996,47 @@ async function createHonoServer(mastra, options = {}) {
6939
6996
  in: "query",
6940
6997
  required: true,
6941
6998
  schema: { type: "string" }
6999
+ },
7000
+ {
7001
+ name: "fromDate",
7002
+ in: "query",
7003
+ required: false,
7004
+ schema: { type: "string" }
7005
+ },
7006
+ {
7007
+ name: "toDate",
7008
+ in: "query",
7009
+ required: false,
7010
+ schema: { type: "string" }
7011
+ },
7012
+ {
7013
+ name: "logLevel",
7014
+ in: "query",
7015
+ required: false,
7016
+ schema: { type: "string" }
7017
+ },
7018
+ {
7019
+ name: "filters",
7020
+ in: "query",
7021
+ required: false,
7022
+ schema: { type: "string" }
7023
+ },
7024
+ {
7025
+ name: "page",
7026
+ in: "query",
7027
+ required: false,
7028
+ schema: { type: "number" }
7029
+ },
7030
+ {
7031
+ name: "perPage",
7032
+ in: "query",
7033
+ required: false,
7034
+ schema: { type: "number" }
6942
7035
  }
6943
7036
  ],
6944
7037
  responses: {
6945
7038
  200: {
6946
- description: "List of logs for run ID"
7039
+ description: "Paginated list of logs for run ID"
6947
7040
  }
6948
7041
  }
6949
7042
  }),
@@ -6951,7 +7044,7 @@ async function createHonoServer(mastra, options = {}) {
6951
7044
  );
6952
7045
  app.get(
6953
7046
  "/api/tools",
6954
- h({
7047
+ w({
6955
7048
  description: "Get all tools",
6956
7049
  tags: ["tools"],
6957
7050
  responses: {
@@ -6964,7 +7057,7 @@ async function createHonoServer(mastra, options = {}) {
6964
7057
  );
6965
7058
  app.get(
6966
7059
  "/api/tools/:toolId",
6967
- h({
7060
+ w({
6968
7061
  description: "Get tool by ID",
6969
7062
  tags: ["tools"],
6970
7063
  parameters: [
@@ -6989,7 +7082,7 @@ async function createHonoServer(mastra, options = {}) {
6989
7082
  app.post(
6990
7083
  "/api/tools/:toolId/execute",
6991
7084
  bodyLimit(bodyLimitOptions),
6992
- h({
7085
+ w({
6993
7086
  description: "Execute a tool",
6994
7087
  tags: ["tools"],
6995
7088
  parameters: [
@@ -7035,7 +7128,7 @@ async function createHonoServer(mastra, options = {}) {
7035
7128
  app.post(
7036
7129
  "/api/vector/:vectorName/upsert",
7037
7130
  bodyLimit(bodyLimitOptions),
7038
- h({
7131
+ w({
7039
7132
  description: "Upsert vectors into an index",
7040
7133
  tags: ["vector"],
7041
7134
  parameters: [
@@ -7086,7 +7179,7 @@ async function createHonoServer(mastra, options = {}) {
7086
7179
  app.post(
7087
7180
  "/api/vector/:vectorName/create-index",
7088
7181
  bodyLimit(bodyLimitOptions),
7089
- h({
7182
+ w({
7090
7183
  description: "Create a new vector index",
7091
7184
  tags: ["vector"],
7092
7185
  parameters: [
@@ -7127,7 +7220,7 @@ async function createHonoServer(mastra, options = {}) {
7127
7220
  app.post(
7128
7221
  "/api/vector/:vectorName/query",
7129
7222
  bodyLimit(bodyLimitOptions),
7130
- h({
7223
+ w({
7131
7224
  description: "Query vectors from an index",
7132
7225
  tags: ["vector"],
7133
7226
  parameters: [
@@ -7169,7 +7262,7 @@ async function createHonoServer(mastra, options = {}) {
7169
7262
  );
7170
7263
  app.get(
7171
7264
  "/api/vector/:vectorName/indexes",
7172
- h({
7265
+ w({
7173
7266
  description: "List all indexes for a vector store",
7174
7267
  tags: ["vector"],
7175
7268
  parameters: [
@@ -7190,7 +7283,7 @@ async function createHonoServer(mastra, options = {}) {
7190
7283
  );
7191
7284
  app.get(
7192
7285
  "/api/vector/:vectorName/indexes/:indexName",
7193
- h({
7286
+ w({
7194
7287
  description: "Get details about a specific index",
7195
7288
  tags: ["vector"],
7196
7289
  parameters: [
@@ -7217,7 +7310,7 @@ async function createHonoServer(mastra, options = {}) {
7217
7310
  );
7218
7311
  app.delete(
7219
7312
  "/api/vector/:vectorName/indexes/:indexName",
7220
- h({
7313
+ w({
7221
7314
  description: "Delete a specific index",
7222
7315
  tags: ["vector"],
7223
7316
  parameters: [
@@ -7245,7 +7338,7 @@ async function createHonoServer(mastra, options = {}) {
7245
7338
  if (options?.isDev || server?.build?.openAPIDocs || server?.build?.swaggerUI) {
7246
7339
  app.get(
7247
7340
  "/openapi.json",
7248
- f(app, {
7341
+ h(app, {
7249
7342
  documentation: {
7250
7343
  info: { title: "Mastra API", version: "1.0.0", description: "Mastra API" }
7251
7344
  }
@@ -7319,6 +7412,13 @@ async function createNodeServer(mastra, options = {}) {
7319
7412
  if (options?.playground) {
7320
7413
  logger2.info(`\u{1F468}\u200D\u{1F4BB} Playground available at http://${host}:${port}/`);
7321
7414
  }
7415
+ if (process.send) {
7416
+ process.send({
7417
+ type: "server-ready",
7418
+ port,
7419
+ host
7420
+ });
7421
+ }
7322
7422
  }
7323
7423
  );
7324
7424
  return server;