@mastra/deployer 1.65.0 → 1.66.0-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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAIlD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAIhE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAmB5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAoBnD,KAAK,QAAQ,GAAG,YAAY,CAAC;AAE7B,KAAK,SAAS,GAAG,aAAa,GAAG;IAC/B,OAAO,EAAE,GAAG,CAAC;QAAE,UAAU,EAAE,+BAA+B,CAAA;KAAE,CAAC,CAAC;CAC/D,CAAC;AA8CF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,wCAmB/D;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAER;cAegC,QAAQ;eAAa,SAAS;2CAmbhE;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAmC,mDAiLlG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAIlD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAKhE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAmB5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAoBnD,KAAK,QAAQ,GAAG,YAAY,CAAC;AAE7B,KAAK,SAAS,GAAG,aAAa,GAAG;IAC/B,OAAO,EAAE,GAAG,CAAC;QAAE,UAAU,EAAE,+BAA+B,CAAA;KAAE,CAAC,CAAC;CAC/D,CAAC;AA8CF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,wCAmB/D;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAER;cAegC,QAAQ;eAAa,SAAS;2CAgbhE;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAmC,mDAiLlG"}
@@ -3781,19 +3781,18 @@ async function agentLearningProxyHandler(c) {
3781
3781
  //#region src/server/handlers/client.ts
3782
3782
  const clients = /* @__PURE__ */ new Set();
3783
3783
  let hotReloadDisabled = false;
3784
- function handleClientsRefresh(c) {
3784
+ function handleClientsRefreshRequest(abortSignal) {
3785
3785
  const stream = new ReadableStream({ start(controller) {
3786
3786
  clients.add(controller);
3787
3787
  controller.enqueue("data: connected\n\n");
3788
- c.req.raw.signal.addEventListener("abort", () => {
3788
+ abortSignal.addEventListener("abort", () => {
3789
3789
  clients.delete(controller);
3790
3790
  });
3791
3791
  } });
3792
3792
  return new Response(stream, { headers: {
3793
3793
  "Content-Type": "text/event-stream",
3794
3794
  "Cache-Control": "no-cache",
3795
- Connection: "keep-alive",
3796
- "Access-Control-Allow-Origin": "*"
3795
+ Connection: "keep-alive"
3797
3796
  } });
3798
3797
  }
3799
3798
  /**
@@ -3810,7 +3809,7 @@ function closeRefreshStreams() {
3810
3809
  });
3811
3810
  clients.clear();
3812
3811
  }
3813
- function handleTriggerClientsRefresh(c) {
3812
+ function getTriggerClientsRefreshPayload() {
3814
3813
  clients.forEach((controller) => {
3815
3814
  try {
3816
3815
  controller.enqueue("data: refresh\n\n");
@@ -3818,10 +3817,10 @@ function handleTriggerClientsRefresh(c) {
3818
3817
  clients.delete(controller);
3819
3818
  }
3820
3819
  });
3821
- return c.json({
3820
+ return {
3822
3821
  success: true,
3823
3822
  clients: clients.size
3824
- });
3823
+ };
3825
3824
  }
3826
3825
  function isHotReloadDisabled() {
3827
3826
  return hotReloadDisabled;
@@ -4594,14 +4593,33 @@ async function createHonoServer(mastra, options = { tools: {} }) {
4594
4593
  const serverOptions = mastra.getServer();
4595
4594
  const studioBasePath = normalizeStudioBase(serverOptions?.studioBase ?? "/");
4596
4595
  if (options?.studio) {
4597
- app.get(`${studioBasePath}/refresh-events`, describeRoute({ hide: true }), handleClientsRefresh);
4598
- app.post(`${studioBasePath}/__refresh`, describeRoute({ hide: true }), handleTriggerClientsRefresh);
4599
- app.get(`${studioBasePath}/__hot-reload-status`, describeRoute({ hide: true }), (c) => {
4600
- return c.json({
4601
- disabled: isHotReloadDisabled(),
4602
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
4603
- });
4604
- });
4596
+ const studioControlRoutes = [
4597
+ {
4598
+ method: "GET",
4599
+ path: "/refresh-events",
4600
+ responseType: "datastream-response",
4601
+ handler: async ({ abortSignal }) => handleClientsRefreshRequest(abortSignal)
4602
+ },
4603
+ {
4604
+ method: "POST",
4605
+ path: "/__refresh",
4606
+ responseType: "json",
4607
+ handler: async () => getTriggerClientsRefreshPayload()
4608
+ },
4609
+ {
4610
+ method: "GET",
4611
+ path: "/__hot-reload-status",
4612
+ responseType: "json",
4613
+ handler: async () => ({
4614
+ disabled: isHotReloadDisabled(),
4615
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
4616
+ })
4617
+ }
4618
+ ];
4619
+ for (const route of studioControlRoutes) {
4620
+ customRouteAuthConfig.set(`${route.method}:${studioBasePath}${route.path}`, !options.isDev);
4621
+ await honoServerAdapter.registerRoute(app, route, { prefix: studioBasePath });
4622
+ }
4605
4623
  app.use(`${studioBasePath}/assets/*`, compress());
4606
4624
  const studioPath = getStudioPath();
4607
4625
  app.use(`${studioBasePath}/assets/*`, serveStatic({