@mastra/deployer 1.51.1-alpha.1 → 1.52.0-alpha.11

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/dist/build/analyze.cjs +2 -2
  3. package/dist/build/analyze.d.ts.map +1 -1
  4. package/dist/build/analyze.js +1 -1
  5. package/dist/build/babel/check-config-export.d.ts +2 -2
  6. package/dist/build/babel/check-config-export.d.ts.map +1 -1
  7. package/dist/build/babel/detect-pino-transports.d.ts +2 -2
  8. package/dist/build/babel/detect-pino-transports.d.ts.map +1 -1
  9. package/dist/build/babel/remove-all-options-except.d.ts +2 -2
  10. package/dist/build/babel/remove-all-options-except.d.ts.map +1 -1
  11. package/dist/build/babel/remove-deployer.d.ts +6 -2
  12. package/dist/build/babel/remove-deployer.d.ts.map +1 -1
  13. package/dist/build/babel/remove-non-referenced-nodes.d.ts +2 -2
  14. package/dist/build/babel/remove-non-referenced-nodes.d.ts.map +1 -1
  15. package/dist/build/bundler.cjs +5 -5
  16. package/dist/build/bundler.js +1 -1
  17. package/dist/build/index.cjs +22 -22
  18. package/dist/build/index.js +5 -5
  19. package/dist/build/plugins/remove-all-except.d.ts.map +1 -1
  20. package/dist/build/plugins/remove-deployer.d.ts.map +1 -1
  21. package/dist/build/plugins/remove-unused-references.d.ts.map +1 -1
  22. package/dist/bundler/index.cjs +3 -3
  23. package/dist/bundler/index.js +1 -1
  24. package/dist/{chunk-UFIOPABI.cjs → chunk-36AWZH7Z.cjs} +56 -90
  25. package/dist/chunk-36AWZH7Z.cjs.map +1 -0
  26. package/dist/{chunk-X2ZJLEWO.cjs → chunk-3XIMK24X.cjs} +22 -53
  27. package/dist/chunk-3XIMK24X.cjs.map +1 -0
  28. package/dist/{chunk-S32IJ4F6.js → chunk-3XJRELIX.js} +5 -5
  29. package/dist/{chunk-S32IJ4F6.js.map → chunk-3XJRELIX.js.map} +1 -1
  30. package/dist/{chunk-PLCERTF6.js → chunk-4ZFC5V33.js} +6 -6
  31. package/dist/{chunk-PLCERTF6.js.map → chunk-4ZFC5V33.js.map} +1 -1
  32. package/dist/{chunk-SZ3KU5RT.cjs → chunk-5ODCZKB7.cjs} +12 -12
  33. package/dist/{chunk-SZ3KU5RT.cjs.map → chunk-5ODCZKB7.cjs.map} +1 -1
  34. package/dist/{chunk-5K7ECKKW.js → chunk-5PORNUPF.js} +22 -35
  35. package/dist/chunk-5PORNUPF.js.map +1 -0
  36. package/dist/{chunk-JTWXTX2D.js → chunk-E5SBYHQK.js} +52 -68
  37. package/dist/chunk-E5SBYHQK.js.map +1 -0
  38. package/dist/{chunk-UY7KZXD2.js → chunk-EPALJ45Z.js} +12 -14
  39. package/dist/chunk-EPALJ45Z.js.map +1 -0
  40. package/dist/{chunk-VKAFARW6.cjs → chunk-FKKJQUGR.cjs} +4 -4
  41. package/dist/{chunk-VKAFARW6.cjs.map → chunk-FKKJQUGR.cjs.map} +1 -1
  42. package/dist/{chunk-2SUO6N5G.cjs → chunk-SYWSF3OR.cjs} +14 -14
  43. package/dist/{chunk-2SUO6N5G.cjs.map → chunk-SYWSF3OR.cjs.map} +1 -1
  44. package/dist/{chunk-7BDGRATY.cjs → chunk-YAIYFXQ6.cjs} +47 -49
  45. package/dist/chunk-YAIYFXQ6.cjs.map +1 -0
  46. package/dist/{chunk-ZL66GDLP.js → chunk-YUBKHO52.js} +2 -2
  47. package/dist/{chunk-ZL66GDLP.js.map → chunk-YUBKHO52.js.map} +1 -1
  48. package/dist/docs/SKILL.md +1 -1
  49. package/dist/docs/assets/SOURCE_MAP.json +5 -5
  50. package/dist/docs/references/docs-deployment-mastra-server.md +35 -0
  51. package/dist/docs/references/docs-deployment-monorepo.md +2 -0
  52. package/dist/docs/references/docs-deployment-overview.md +6 -0
  53. package/dist/index.cjs +11 -11
  54. package/dist/index.js +4 -4
  55. package/dist/server/handlers/agent-learning.d.ts +3 -0
  56. package/dist/server/handlers/agent-learning.d.ts.map +1 -0
  57. package/dist/server/index.cjs +68 -4
  58. package/dist/server/index.cjs.map +1 -1
  59. package/dist/server/index.d.ts.map +1 -1
  60. package/dist/server/index.js +66 -3
  61. package/dist/server/index.js.map +1 -1
  62. package/dist/services/index.cjs +4 -4
  63. package/dist/services/index.js +1 -1
  64. package/package.json +14 -16
  65. package/dist/chunk-5K7ECKKW.js.map +0 -1
  66. package/dist/chunk-7BDGRATY.cjs.map +0 -1
  67. package/dist/chunk-JTWXTX2D.js.map +0 -1
  68. package/dist/chunk-UFIOPABI.cjs.map +0 -1
  69. package/dist/chunk-UY7KZXD2.js.map +0 -1
  70. package/dist/chunk-X2ZJLEWO.cjs.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunk2SUO6N5G_cjs = require('./chunk-2SUO6N5G.cjs');
