@mastra/deployer 1.65.0 → 1.66.0-alpha.1

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 @@ name: mastra-deployer
3
3
  description: Documentation for @mastra/deployer. Use when working with @mastra/deployer APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/deployer"
6
- version: "1.65.0"
6
+ version: "1.66.0-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.65.0",
2
+ "version": "1.66.0-alpha.1",
3
3
  "package": "@mastra/deployer",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -1,5 +1,4 @@
1
- import type { Context } from 'hono';
2
- export declare function handleClientsRefresh(c: Context): Response;
1
+ export declare function handleClientsRefreshRequest(abortSignal: AbortSignal): Response;
3
2
  /**
4
3
  * End every open refresh SSE stream. Studio keeps one of these connections
5
4
  * open for its whole lifetime, so without this the graceful-shutdown drain
@@ -7,10 +6,10 @@ export declare function handleClientsRefresh(c: Context): Response;
7
6
  * reloads while Studio is open).
8
7
  */
9
8
  export declare function closeRefreshStreams(): void;
10
- export declare function handleTriggerClientsRefresh(c: Context): Response & import("hono").TypedResponse<{
11
- success: true;
9
+ export declare function getTriggerClientsRefreshPayload(): {
10
+ success: boolean;
12
11
  clients: number;
13
- }, import("hono/utils/http-status").ContentfulStatusCode, "json">;
12
+ };
14
13
  export declare function disableHotReload(): void;
15
14
  export declare function enableHotReload(): void;
16
15
  export declare function isHotReloadDisabled(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAKpC,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,GAAG,QAAQ,CAoBzD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,SASlC;AAED,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,OAAO;;;kEASrD;AAGD,wBAAgB,gBAAgB,SAG/B;AAED,wBAAgB,eAAe,SAG9B;AAED,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/client.ts"],"names":[],"mappings":"AAGA,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,WAAW,GAAG,QAAQ,CAmB9E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,SASlC;AAED,wBAAgB,+BAA+B;;;EAS9C;AAGD,wBAAgB,gBAAgB,SAG/B;AAED,wBAAgB,eAAe,SAG9B;AAED,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C"}
@@ -3786,19 +3786,18 @@ async function agentLearningProxyHandler(c) {
3786
3786
  //#region src/server/handlers/client.ts
3787
3787
  const clients = /* @__PURE__ */ new Set();
3788
3788
  let hotReloadDisabled = false;
3789
- function handleClientsRefresh(c) {
3789
+ function handleClientsRefreshRequest(abortSignal) {
3790
3790
  const stream = new ReadableStream({ start(controller) {
3791
3791
  clients.add(controller);
3792
3792
  controller.enqueue("data: connected\n\n");
3793
- c.req.raw.signal.addEventListener("abort", () => {
3793
+ abortSignal.addEventListener("abort", () => {
3794
3794
  clients.delete(controller);
3795
3795
  });
3796
3796
  } });
3797
3797
  return new Response(stream, { headers: {
3798
3798
  "Content-Type": "text/event-stream",
3799
3799
  "Cache-Control": "no-cache",
3800
- Connection: "keep-alive",
3801
- "Access-Control-Allow-Origin": "*"
3800
+ Connection: "keep-alive"
3802
3801
  } });
3803
3802
  }
3804
3803
  /**
@@ -3815,7 +3814,7 @@ function closeRefreshStreams() {
3815
3814
  });
3816
3815
  clients.clear();
3817
3816
  }
3818
- function handleTriggerClientsRefresh(c) {
3817
+ function getTriggerClientsRefreshPayload() {
3819
3818
  clients.forEach((controller) => {
3820
3819
  try {
3821
3820
  controller.enqueue("data: refresh\n\n");
@@ -3823,10 +3822,10 @@ function handleTriggerClientsRefresh(c) {
3823
3822
  clients.delete(controller);
3824
3823
  }
3825
3824
  });
3826
- return c.json({
3825
+ return {
3827
3826
  success: true,
3828
3827
  clients: clients.size
3829
- });
3828
+ };
3830
3829
  }
3831
3830
  function isHotReloadDisabled() {
3832
3831
  return hotReloadDisabled;
@@ -4599,14 +4598,33 @@ async function createHonoServer(mastra, options = { tools: {} }) {
4599
4598
  const serverOptions = mastra.getServer();
4600
4599
  const studioBasePath = require_utils.normalizeStudioBase(serverOptions?.studioBase ?? "/");
4601
4600
  if (options?.studio) {
4602
- app.get(`${studioBasePath}/refresh-events`, describeRoute({ hide: true }), handleClientsRefresh);
4603
- app.post(`${studioBasePath}/__refresh`, describeRoute({ hide: true }), handleTriggerClientsRefresh);
4604
- app.get(`${studioBasePath}/__hot-reload-status`, describeRoute({ hide: true }), (c) => {
4605
- return c.json({
4606
- disabled: isHotReloadDisabled(),
4607
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
4608
- });
4609
- });
4601
+ const studioControlRoutes = [
4602
+ {
4603
+ method: "GET",
4604
+ path: "/refresh-events",
4605
+ responseType: "datastream-response",
4606
+ handler: async ({ abortSignal }) => handleClientsRefreshRequest(abortSignal)
4607
+ },
4608
+ {
4609
+ method: "POST",
4610
+ path: "/__refresh",
4611
+ responseType: "json",
4612
+ handler: async () => getTriggerClientsRefreshPayload()
4613
+ },
4614
+ {
4615
+ method: "GET",
4616
+ path: "/__hot-reload-status",
4617
+ responseType: "json",
4618
+ handler: async () => ({
4619
+ disabled: isHotReloadDisabled(),
4620
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
4621
+ })
4622
+ }
4623
+ ];
4624
+ for (const route of studioControlRoutes) {
4625
+ customRouteAuthConfig.set(`${route.method}:${studioBasePath}${route.path}`, !options.isDev);
4626
+ await honoServerAdapter.registerRoute(app, route, { prefix: studioBasePath });
4627
+ }
4610
4628
  app.use(`${studioBasePath}/assets/*`, (0, hono_compress.compress)());
4611
4629
  const studioPath = getStudioPath();
4612
4630
  app.use(`${studioBasePath}/assets/*`, serveStatic({