@mastra/deployer 1.14.0 → 1.15.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":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGhE,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;AAEF,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;2CAyXhE;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAmC,mDAsDlG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGhE,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;AAEF,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;2CA8XhE;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAmC,mDAyDlG"}
@@ -1022,7 +1022,7 @@ var ERR_STREAM_WRITE_AFTER_END = class extends Error {
1022
1022
  }
1023
1023
  };
1024
1024
 
1025
- // ../../node_modules/.pnpm/fetch-to-node@2.1.0/node_modules/fetch-to-node/dist/fetch-to-node/http-incoming.js
1025
+ // ../../node_modules/.pnpm/fetch-to-node@2.1.0_patch_hash=42949ba7834aab28b47574e6989b8f3203c3ef91ee1ca866baf4dc8b151d34ae/node_modules/fetch-to-node/dist/fetch-to-node/http-incoming.js
1026
1026
  var kHeaders = /* @__PURE__ */ Symbol("kHeaders");
1027
1027
  var kHeadersDistinct = /* @__PURE__ */ Symbol("kHeadersDistinct");
1028
1028
  var kHeadersCount = /* @__PURE__ */ Symbol("kHeadersCount");
@@ -1356,7 +1356,7 @@ function onError(self, error, cb) {
1356
1356
  }
1357
1357
  }
1358
1358
 
