@mastra/deployer 1.38.0-alpha.4 → 1.38.0-alpha.6

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":"AAOA,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;AAY5B,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;AAgCF,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;2CAmZhE;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAmC,mDAyElG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAOA,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;AAY5B,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;AAgCF,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;2CAmZhE;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAmC,mDAgHlG"}
@@ -4348,7 +4348,7 @@ async function createHonoServer(mastra, options = {
4348
4348
  const experimentalFeatures = process.env.EXPERIMENTAL_FEATURES === "true" ? "true" : "false";
4349
4349
  const experimentalUI = process.env.MASTRA_EXPERIMENTAL_UI === "true" ? "true" : "false";
4350
4350
  const templatesEnabled = process.env.MASTRA_TEMPLATES === "true" ? "true" : "false";
4351
- const agentSignals = process.env.MASTRA_AGENT_SIGNALS === "true" ? "true" : "false";
4351
+ const agentSignals = process.env.MASTRA_AGENT_SIGNALS === "false" ? "false" : "true";
4352
4352
  const requestContextPresets = process.env.MASTRA_REQUEST_CONTEXT_PRESETS || "";
4353
4353
  const escapeForHtml = (json) => {
4354
4354
  return json.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
@@ -4445,6 +4445,38 @@ async function createNodeServer(mastra, options = { tools: {} }) {
4445
4445
  } else {
4446
4446
  await workerLifecycle.startEventEngine();
4447
4447
  }
4448
+ const SHUTDOWN_TIMEOUT_MS = 5e3;
4449
+ let shuttingDown = false;
4450
+ const shutdown = async (signal) => {
4451
+ if (shuttingDown) {
4452
+ return;
4453
+ }
4454
+ shuttingDown = true;
4455
+ const logger2 = mastra.getLogger();
4456
+ logger2.info("Shutting down Mastra server", { signal });
4457
+ server.close();
4458
+ const lifecycle = mastra;
4459
+ if (typeof lifecycle.shutdown === "function") {
4460
+ let timeout2;
4461
+ const timedOut = /* @__PURE__ */ Symbol("shutdown-timeout");
4462
+ const timeoutPromise = new Promise((resolve) => {
4463
+ timeout2 = setTimeout(() => resolve(timedOut), SHUTDOWN_TIMEOUT_MS);
4464
+ });
4465
+ try {
4466
+ const result = await Promise.race([lifecycle.shutdown(), timeoutPromise]);
4467
+ if (result === timedOut) {
4468
+ logger2.warn("Mastra shutdown timed out; forcing exit", { timeoutMs: SHUTDOWN_TIMEOUT_MS });
4469
+ }
4470
+ } catch (error) {
4471
+ logger2.error("Error during Mastra shutdown", { error });
4472
+ } finally {
4473
+ clearTimeout(timeout2);
4474
+ }
4475
+ }
4476
+ process.exit(0);
4477
+ };
4478
+ process.once("SIGINT", () => void shutdown("SIGINT"));
4479
+ process.once("SIGTERM", () => void shutdown("SIGTERM"));
4448
4480
  return server;
4449
4481
  }
4450
4482