@mastra/deployer 0.3.0-alpha.7 → 0.3.0-alpha.9

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,7 +1,6 @@
1
1
  import { default as babel_2 } from '@babel/core';
2
2
  import { BlankSchema } from 'hono/types';
3
3
  import type { Config } from '@mastra/core';
4
- import { Container } from '@mastra/core/di';
5
4
  import { ContentfulStatusCode } from 'hono/utils/http-status';
6
5
  import type { Context } from 'hono';
7
6
  import { Hono } from 'hono';
@@ -25,6 +24,7 @@ import type { ResolveHookContext } from 'node:module';
25
24
  import { RollupBuild } from 'rollup';
26
25
  import { RollupOutput } from 'rollup';
27
26
  import { RollupWatcher } from 'rollup';
27
+ import { RuntimeContext } from '@mastra/core/di';
28
28
  import { ServerType } from '@hono/node-server';
29
29
  import { Transform } from 'stream';
30
30
  import { TypedResponse } from 'hono';
@@ -47,10 +47,12 @@ declare function analyzeBundle(entry: string, mastraEntry: string, outputDir: st
47
47
  export { analyzeBundle }
48
48
  export { analyzeBundle as analyzeBundle_alias_1 }
49
49
 
50
- export declare interface ApiError extends Error {
50
+ declare interface ApiError extends Error {
51
51
  message: string;
52
52
  status?: number;
53
53
  }
54
+ export { ApiError }
55
+ export { ApiError as ApiError_alias_1 }
54
56
 
55
57
  declare interface ArchitectureOptions {
56
58
  os?: string[];
@@ -115,22 +117,14 @@ export { createChildProcessLogger }
115
117
  export { createChildProcessLogger as createChildProcessLogger_alias_1 }
116
118
  export { createChildProcessLogger as createChildProcessLogger_alias_2 }
117
119
 
118
- export declare function createHonoServer(mastra: Mastra, options?: {
119
- playground?: boolean;
120
- swaggerUI?: boolean;
121
- apiReqLogs?: boolean;
122
- }): Promise<Hono<{
120
+ export declare function createHonoServer(mastra: Mastra, options?: ServerBundleOptions): Promise<Hono<{
123
121
  Bindings: Bindings;
124
122
  Variables: Variables;
125
123
  }, BlankSchema, "/">>;
126
124
 
127
125
  export declare function createIndex(c: Context): Promise<Response>;
128
126
 
129
- export declare function createNodeServer(mastra: Mastra, options?: {
130
- playground?: boolean;
131
- swaggerUI?: boolean;
132
- apiReqLogs?: boolean;
133
- }): Promise<ServerType>;
127
+ export declare function createNodeServer(mastra: Mastra, options?: ServerBundleOptions): Promise<ServerType>;
134
128
 
135
129
  declare const createPinoStream: (logger: Logger_2) => Transform;
136
130
  export { createPinoStream }
@@ -475,6 +469,13 @@ export declare function rootHandler(c: Context): Promise<Response & TypedRespons
475
469
 
476
470
  export declare function saveMessagesHandler(c: Context): Promise<Response>;
477
471
 
472
+ declare type ServerBundleOptions = {
473
+ playground?: boolean;
474
+ isDev?: boolean;
475
+ };
476
+ export { ServerBundleOptions }
477
+ export { ServerBundleOptions as ServerBundleOptions_alias_1 }
478
+
478
479
  export declare function setAgentInstructionsHandler(c: Context): Promise<Response>;
479
480
 
480
481
  /**
@@ -513,12 +514,13 @@ export declare function validateBody(body: Record<string, unknown>): void;
513
514
 
514
515
  declare type Variables = {
515
516
  mastra: Mastra;
516
- container: Container;
517
+ runtimeContext: RuntimeContext;
517
518
  clients: Set<{
518
519
  controller: ReadableStreamDefaultController;
519
520
  }>;
520
521
  tools: Record<string, any>;
521
522
  playground: boolean;
523
+ isDev: boolean;
522
524
  };
523
525
 
524
526
  export declare function watchWorkflowHandler(c: Context): Response | Promise<Response>;
@@ -531,6 +533,7 @@ declare type WorkspacePackageInfo = {
531
533
 
532
534
  declare function writeTelemetryConfig(entryFile: string, outputDir: string): Promise<{
533
535
  hasCustomConfig: boolean;
536
+ externalDependencies: string[];
534
537
  }>;
535
538
  export { writeTelemetryConfig }
536
539
  export { writeTelemetryConfig as writeTelemetryConfig_alias_1 }
@@ -1,7 +1,6 @@
1
1
  import { default as babel_2 } from '@babel/core';
2
2
  import { BlankSchema } from 'hono/types';
3
3
  import type { Config } from '@mastra/core';
4
- import { Container } from '@mastra/core/di';
5
4
  import { ContentfulStatusCode } from 'hono/utils/http-status';
6
5
  import type { Context } from 'hono';
7
6
  import { Hono } from 'hono';
@@ -25,6 +24,7 @@ import type { ResolveHookContext } from 'node:module';
25
24
  import { RollupBuild } from 'rollup';
26
25
  import { RollupOutput } from 'rollup';
27
26
  import { RollupWatcher } from 'rollup';
27
+ import { RuntimeContext } from '@mastra/core/di';
28
28
  import { ServerType } from '@hono/node-server';
29
29
  import { Transform } from 'stream';
30
30
  import { TypedResponse } from 'hono';
@@ -47,10 +47,12 @@ declare function analyzeBundle(entry: string, mastraEntry: string, outputDir: st
47
47
  export { analyzeBundle }
48
48
  export { analyzeBundle as analyzeBundle_alias_1 }
49
49
 
50
- export declare interface ApiError extends Error {
50
+ declare interface ApiError extends Error {
51
51
  message: string;
52
52
  status?: number;
53
53
  }
54
+ export { ApiError }
55
+ export { ApiError as ApiError_alias_1 }
54
56
 
55
57
  declare interface ArchitectureOptions {
56
58
  os?: string[];
@@ -115,22 +117,14 @@ export { createChildProcessLogger }
115
117
  export { createChildProcessLogger as createChildProcessLogger_alias_1 }
116
118
  export { createChildProcessLogger as createChildProcessLogger_alias_2 }
117
119
 
118
- export declare function createHonoServer(mastra: Mastra, options?: {
119
- playground?: boolean;
120
- swaggerUI?: boolean;
121
- apiReqLogs?: boolean;
122
- }): Promise<Hono<{
120
+ export declare function createHonoServer(mastra: Mastra, options?: ServerBundleOptions): Promise<Hono<{
123
121
  Bindings: Bindings;
124
122
  Variables: Variables;
125
123
  }, BlankSchema, "/">>;
126
124
 
127
125
  export declare function createIndex(c: Context): Promise<Response>;
128
126
 
129
- export declare function createNodeServer(mastra: Mastra, options?: {
130
- playground?: boolean;
131
- swaggerUI?: boolean;
132
- apiReqLogs?: boolean;
133
- }): Promise<ServerType>;
127
+ export declare function createNodeServer(mastra: Mastra, options?: ServerBundleOptions): Promise<ServerType>;
134
128
 
135
129
  declare const createPinoStream: (logger: Logger_2) => Transform;
136
130
  export { createPinoStream }
@@ -475,6 +469,13 @@ export declare function rootHandler(c: Context): Promise<Response & TypedRespons
475
469
 
476
470
  export declare function saveMessagesHandler(c: Context): Promise<Response>;
477
471
 
472
+ declare type ServerBundleOptions = {
473
+ playground?: boolean;
474
+ isDev?: boolean;
475
+ };
476
+ export { ServerBundleOptions }
477
+ export { ServerBundleOptions as ServerBundleOptions_alias_1 }
478
+
478
479
  export declare function setAgentInstructionsHandler(c: Context): Promise<Response>;
479
480
 
480
481
  /**
@@ -513,12 +514,13 @@ export declare function validateBody(body: Record<string, unknown>): void;
513
514
 
514
515
  declare type Variables = {
515
516
  mastra: Mastra;
516
- container: Container;
517
+ runtimeContext: RuntimeContext;
517
518
  clients: Set<{
518
519
  controller: ReadableStreamDefaultController;
519
520
  }>;
520
521
  tools: Record<string, any>;
521
522
  playground: boolean;
523
+ isDev: boolean;
522
524
  };
523
525
 
524
526
  export declare function watchWorkflowHandler(c: Context): Response | Promise<Response>;
@@ -531,6 +533,7 @@ declare type WorkspacePackageInfo = {
531
533
 
532
534
  declare function writeTelemetryConfig(entryFile: string, outputDir: string): Promise<{
533
535
  hasCustomConfig: boolean;
536
+ externalDependencies: string[];
534
537
  }>;
535
538
  export { writeTelemetryConfig }
536
539
  export { writeTelemetryConfig as writeTelemetryConfig_alias_1 }
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkZ7KAM3CZ_cjs = require('../chunk-Z7KAM3CZ.cjs');
4
- var chunk2ZPQX6BX_cjs = require('../chunk-2ZPQX6BX.cjs');
3
+ var chunkGDLBKKIV_cjs = require('../chunk-GDLBKKIV.cjs');
4
+ var chunk3R6WDRBB_cjs = require('../chunk-3R6WDRBB.cjs');
5
5
  var chunkLA6Y6GAB_cjs = require('../chunk-LA6Y6GAB.cjs');
6
6
  var chunkIMGVLBV7_cjs = require('../chunk-IMGVLBV7.cjs');
7
7
  var chunk4VC5Z4YR_cjs = require('../chunk-4VC5Z4YR.cjs');
@@ -10,19 +10,19 @@ var chunk4VC5Z4YR_cjs = require('../chunk-4VC5Z4YR.cjs');
10
10
 
11
11
  Object.defineProperty(exports, "createWatcher", {
12
12
  enumerable: true,
13
- get: function () { return chunkZ7KAM3CZ_cjs.createWatcher; }
13
+ get: function () { return chunkGDLBKKIV_cjs.createWatcher; }
14
14
  });
15
15
  Object.defineProperty(exports, "getServerOptions", {
16
16
  enumerable: true,
17
- get: function () { return chunkZ7KAM3CZ_cjs.getServerOptions; }
17
+ get: function () { return chunkGDLBKKIV_cjs.getServerOptions; }
18
18
  });
19
19
  Object.defineProperty(exports, "getWatcherInputOptions", {
20
20
  enumerable: true,
21
- get: function () { return chunkZ7KAM3CZ_cjs.getInputOptions; }
21
+ get: function () { return chunkGDLBKKIV_cjs.getInputOptions; }
22
22
  });
23
23
  Object.defineProperty(exports, "writeTelemetryConfig", {
24
24
  enumerable: true,
25
- get: function () { return chunk2ZPQX6BX_cjs.writeTelemetryConfig; }
25
+ get: function () { return chunk3R6WDRBB_cjs.writeTelemetryConfig; }
26
26
  });
27
27
  Object.defineProperty(exports, "analyzeBundle", {
28
28
  enumerable: true,
@@ -1,5 +1,5 @@
1
- export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-KTYDROLB.js';
2
- export { writeTelemetryConfig } from '../chunk-4AYFLP6G.js';
1
+ export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-ITJLMUBF.js';
2
+ export { writeTelemetryConfig } from '../chunk-TUMXQX4H.js';
3
3
  export { analyzeBundle } from '../chunk-USZDOFES.js';
4
4
  export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-AOSWYZKN.js';
5
5
  export { Deps, FileService } from '../chunk-UV4RQQ3R.js';
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkQ6OKTZNC_cjs = require('../chunk-Q6OKTZNC.cjs');
3
+ var chunkEZPRF2XZ_cjs = require('../chunk-EZPRF2XZ.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "Bundler", {
8
8
  enumerable: true,
9
- get: function () { return chunkQ6OKTZNC_cjs.Bundler; }
9
+ get: function () { return chunkEZPRF2XZ_cjs.Bundler; }
10
10
  });
@@ -1 +1 @@
1
- export { Bundler } from '../chunk-5QD7CDGY.js';
1
+ export { Bundler } from '../chunk-M6HTLNVA.js';
@@ -241,12 +241,13 @@ async function writeTelemetryConfig(entryFile, outputDir) {
241
241
  hasCustomConfig: false
242
242
  };
243
243
  const bundle = await getTelemetryBundler(entryFile, result);
244
- await bundle.write({
244
+ const { output } = await bundle.write({
245
245
  dir: outputDir,
246
246
  format: "es",
247
247
  entryFileNames: "[name].mjs"
248
248
  });
249
- return result;
249
+ const externals = output[0].imports.filter((x) => !x.startsWith("./"));
250
+ return { ...result, externalDependencies: externals };
250
251
  }
251
252
 
252
253
  exports.recursiveRemoveNonReferencedNodes = recursiveRemoveNonReferencedNodes;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk2ZPQX6BX_cjs = require('./chunk-2ZPQX6BX.cjs');
3
+ var chunk3R6WDRBB_cjs = require('./chunk-3R6WDRBB.cjs');
4
4
  var chunkLA6Y6GAB_cjs = require('./chunk-LA6Y6GAB.cjs');
5
5
  var chunkIMGVLBV7_cjs = require('./chunk-IMGVLBV7.cjs');
6
6
  var chunk4VC5Z4YR_cjs = require('./chunk-4VC5Z4YR.cjs');
@@ -130,7 +130,7 @@ var Bundler = class extends bundler.MastraBundler {
130
130
  }
131
131
  async writeInstrumentationFile(outputDirectory) {
132
132
  const instrumentationFile = path.join(outputDirectory, "instrumentation.mjs");
133
- const __dirname = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-Q6OKTZNC.cjs', document.baseURI).href))));
133
+ const __dirname = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-EZPRF2XZ.cjs', document.baseURI).href))));
134
134
  await fsExtra.copy(path.join(__dirname, "templates", "instrumentation-template.js"), instrumentationFile);
135
135
  }
136
136
  async writePackageJson(outputDirectory, dependencies, resolutions) {
@@ -239,9 +239,12 @@ var Bundler = class extends bundler.MastraBundler {
239
239
  "node",
240
240
  this.logger
241
241
  );
242
- await chunk2ZPQX6BX_cjs.writeTelemetryConfig(mastraEntryFile, path.join(outputDirectory, this.outputDir));
243
- const workspaceMap = await createWorkspacePackageMap();
242
+ const { externalDependencies } = await chunk3R6WDRBB_cjs.writeTelemetryConfig(mastraEntryFile, path.join(outputDirectory, this.outputDir));
244
243
  const dependenciesToInstall = /* @__PURE__ */ new Map();
244
+ for (const external of externalDependencies) {
245
+ dependenciesToInstall.set(external, "latest");
246
+ }
247
+ const workspaceMap = await createWorkspacePackageMap();
245
248
  const workspaceDependencies = /* @__PURE__ */ new Set();
246
249
  for (const dep of analyzedBundleInfo.externalDependencies) {
247
250
  try {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk2ZPQX6BX_cjs = require('./chunk-2ZPQX6BX.cjs');
3
+ var chunk3R6WDRBB_cjs = require('./chunk-3R6WDRBB.cjs');
4
4
  var chunkLA6Y6GAB_cjs = require('./chunk-LA6Y6GAB.cjs');
5
5
  var chunkIMGVLBV7_cjs = require('./chunk-IMGVLBV7.cjs');
6
6
  var chunk54KOF3NB_cjs = require('./chunk-54KOF3NB.cjs');
@@ -68,7 +68,7 @@ async function createWatcher(inputOptions, outputOptions) {
68
68
 
69
69
  // src/build/babel/remove-all-options-server.ts
70
70
  function removeAllOptionsExceptServer(result) {
71
- return chunk2ZPQX6BX_cjs.removeAllOptionsFromMastraExcept(result, "server");
71
+ return chunk3R6WDRBB_cjs.removeAllOptionsFromMastraExcept(result, "server");
72
72
  }
73
73
  function getServerOptionsBundler(entryFile, result) {
74
74
  return rollup.rollup({
@@ -131,7 +131,7 @@ function getServerOptionsBundler(entryFile, result) {
131
131
  if (id !== entryFile) {
132
132
  return;
133
133
  }
134
- return chunk2ZPQX6BX_cjs.recursiveRemoveNonReferencedNodes(code);
134
+ return chunk3R6WDRBB_cjs.recursiveRemoveNonReferencedNodes(code);
135
135
  }
136
136
  },
137
137
  // let esbuild remove all unused imports
@@ -1,4 +1,4 @@
1
- import { recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-4AYFLP6G.js';
1
+ import { recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-TUMXQX4H.js';
2
2
  import { aliasHono } from './chunk-USZDOFES.js';
3
3
  import { getInputOptions } from './chunk-AOSWYZKN.js';
4
4
  import { tsConfigPaths } from './chunk-WVBUOQT6.js';
@@ -1,4 +1,4 @@
1
- import { writeTelemetryConfig } from './chunk-4AYFLP6G.js';
1
+ import { writeTelemetryConfig } from './chunk-TUMXQX4H.js';
2
2
  import { analyzeBundle } from './chunk-USZDOFES.js';
3
3
  import { createBundler, getInputOptions } from './chunk-AOSWYZKN.js';
4
4
  import { DepsService, FileService } from './chunk-UV4RQQ3R.js';
@@ -229,9 +229,12 @@ var Bundler = class extends MastraBundler {
229
229
  "node",
230
230
  this.logger
231
231
  );
232
- await writeTelemetryConfig(mastraEntryFile, join(outputDirectory, this.outputDir));
233
- const workspaceMap = await createWorkspacePackageMap();
232
+ const { externalDependencies } = await writeTelemetryConfig(mastraEntryFile, join(outputDirectory, this.outputDir));
234
233
  const dependenciesToInstall = /* @__PURE__ */ new Map();
234
+ for (const external of externalDependencies) {
235
+ dependenciesToInstall.set(external, "latest");
236
+ }
237
+ const workspaceMap = await createWorkspacePackageMap();
235
238
  const workspaceDependencies = /* @__PURE__ */ new Set();
236
239
  for (const dep of analyzedBundleInfo.externalDependencies) {
237
240
  try {
@@ -216,12 +216,13 @@ async function writeTelemetryConfig(entryFile, outputDir) {
216
216
  hasCustomConfig: false
217
217
  };
218
218
  const bundle = await getTelemetryBundler(entryFile, result);
219
- await bundle.write({
219
+ const { output } = await bundle.write({
220
220
  dir: outputDir,
221
221
  format: "es",
222
222
  entryFileNames: "[name].mjs"
223
223
  });
224
- return result;
224
+ const externals = output[0].imports.filter((x) => !x.startsWith("./"));
225
+ return { ...result, externalDependencies: externals };
225
226
  }
226
227
 
227
228
  export { recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept, writeTelemetryConfig };
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkQ6OKTZNC_cjs = require('./chunk-Q6OKTZNC.cjs');
4
- var chunk2ZPQX6BX_cjs = require('./chunk-2ZPQX6BX.cjs');
3
+ var chunkEZPRF2XZ_cjs = require('./chunk-EZPRF2XZ.cjs');
4
+ var chunk3R6WDRBB_cjs = require('./chunk-3R6WDRBB.cjs');
5
5
  var chunk4VC5Z4YR_cjs = require('./chunk-4VC5Z4YR.cjs');
6
6
  var babel = require('@babel/core');
7
7
  var rollup = require('rollup');
@@ -33,7 +33,7 @@ var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
33
33
  var commonjs__default = /*#__PURE__*/_interopDefault(commonjs);
34
34
 
35
35
  // src/deploy/base.ts
36
- var Deployer = class extends chunkQ6OKTZNC_cjs.Bundler {
36
+ var Deployer = class extends chunkEZPRF2XZ_cjs.Bundler {
37
37
  deps = new chunk4VC5Z4YR_cjs.DepsService();
38
38
  constructor(args) {
39
39
  super(args.name, "DEPLOYER");
@@ -147,7 +147,7 @@ function getDeployerBundler(entryFile) {
147
147
  if (id !== entryFile) {
148
148
  return;
149
149
  }
150
- return chunk2ZPQX6BX_cjs.recursiveRemoveNonReferencedNodes(code);
150
+ return chunk3R6WDRBB_cjs.recursiveRemoveNonReferencedNodes(code);
151
151
  }
152
152
  },
153
153
  // let esbuild remove all unused imports
package/dist/index.d.cts CHANGED
@@ -4,3 +4,5 @@ export { getDeployer } from './_tsup-dts-rollup.cjs';
4
4
  export { Deployer } from './_tsup-dts-rollup.cjs';
5
5
  export { createChildProcessLogger } from './_tsup-dts-rollup.cjs';
6
6
  export { createPinoStream } from './_tsup-dts-rollup.cjs';
7
+ export { ApiError } from './_tsup-dts-rollup.cjs';
8
+ export { ServerBundleOptions } from './_tsup-dts-rollup.cjs';
package/dist/index.d.ts CHANGED
@@ -4,3 +4,5 @@ export { getDeployer } from './_tsup-dts-rollup.js';
4
4
  export { Deployer } from './_tsup-dts-rollup.js';
5
5
  export { createChildProcessLogger } from './_tsup-dts-rollup.js';
6
6
  export { createPinoStream } from './_tsup-dts-rollup.js';
7
+ export { ApiError } from './_tsup-dts-rollup.js';
8
+ export { ServerBundleOptions } from './_tsup-dts-rollup.js';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { Bundler } from './chunk-5QD7CDGY.js';
2
- import { recursiveRemoveNonReferencedNodes } from './chunk-4AYFLP6G.js';
1
+ import { Bundler } from './chunk-M6HTLNVA.js';
2
+ import { recursiveRemoveNonReferencedNodes } from './chunk-TUMXQX4H.js';
3
3
  import { DepsService, FileService } from './chunk-UV4RQQ3R.js';
4
4
  export { Deps, FileService, createChildProcessLogger, createPinoStream } from './chunk-UV4RQQ3R.js';
5
5
  import * as babel from '@babel/core';
@@ -901,12 +901,12 @@ async function generateHandler(c2) {
901
901
  try {
902
902
  const mastra = c2.get("mastra");
903
903
  const agentId = c2.req.param("agentId");
904
- const container = c2.get("container");
904
+ const runtimeContext = c2.get("runtimeContext");
905
905
  const body = await c2.req.json();
906
906
  const result = await agents.generateHandler({
907
907
  mastra,
908
908
  agentId,
909
- container,
909
+ runtimeContext,
910
910
  body
911
911
  });
912
912
  return c2.json(result);
@@ -918,12 +918,12 @@ async function streamGenerateHandler(c2) {
918
918
  try {
919
919
  const mastra = c2.get("mastra");
920
920
  const agentId = c2.req.param("agentId");
921
- const container = c2.get("container");
921
+ const runtimeContext = c2.get("runtimeContext");
922
922
  const body = await c2.req.json();
923
923
  const streamResponse = await agents.streamGenerateHandler({
924
924
  mastra,
925
925
  agentId,
926
- container,
926
+ runtimeContext,
927
927
  body
928
928
  });
929
929
  return streamResponse;
@@ -1176,12 +1176,12 @@ async function getNetworkByIdHandler(c2) {
1176
1176
  async function generateHandler2(c2) {
1177
1177
  try {
1178
1178
  const mastra = c2.get("mastra");
1179
- const container = c2.get("container");
1179
+ const runtimeContext = c2.get("runtimeContext");
1180
1180
  const networkId = c2.req.param("networkId");
1181
1181
  const body = await c2.req.json();
1182
1182
  const result = await network.generateHandler({
1183
1183
  mastra,
1184
- container,
1184
+ runtimeContext,
1185
1185
  networkId,
1186
1186
  body
1187
1187
  });
@@ -1193,12 +1193,12 @@ async function generateHandler2(c2) {
1193
1193
  async function streamGenerateHandler2(c2) {
1194
1194
  try {
1195
1195
  const mastra = c2.get("mastra");
1196
- const container = c2.get("container");
1196
+ const runtimeContext = c2.get("runtimeContext");
1197
1197
  const networkId = c2.req.param("networkId");
1198
1198
  const body = await c2.req.json();
1199
1199
  const streamResponse = await network.streamGenerateHandler({
1200
1200
  mastra,
1201
- container,
1201
+ runtimeContext,
1202
1202
  networkId,
1203
1203
  body
1204
1204
  });
@@ -1376,14 +1376,14 @@ function executeToolHandler(tools$1) {
1376
1376
  return async (c2) => {
1377
1377
  try {
1378
1378
  const mastra = c2.get("mastra");
1379
- const container = c2.get("container");
1379
+ const runtimeContext = c2.get("runtimeContext");
1380
1380
  const toolId = decodeURIComponent(c2.req.param("toolId"));
1381
1381
  const { data } = await c2.req.json();
1382
1382
  const result = await tools.executeToolHandler(tools$1)({
1383
1383
  mastra,
1384
1384
  toolId,
1385
1385
  data,
1386
- container
1386
+ runtimeContext
1387
1387
  });
1388
1388
  return c2.json(result);
1389
1389
  } catch (error) {
@@ -1394,7 +1394,7 @@ function executeToolHandler(tools$1) {
1394
1394
  async function executeAgentToolHandler(c2) {
1395
1395
  try {
1396
1396
  const mastra = c2.get("mastra");
1397
- const container = c2.get("container");
1397
+ const runtimeContext = c2.get("runtimeContext");
1398
1398
  const agentId = c2.req.param("agentId");
1399
1399
  const toolId = c2.req.param("toolId");
1400
1400
  const { data } = await c2.req.json();
@@ -1403,7 +1403,7 @@ async function executeAgentToolHandler(c2) {
1403
1403
  agentId,
1404
1404
  toolId,
1405
1405
  data,
1406
- container
1406
+ runtimeContext
1407
1407
  });
1408
1408
  return c2.json(result);
1409
1409
  } catch (error) {
@@ -1594,13 +1594,13 @@ async function getWorkflowByIdHandler(c2) {
1594
1594
  async function startAsyncWorkflowHandler(c2) {
1595
1595
  try {
1596
1596
  const mastra = c2.get("mastra");
1597
- const container = c2.get("container");
1597
+ const runtimeContext = c2.get("runtimeContext");
1598
1598
  const workflowId = c2.req.param("workflowId");
1599
1599
  const triggerData = await c2.req.json();
1600
1600
  const runId = c2.req.query("runId");
1601
1601
  const result = await workflows.startAsyncWorkflowHandler({
1602
1602
  mastra,
1603
- container,
1603
+ runtimeContext,
1604
1604
  workflowId,
1605
1605
  runId,
1606
1606
  triggerData
@@ -1628,13 +1628,13 @@ async function createRunHandler(c2) {
1628
1628
  async function startWorkflowRunHandler(c2) {
1629
1629
  try {
1630
1630
  const mastra = c2.get("mastra");
1631
- const container = c2.get("container");
1631
+ const runtimeContext = c2.get("runtimeContext");
1632
1632
  const workflowId = c2.req.param("workflowId");
1633
1633
  const triggerData = await c2.req.json();
1634
1634
  const runId = c2.req.query("runId");
1635
1635
  await workflows.startWorkflowRunHandler({
1636
1636
  mastra,
1637
- container,
1637
+ runtimeContext,
1638
1638
  workflowId,
1639
1639
  runId,
1640
1640
  triggerData
@@ -1685,7 +1685,7 @@ function watchWorkflowHandler(c2) {
1685
1685
  async function resumeAsyncWorkflowHandler(c2) {
1686
1686
  try {
1687
1687
  const mastra = c2.get("mastra");
1688
- const container = c2.get("container");
1688
+ const runtimeContext = c2.get("runtimeContext");
1689
1689
  const workflowId = c2.req.param("workflowId");
1690
1690
  const runId = c2.req.query("runId");
1691
1691
  const { stepId, context } = await c2.req.json();
@@ -1694,7 +1694,7 @@ async function resumeAsyncWorkflowHandler(c2) {
1694
1694
  }
1695
1695
  const result = await workflows.resumeAsyncWorkflowHandler({
1696
1696
  mastra,
1697
- container,
1697
+ runtimeContext,
1698
1698
  workflowId,
1699
1699
  runId,
1700
1700
  body: { stepId, context }
@@ -1707,7 +1707,7 @@ async function resumeAsyncWorkflowHandler(c2) {
1707
1707
  async function resumeWorkflowHandler(c2) {
1708
1708
  try {
1709
1709
  const mastra = c2.get("mastra");
1710
- const container = c2.get("container");
1710
+ const runtimeContext = c2.get("runtimeContext");
1711
1711
  const workflowId = c2.req.param("workflowId");
1712
1712
  const runId = c2.req.query("runId");
1713
1713
  const { stepId, context } = await c2.req.json();
@@ -1716,7 +1716,7 @@ async function resumeWorkflowHandler(c2) {
1716
1716
  }
1717
1717
  await workflows.resumeWorkflowHandler({
1718
1718
  mastra,
1719
- container,
1719
+ runtimeContext,
1720
1720
  workflowId,
1721
1721
  runId,
1722
1722
  body: { stepId, context }
@@ -1884,16 +1884,14 @@ async function createHonoServer(mastra, options = {}) {
1884
1884
  await next();
1885
1885
  }
1886
1886
  });
1887
- if (options.apiReqLogs) {
1888
- app.use(logger.logger());
1889
- }
1890
1887
  app.onError(errorHandler);
1891
1888
  app.use("*", function setContext(c2, next) {
1892
- const container = new di.Container();
1893
- c2.set("container", container);
1889
+ const runtimeContext = new di.RuntimeContext();
1890
+ c2.set("runtimeContext", runtimeContext);
1894
1891
  c2.set("mastra", mastra);
1895
1892
  c2.set("tools", tools);
1896
1893
  c2.set("playground", options.playground === true);
1894
+ c2.set("isDev", options.isDev === true);
1897
1895
  return next();
1898
1896
  });
1899
1897
  const serverMiddleware = mastra.getServerMiddleware?.();
@@ -1957,6 +1955,9 @@ async function createHonoServer(mastra, options = {}) {
1957
1955
  }
1958
1956
  }
1959
1957
  }
1958
+ if (options?.isDev || server?.build?.apiReqLogs) {
1959
+ app.use(logger.logger());
1960
+ }
1960
1961
  app.get(
1961
1962
  "/api",
1962
1963
  h({
@@ -2943,7 +2944,7 @@ async function createHonoServer(mastra, options = {}) {
2943
2944
  properties: {
2944
2945
  title: { type: "string" },
2945
2946
  metadata: { type: "object" },
2946
- resourceid: { type: "string" },
2947
+ resourceId: { type: "string" },
2947
2948
  threadId: { type: "string" }
2948
2949
  }
2949
2950
  }
@@ -3791,16 +3792,17 @@ async function createHonoServer(mastra, options = {}) {
3791
3792
  }),
3792
3793
  deleteIndex
3793
3794
  );
3794
- app.get(
3795
- "/openapi.json",
3796
- f(app, {
3797
- documentation: {
3798
- info: { title: "Mastra API", version: "1.0.0", description: "Mastra API" }
3799
- }
3800
- })
3801
- );
3802
- app.get("/swagger-ui", middleware({ url: "/openapi.json" }));
3803
- if (options?.swaggerUI) {
3795
+ if (options?.isDev || server?.build?.openAPIDocs || server?.build?.swaggerUI) {
3796
+ app.get(
3797
+ "/openapi.json",
3798
+ f(app, {
3799
+ documentation: {
3800
+ info: { title: "Mastra API", version: "1.0.0", description: "Mastra API" }
3801
+ }
3802
+ })
3803
+ );
3804
+ }
3805
+ if (options?.isDev || server?.build?.swaggerUI) {
3804
3806
  app.get("/swagger-ui", middleware({ url: "/openapi.json" }));
3805
3807
  }
3806
3808
  if (options?.playground) {
@@ -3851,9 +3853,11 @@ async function createNodeServer(mastra, options = {}) {
3851
3853
  },
3852
3854
  () => {
3853
3855
  const logger2 = mastra.getLogger();
3854
- logger2.info(`\u{1F984} Mastra API running on port ${port}/api`);
3855
- logger2.info(`\u{1F4DA} Open API documentation available at http://localhost:${port}/openapi.json`);
3856
- if (options?.swaggerUI) {
3856
+ logger2.info(` Mastra API running on port http://localhost:${process.env.PORT || 4111}/api`);
3857
+ if (options?.isDev) {
3858
+ logger2.info(`\uFFFD Open API documentation available at http://localhost:${port}/openapi.json`);
3859
+ }
3860
+ if (options?.isDev) {
3857
3861
  logger2.info(`\u{1F9EA} Swagger UI available at http://localhost:${port}/swagger-ui`);
3858
3862
  }
3859
3863
  if (options?.playground) {
@@ -11,7 +11,7 @@ import { getMimeType } from 'hono/utils/mime';
11
11
  import { createReadStream, lstatSync } from 'fs';
12
12
  import { html } from 'hono/html';
13
13
  import { Telemetry } from '@mastra/core';
14
- import { Container } from '@mastra/core/di';
14
+ import { RuntimeContext } from '@mastra/core/di';
15
15
  import { Hono } from 'hono';
16
16
  import { bodyLimit } from 'hono/body-limit';
17
17
  import { cors } from 'hono/cors';
@@ -894,12 +894,12 @@ async function generateHandler(c2) {
894
894
  try {
895
895
  const mastra = c2.get("mastra");
896
896
  const agentId = c2.req.param("agentId");
897
- const container = c2.get("container");
897
+ const runtimeContext = c2.get("runtimeContext");
898
898
  const body = await c2.req.json();
899
899
  const result = await generateHandler$2({
900
900
  mastra,
901
901
  agentId,
902
- container,
902
+ runtimeContext,
903
903
  body
904
904
  });
905
905
  return c2.json(result);
@@ -911,12 +911,12 @@ async function streamGenerateHandler(c2) {
911
911
  try {
912
912
  const mastra = c2.get("mastra");
913
913
  const agentId = c2.req.param("agentId");
914
- const container = c2.get("container");
914
+ const runtimeContext = c2.get("runtimeContext");
915
915
  const body = await c2.req.json();
916
916
  const streamResponse = await streamGenerateHandler$2({
917
917
  mastra,
918
918
  agentId,
919
- container,
919
+ runtimeContext,
920
920
  body
921
921
  });
922
922
  return streamResponse;
@@ -1169,12 +1169,12 @@ async function getNetworkByIdHandler(c2) {
1169
1169
  async function generateHandler2(c2) {
1170
1170
  try {
1171
1171
  const mastra = c2.get("mastra");
1172
- const container = c2.get("container");
1172
+ const runtimeContext = c2.get("runtimeContext");
1173
1173
  const networkId = c2.req.param("networkId");
1174
1174
  const body = await c2.req.json();
1175
1175
  const result = await generateHandler$1({
1176
1176
  mastra,
1177
- container,
1177
+ runtimeContext,
1178
1178
  networkId,
1179
1179
  body
1180
1180
  });
@@ -1186,12 +1186,12 @@ async function generateHandler2(c2) {
1186
1186
  async function streamGenerateHandler2(c2) {
1187
1187
  try {
1188
1188
  const mastra = c2.get("mastra");
1189
- const container = c2.get("container");
1189
+ const runtimeContext = c2.get("runtimeContext");
1190
1190
  const networkId = c2.req.param("networkId");
1191
1191
  const body = await c2.req.json();
1192
1192
  const streamResponse = await streamGenerateHandler$1({
1193
1193
  mastra,
1194
- container,
1194
+ runtimeContext,
1195
1195
  networkId,
1196
1196
  body
1197
1197
  });
@@ -1369,14 +1369,14 @@ function executeToolHandler(tools) {
1369
1369
  return async (c2) => {
1370
1370
  try {
1371
1371
  const mastra = c2.get("mastra");
1372
- const container = c2.get("container");
1372
+ const runtimeContext = c2.get("runtimeContext");
1373
1373
  const toolId = decodeURIComponent(c2.req.param("toolId"));
1374
1374
  const { data } = await c2.req.json();
1375
1375
  const result = await executeToolHandler$1(tools)({
1376
1376
  mastra,
1377
1377
  toolId,
1378
1378
  data,
1379
- container
1379
+ runtimeContext
1380
1380
  });
1381
1381
  return c2.json(result);
1382
1382
  } catch (error) {
@@ -1387,7 +1387,7 @@ function executeToolHandler(tools) {
1387
1387
  async function executeAgentToolHandler(c2) {
1388
1388
  try {
1389
1389
  const mastra = c2.get("mastra");
1390
- const container = c2.get("container");
1390
+ const runtimeContext = c2.get("runtimeContext");
1391
1391
  const agentId = c2.req.param("agentId");
1392
1392
  const toolId = c2.req.param("toolId");
1393
1393
  const { data } = await c2.req.json();
@@ -1396,7 +1396,7 @@ async function executeAgentToolHandler(c2) {
1396
1396
  agentId,
1397
1397
  toolId,
1398
1398
  data,
1399
- container
1399
+ runtimeContext
1400
1400
  });
1401
1401
  return c2.json(result);
1402
1402
  } catch (error) {
@@ -1587,13 +1587,13 @@ async function getWorkflowByIdHandler(c2) {
1587
1587
  async function startAsyncWorkflowHandler(c2) {
1588
1588
  try {
1589
1589
  const mastra = c2.get("mastra");
1590
- const container = c2.get("container");
1590
+ const runtimeContext = c2.get("runtimeContext");
1591
1591
  const workflowId = c2.req.param("workflowId");
1592
1592
  const triggerData = await c2.req.json();
1593
1593
  const runId = c2.req.query("runId");
1594
1594
  const result = await startAsyncWorkflowHandler$1({
1595
1595
  mastra,
1596
- container,
1596
+ runtimeContext,
1597
1597
  workflowId,
1598
1598
  runId,
1599
1599
  triggerData
@@ -1621,13 +1621,13 @@ async function createRunHandler(c2) {
1621
1621
  async function startWorkflowRunHandler(c2) {
1622
1622
  try {
1623
1623
  const mastra = c2.get("mastra");
1624
- const container = c2.get("container");
1624
+ const runtimeContext = c2.get("runtimeContext");
1625
1625
  const workflowId = c2.req.param("workflowId");
1626
1626
  const triggerData = await c2.req.json();
1627
1627
  const runId = c2.req.query("runId");
1628
1628
  await startWorkflowRunHandler$1({
1629
1629
  mastra,
1630
- container,
1630
+ runtimeContext,
1631
1631
  workflowId,
1632
1632
  runId,
1633
1633
  triggerData
@@ -1678,7 +1678,7 @@ function watchWorkflowHandler(c2) {
1678
1678
  async function resumeAsyncWorkflowHandler(c2) {
1679
1679
  try {
1680
1680
  const mastra = c2.get("mastra");
1681
- const container = c2.get("container");
1681
+ const runtimeContext = c2.get("runtimeContext");
1682
1682
  const workflowId = c2.req.param("workflowId");
1683
1683
  const runId = c2.req.query("runId");
1684
1684
  const { stepId, context } = await c2.req.json();
@@ -1687,7 +1687,7 @@ async function resumeAsyncWorkflowHandler(c2) {
1687
1687
  }
1688
1688
  const result = await resumeAsyncWorkflowHandler$1({
1689
1689
  mastra,
1690
- container,
1690
+ runtimeContext,
1691
1691
  workflowId,
1692
1692
  runId,
1693
1693
  body: { stepId, context }
@@ -1700,7 +1700,7 @@ async function resumeAsyncWorkflowHandler(c2) {
1700
1700
  async function resumeWorkflowHandler(c2) {
1701
1701
  try {
1702
1702
  const mastra = c2.get("mastra");
1703
- const container = c2.get("container");
1703
+ const runtimeContext = c2.get("runtimeContext");
1704
1704
  const workflowId = c2.req.param("workflowId");
1705
1705
  const runId = c2.req.query("runId");
1706
1706
  const { stepId, context } = await c2.req.json();
@@ -1709,7 +1709,7 @@ async function resumeWorkflowHandler(c2) {
1709
1709
  }
1710
1710
  await resumeWorkflowHandler$1({
1711
1711
  mastra,
1712
- container,
1712
+ runtimeContext,
1713
1713
  workflowId,
1714
1714
  runId,
1715
1715
  body: { stepId, context }
@@ -1877,16 +1877,14 @@ async function createHonoServer(mastra, options = {}) {
1877
1877
  await next();
1878
1878
  }
1879
1879
  });
1880
- if (options.apiReqLogs) {
1881
- app.use(logger());
1882
- }
1883
1880
  app.onError(errorHandler);
1884
1881
  app.use("*", function setContext(c2, next) {
1885
- const container = new Container();
1886
- c2.set("container", container);
1882
+ const runtimeContext = new RuntimeContext();
1883
+ c2.set("runtimeContext", runtimeContext);
1887
1884
  c2.set("mastra", mastra);
1888
1885
  c2.set("tools", tools);
1889
1886
  c2.set("playground", options.playground === true);
1887
+ c2.set("isDev", options.isDev === true);
1890
1888
  return next();
1891
1889
  });
1892
1890
  const serverMiddleware = mastra.getServerMiddleware?.();
@@ -1950,6 +1948,9 @@ async function createHonoServer(mastra, options = {}) {
1950
1948
  }
1951
1949
  }
1952
1950
  }
1951
+ if (options?.isDev || server?.build?.apiReqLogs) {
1952
+ app.use(logger());
1953
+ }
1953
1954
  app.get(
1954
1955
  "/api",
1955
1956
  h({
@@ -2936,7 +2937,7 @@ async function createHonoServer(mastra, options = {}) {
2936
2937
  properties: {
2937
2938
  title: { type: "string" },
2938
2939
  metadata: { type: "object" },
2939
- resourceid: { type: "string" },
2940
+ resourceId: { type: "string" },
2940
2941
  threadId: { type: "string" }
2941
2942
  }
2942
2943
  }
@@ -3784,16 +3785,17 @@ async function createHonoServer(mastra, options = {}) {
3784
3785
  }),
3785
3786
  deleteIndex
3786
3787
  );
3787
- app.get(
3788
- "/openapi.json",
3789
- f(app, {
3790
- documentation: {
3791
- info: { title: "Mastra API", version: "1.0.0", description: "Mastra API" }
3792
- }
3793
- })
3794
- );
3795
- app.get("/swagger-ui", middleware({ url: "/openapi.json" }));
3796
- if (options?.swaggerUI) {
3788
+ if (options?.isDev || server?.build?.openAPIDocs || server?.build?.swaggerUI) {
3789
+ app.get(
3790
+ "/openapi.json",
3791
+ f(app, {
3792
+ documentation: {
3793
+ info: { title: "Mastra API", version: "1.0.0", description: "Mastra API" }
3794
+ }
3795
+ })
3796
+ );
3797
+ }
3798
+ if (options?.isDev || server?.build?.swaggerUI) {
3797
3799
  app.get("/swagger-ui", middleware({ url: "/openapi.json" }));
3798
3800
  }
3799
3801
  if (options?.playground) {
@@ -3844,9 +3846,11 @@ async function createNodeServer(mastra, options = {}) {
3844
3846
  },
3845
3847
  () => {
3846
3848
  const logger2 = mastra.getLogger();
3847
- logger2.info(`\u{1F984} Mastra API running on port ${port}/api`);
3848
- logger2.info(`\u{1F4DA} Open API documentation available at http://localhost:${port}/openapi.json`);
3849
- if (options?.swaggerUI) {
3849
+ logger2.info(` Mastra API running on port http://localhost:${process.env.PORT || 4111}/api`);
3850
+ if (options?.isDev) {
3851
+ logger2.info(`\uFFFD Open API documentation available at http://localhost:${port}/openapi.json`);
3852
+ }
3853
+ if (options?.isDev) {
3850
3854
  logger2.info(`\u{1F9EA} Swagger UI available at http://localhost:${port}/swagger-ui`);
3851
3855
  }
3852
3856
  if (options?.playground) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer",
3
- "version": "0.3.0-alpha.7",
3
+ "version": "0.3.0-alpha.9",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -107,8 +107,8 @@
107
107
  "rollup-plugin-node-externals": "^8.0.0",
108
108
  "typescript-paths": "^1.5.1",
109
109
  "zod": "^3.24.2",
110
- "@mastra/core": "^0.9.0-alpha.6",
111
- "@mastra/server": "^2.0.0-alpha.6"
110
+ "@mastra/core": "^0.9.0-alpha.8",
111
+ "@mastra/server": "^2.0.0-alpha.8"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@hono/node-server": "^1.13.8",