1359
- // ../../node_modules/.pnpm/fetch-to-node@2.1.0/node_modules/fetch-to-node/dist/utils/types.js
1359
+ // ../../node_modules/.pnpm/fetch-to-node@2.1.0_patch_hash=42949ba7834aab28b47574e6989b8f3203c3ef91ee1ca866baf4dc8b151d34ae/node_modules/fetch-to-node/dist/utils/types.js
1360
1360
  function validateString(value, name) {
1361
1361
  if (typeof value !== "string")
1362
1362
  throw new ERR_INVALID_ARG_TYPE(name, "string", value);
@@ -1393,19 +1393,19 @@ function isUint8Array(value) {
1393
1393
  return value != null && value[Symbol.toStringTag] === "Uint8Array";
1394
1394
  }
1395
1395
 
1396
- // ../../node_modules/.pnpm/fetch-to-node@2.1.0/node_modules/fetch-to-node/dist/fetch-to-node/internal-http.js
1396
+ // ../../node_modules/.pnpm/fetch-to-node@2.1.0_patch_hash=42949ba7834aab28b47574e6989b8f3203c3ef91ee1ca866baf4dc8b151d34ae/node_modules/fetch-to-node/dist/fetch-to-node/internal-http.js
1397
1397
  var kNeedDrain = /* @__PURE__ */ Symbol("kNeedDrain");
1398
1398
  var kOutHeaders = /* @__PURE__ */ Symbol("kOutHeaders");
1399
1399
  function utcDate() {
1400
1400
  return (/* @__PURE__ */ new Date()).toUTCString();
1401
1401
  }
1402
1402
 
1403
- // ../../node_modules/.pnpm/fetch-to-node@2.1.0/node_modules/fetch-to-node/dist/fetch-to-node/internal-streams-state.js
1403
+ // ../../node_modules/.pnpm/fetch-to-node@2.1.0_patch_hash=42949ba7834aab28b47574e6989b8f3203c3ef91ee1ca866baf4dc8b151d34ae/node_modules/fetch-to-node/dist/fetch-to-node/internal-streams-state.js
1404
1404
  function getDefaultHighWaterMark(objectMode) {
1405
1405
  return objectMode ? 16 : 64 * 1024;
1406
1406
  }
1407
1407
 
1408
- // ../../node_modules/.pnpm/fetch-to-node@2.1.0/node_modules/fetch-to-node/dist/fetch-to-node/http-common.js
1408
+ // ../../node_modules/.pnpm/fetch-to-node@2.1.0_patch_hash=42949ba7834aab28b47574e6989b8f3203c3ef91ee1ca866baf4dc8b151d34ae/node_modules/fetch-to-node/dist/fetch-to-node/http-common.js
1409
1409
  var tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;
1410
1410
  function checkIsHttpToken(val) {
1411
1411
  return tokenRegExp.test(val);
@@ -2620,6 +2620,7 @@ var FetchServerResponse = class _FetchServerResponse extends FetchOutgoingMessag
2620
2620
  headers.append(header, value);
2621
2621
  }
2622
2622
  const _this = this;
2623
+ let cancelled = false;
2623
2624
  let body = this._hasBody ? new ReadableStream({
2624
2625
  start(controller) {
2625
2626
  for (const dataChunk of initialDataChunks) {
@@ -2629,17 +2630,27 @@ var FetchServerResponse = class _FetchServerResponse extends FetchOutgoingMessag
2629
2630
  controller.close();
2630
2631
  } else {
2631
2632
  _this.on("finish", () => {
2633
+ if (cancelled) return;
2632
2634
  finished = true;
2633
- controller.close();
2635
+ try {
2636
+ controller.close();
2637
+ } catch (_) {
2638
+ }
2634
2639
  });
2635
2640
  _this.on("_dataWritten", (e) => {
2636
- if (finished) {
2641
+ if (finished || cancelled) {
2637
2642
  return;
2638
2643
  }
2639
2644
  const data = _this.dataFromDataWrittenEvent(e);
2640
- controller.enqueue(data);
2645
+ try {
2646
+ controller.enqueue(data);
2647
+ } catch (_) {
2648
+ }
2641
2649
  });
2642
2650
  }
2651
+ },
2652
+ cancel() {
2653
+ cancelled = true;
2643
2654
  }
2644
2655
  }) : null;
2645
2656
  if (body != null && typeof FixedLengthStream !== "undefined") {
@@ -4152,6 +4163,9 @@ async function createHonoServer(mastra, options = {
4152
4163
  const key = serverOptions?.https?.key ?? (process.env.MASTRA_HTTPS_KEY ? Buffer.from(process.env.MASTRA_HTTPS_KEY, "base64") : void 0);
4153
4164
  const cert = serverOptions?.https?.cert ?? (process.env.MASTRA_HTTPS_CERT ? Buffer.from(process.env.MASTRA_HTTPS_CERT, "base64") : void 0);
4154
4165
  const protocol = key && cert ? "https" : "http";
4166
+ const studioHost = serverOptions?.studioHost ?? host;
4167
+ const studioProtocol = serverOptions?.studioProtocol ?? protocol;
4168
+ const studioPort = serverOptions?.studioPort ?? port;
4155
4169
  const cloudApiEndpoint = process.env.MASTRA_CLOUD_API_ENDPOINT || "";
4156
4170
  const experimentalFeatures = process.env.EXPERIMENTAL_FEATURES === "true" ? "true" : "false";
4157
4171
  const templatesEnabled = process.env.MASTRA_TEMPLATES === "true" ? "true" : "false";
@@ -4162,10 +4176,10 @@ async function createHonoServer(mastra, options = {
4162
4176
  };
4163
4177
  const autoDetectUrl = process.env.MASTRA_AUTO_DETECT_URL === "true";
4164
4178
  indexHtml = injectStudioHtmlConfig(indexHtml, {
4165
- host: `'${host}'`,
4166
- port: `'${port}'`,
4167
- protocol: `'${protocol}'`,
4168
- apiPrefix: `'${apiPrefix}'`,
4179
+ host: `'${studioHost}'`,
4180
+ port: `'${studioPort}'`,
4181
+ protocol: `'${studioProtocol}'`,
4182
+ apiPrefix: `'${serverOptions?.apiPrefix ?? "/api"}'`,
4169
4183
  basePath: studioBasePath,
4170
4184
  hideCloudCta: `'${hideCloudCta}'`,
4171
4185
  cloudApiEndpoint: `'${cloudApiEndpoint}'`,
@@ -4208,6 +4222,9 @@ async function createNodeServer(mastra, options = { tools: {} }) {
4208
4222
  const host = serverOptions?.host ?? process.env.MASTRA_HOST ?? "localhost";
4209
4223
  const port = serverOptions?.port ?? (Number(process.env.PORT) || 4111);
4210
4224
  const protocol = isHttpsEnabled ? "https" : "http";
4225
+ const studioHost = serverOptions?.studioHost ?? host;
4226
+ const studioProtocol = serverOptions?.studioProtocol ?? protocol;
4227
+ const studioPort = serverOptions?.studioPort ?? port;
4211
4228
  const server = serve(
4212
4229
  {
4213
4230
  fetch: app.fetch,
@@ -4226,7 +4243,7 @@ async function createNodeServer(mastra, options = { tools: {} }) {
4226
4243
  logger2.info(` Mastra API running on ${protocol}://${host}:${port}${apiPrefix}`);
4227
4244
  if (options?.studio) {
4228
4245
  const studioBasePath = normalizeStudioBase(serverOptions?.studioBase ?? "/");
4229
- const studioUrl = `${protocol}://${host}:${port}${studioBasePath}`;
4246
+ const studioUrl = `${studioProtocol}://${studioHost}:${studioPort}${studioBasePath}`;
4230
4247
  logger2.info(`\u{1F468}\u200D\u{1F4BB} Studio available at ${studioUrl}`);
4231
4248
  }
4232
4249
  if (process.send) {