4
- var chunkUFIOPABI_cjs = require('./chunk-UFIOPABI.cjs');
5
- var chunkVKAFARW6_cjs = require('./chunk-VKAFARW6.cjs');
3
+ var chunkSYWSF3OR_cjs = require('./chunk-SYWSF3OR.cjs');
4
+ var chunk36AWZH7Z_cjs = require('./chunk-36AWZH7Z.cjs');
5
+ var chunkFKKJQUGR_cjs = require('./chunk-FKKJQUGR.cjs');
6
6
 
7
7
  // src/deploy/base.ts
8
- var Deployer = class extends chunk2SUO6N5G_cjs.Bundler {
9
- deps = new chunkVKAFARW6_cjs.DepsService();
8
+ var Deployer = class extends chunkSYWSF3OR_cjs.Bundler {
9
+ deps = new chunkFKKJQUGR_cjs.DepsService();
10
10
  constructor(args) {
11
11
  super(args.name, "DEPLOYER");
12
12
  this.deps.__setLogger(this.logger);
@@ -14,7 +14,7 @@ var Deployer = class extends chunk2SUO6N5G_cjs.Bundler {
14
14
  getEnvFiles() {
15
15
  const possibleFiles = [".env.production", ".env.local", ".env"];
16
16
  try {
17
- const fileService = new chunkVKAFARW6_cjs.FileService();
17
+ const fileService = new chunkFKKJQUGR_cjs.FileService();
18
18
  const envFile = fileService.getFirstExistingFile(possibleFiles);
19
19
  return Promise.resolve([envFile]);
20
20
  } catch {
@@ -25,7 +25,7 @@ var Deployer = class extends chunk2SUO6N5G_cjs.Bundler {
25
25
 
26
26
  // src/build/deployer.ts
27
27
  async function getDeployer(entryFile, outputDir, logger) {
28
- const result = await chunkUFIOPABI_cjs.extractMastraOption("deployer", entryFile, outputDir, logger);
28
+ const result = await chunk36AWZH7Z_cjs.extractMastraOption("deployer", entryFile, outputDir, logger);
29
29
  if (!result) {
30
30
  return null;
31
31
  }
@@ -34,19 +34,19 @@ async function getDeployer(entryFile, outputDir, logger) {
34
34
 
35
35
  Object.defineProperty(exports, "Deps", {
36
36
  enumerable: true,
37
- get: function () { return chunkVKAFARW6_cjs.Deps; }
37
+ get: function () { return chunkFKKJQUGR_cjs.Deps; }
38
38
  });
39
39
  Object.defineProperty(exports, "FileService", {
40
40
  enumerable: true,
41
- get: function () { return chunkVKAFARW6_cjs.FileService; }
41
+ get: function () { return chunkFKKJQUGR_cjs.FileService; }
42
42
  });
43
43
  Object.defineProperty(exports, "createChildProcessLogger", {
44
44
  enumerable: true,
45
- get: function () { return chunkVKAFARW6_cjs.createChildProcessLogger; }
45
+ get: function () { return chunkFKKJQUGR_cjs.createChildProcessLogger; }
46
46
  });
47
47
  Object.defineProperty(exports, "createPinoStream", {
48
48
  enumerable: true,
49
- get: function () { return chunkVKAFARW6_cjs.createPinoStream; }
49
+ get: function () { return chunkFKKJQUGR_cjs.createPinoStream; }
50
50
  });
51
51
  exports.Deployer = Deployer;
52
52
  exports.getDeployer = getDeployer;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { Bundler } from './chunk-PLCERTF6.js';
2
- import { extractMastraOption } from './chunk-JTWXTX2D.js';
3
- import { DepsService, FileService } from './chunk-ZL66GDLP.js';
4
- export { Deps, FileService, createChildProcessLogger, createPinoStream } from './chunk-ZL66GDLP.js';
1
+ import { Bundler } from './chunk-4ZFC5V33.js';
2
+ import { extractMastraOption } from './chunk-E5SBYHQK.js';
3
+ import { DepsService, FileService } from './chunk-YUBKHO52.js';
4
+ export { Deps, FileService, createChildProcessLogger, createPinoStream } from './chunk-YUBKHO52.js';
5
5
 
6
6
  // src/deploy/base.ts
7
7
  var Deployer = class extends Bundler {
@@ -0,0 +1,3 @@
1
+ import type { Context } from 'hono';
2
+ export declare function agentLearningProxyHandler(c: Context): Promise<Response>;
3
+ //# sourceMappingURL=agent-learning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-learning.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/agent-learning.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAMpC,wBAAsB,yBAAyB,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAuD7E"}
@@ -11,7 +11,7 @@ var stream = require('stream');
11
11
  var crypto = require('crypto');
12
12
  var mime = require('hono/utils/mime');
13
13
  var fs = require('fs');
14
- var process$1 = require('process');
14
+ var process2 = require('process');
15
15
  var html = require('hono/html');
16
16
  var tools = require('@mastra/core/tools');
17
17
  var serverAdapter = require('@mastra/server/server-adapter');
@@ -52,6 +52,7 @@ function _interopNamespace(e) {
52
52
 
53
53
  var https__namespace = /*#__PURE__*/_interopNamespace(https);
54
54
  var crypto__default = /*#__PURE__*/_interopDefault(crypto);
55
+ var process2__default = /*#__PURE__*/_interopDefault(process2);
55
56
  var util__default = /*#__PURE__*/_interopDefault(util);
56
57
 
57
58
  var RequestError = class extends Error {
@@ -687,7 +688,7 @@ var ENCODINGS = {
687
688
  };
688
689
  var ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS);
689
690
  var pr54206Applied = () => {
690
- const [major, minor] = process$1.versions.node.split(".").map((component) => parseInt(component));
691
+ const [major, minor] = process2.versions.node.split(".").map((component) => parseInt(component));
691
692
  return major >= 23 || major === 22 && minor >= 7 || major === 20 && minor >= 18;
692
693
  };
693
694
  var useReadableToWeb = pr54206Applied();
@@ -3414,13 +3415,20 @@ var MastraServer = class extends serverAdapter.MastraServer {
3414
3415
  c.req.raw.headers.forEach((v, k) => {
3415
3416
  reqHeaders[k] = v;
3416
3417
  });
3418
+ let executionCtx;
3419
+ try {
3420
+ executionCtx = c.executionCtx;
3421
+ } catch {
3422
+ executionCtx = void 0;
3423
+ }
3417
3424
  const response = await this.handleCustomRouteRequest(
3418
3425
  c.req.url,
3419
3426
  c.req.method,
3420
3427
  reqHeaders,
3421
3428
  c.req.raw.body,
3422
3429
  c.get("requestContext"),
3423
- c.req.raw.signal
3430
+ c.req.raw.signal,
3431
+ executionCtx
3424
3432
  );
3425
3433
  if (!response) {
3426
3434
  return c.json({ error: "Not Found" }, 404);
@@ -3476,7 +3484,7 @@ var MastraServer = class extends serverAdapter.MastraServer {
3476
3484
  }
3477
3485
  };
3478
3486
 
3479
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono-openapi/1.3.1/a0af3e938145e0fe63ab6ad04133542aa3d9f05b7230ed4fc230411dabce6d87/node_modules/hono-openapi/dist/index.js
3487
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono-openapi/1.3.1/ed7874fdcec8b17da300846f7ef77f0f4a26ac7405bda06fbf30b636f843708d/node_modules/hono-openapi/dist/index.js
3480
3488
  var uniqueSymbol = /* @__PURE__ */ Symbol("openapi");
3481
3489
  function describeRoute(spec) {
3482
3490
  const middleware2 = async (_c, next) => {
@@ -3492,6 +3500,59 @@ function describeRoute(spec) {
3492
3500
  }
3493
3501
  });
3494
3502
  }
3503
+ var DEFAULT_AGENT_LEARNING_ENDPOINT = "https://output.signals.mastra.ai";
3504
+ var AGENT_LEARNING_TIMEOUT_MS = 8e3;
3505
+ var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
3506
+ async function agentLearningProxyHandler(c) {
3507
+ const requestUrl = new URL(c.req.url);
3508
+ if (!LOOPBACK_HOSTS.has(requestUrl.hostname)) {
3509
+ return c.json({ error: "Agent Learning development proxy is only available on loopback hosts" }, 403);
3510
+ }
3511
+ const origin = c.req.header("Origin");
3512
+ if (origin && origin !== requestUrl.origin) {
3513
+ return c.json({ error: "Cross-origin Agent Learning requests are not allowed" }, 403);
3514
+ }
3515
+ const accessToken = process2__default.default.env.MASTRA_PLATFORM_ACCESS_TOKEN;
3516
+ const projectId = process2__default.default.env.MASTRA_PROJECT_ID;
3517
+ if (!accessToken || !projectId) {
3518
+ return c.json(
3519
+ {
3520
+ error: "MASTRA_PLATFORM_ACCESS_TOKEN and MASTRA_PROJECT_ID are required for Agent Learning"
3521
+ },
3522
+ 503
3523
+ );
3524
+ }
3525
+ const endpoint = process2__default.default.env.MASTRA_PLATFORM_AGENT_LEARNING_ENDPOINT || DEFAULT_AGENT_LEARNING_ENDPOINT;
3526
+ let upstreamUrl;
3527
+ try {
3528
+ upstreamUrl = new URL(`${requestUrl.pathname}${requestUrl.search}`, `${endpoint.replace(/\/+$/, "")}/`);
3529
+ } catch {
3530
+ return c.json({ error: "MASTRA_PLATFORM_AGENT_LEARNING_ENDPOINT must be a valid URL" }, 503);
3531
+ }
3532
+ try {
3533
+ const upstream = await fetch(upstreamUrl, {
3534
+ method: "GET",
3535
+ headers: {
3536
+ Accept: c.req.header("Accept") || "application/json",
3537
+ Authorization: `Bearer ${accessToken}`,
3538
+ "X-Mastra-Project-Id": projectId
3539
+ },
3540
+ signal: AbortSignal.timeout(AGENT_LEARNING_TIMEOUT_MS)
3541
+ });
3542
+ const headers = new Headers();
3543
+ const contentType = upstream.headers.get("content-type");
3544
+ const cacheControl = upstream.headers.get("cache-control");
3545
+ if (contentType) headers.set("content-type", contentType);
3546
+ if (cacheControl) headers.set("cache-control", cacheControl);
3547
+ return new Response(upstream.body, {
3548
+ status: upstream.status,
3549
+ statusText: upstream.statusText,
3550
+ headers
3551
+ });
3552
+ } catch {
3553
+ return c.json({ error: "Agent Learning upstream unavailable" }, 502);
3554
+ }
3555
+ }
3495
3556
 
3496
3557
  // src/server/handlers/client.ts
3497
3558
  var clients = /* @__PURE__ */ new Set();
@@ -4281,6 +4342,9 @@ async function createHonoServer(mastra, options = {
4281
4342
  }),
4282
4343
  healthHandler
4283
4344
  );
4345
+ if (options?.isDev && options.studio) {
4346
+ app.get("/api/learning/*", agentLearningProxyHandler);
4347
+ }
4284
4348
  if (options?.isDev || server?.build?.swaggerUI) {
4285
4349
  app.get(
4286
4350
  apiPrefix,