@mastra/deployer 0.10.8 → 0.10.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.
@@ -102,6 +102,8 @@ export declare abstract class Bundler extends MastraBundler {
102
102
 
103
103
  export declare const canAccessPublicly: (path: string, method: string, authConfig: MastraAuthConfig) => boolean;
104
104
 
105
+ export declare function cancelWorkflowRunHandler(c: Context): Promise<Response>;
106
+
105
107
  export declare const checkRules: (rules: MastraAuthConfig["rules"], path: string, method: string, user: unknown) => Promise<boolean>;
106
108
 
107
109
  /**
@@ -102,6 +102,8 @@ export declare abstract class Bundler extends MastraBundler {
102
102
 
103
103
  export declare const canAccessPublicly: (path: string, method: string, authConfig: MastraAuthConfig) => boolean;
104
104
 
105
+ export declare function cancelWorkflowRunHandler(c: Context): Promise<Response>;
106
+
105
107
  export declare const checkRules: (rules: MastraAuthConfig["rules"], path: string, method: string, user: unknown) => Promise<boolean>;
106
108
 
107
109
  /**
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkF4JNMQTU_cjs = require('../chunk-F4JNMQTU.cjs');
3
+ var chunkXKH6F4NE_cjs = require('../chunk-XKH6F4NE.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "analyzeBundle", {
8
8
  enumerable: true,
9
- get: function () { return chunkF4JNMQTU_cjs.analyzeBundle; }
9
+ get: function () { return chunkXKH6F4NE_cjs.analyzeBundle; }
10
10
  });
@@ -1 +1 @@
1
- export { analyzeBundle } from '../chunk-J2V6UIZO.js';
1
+ export { analyzeBundle } from '../chunk-UYQZMNZL.js';
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunkIMGVLBV7_cjs = require('../chunk-IMGVLBV7.cjs');
3
+ var chunkL57D5DQ7_cjs = require('../chunk-L57D5DQ7.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "createBundler", {
8
8
  enumerable: true,
9
- get: function () { return chunkIMGVLBV7_cjs.createBundler; }
9
+ get: function () { return chunkL57D5DQ7_cjs.createBundler; }
10
10
  });
11
11
  Object.defineProperty(exports, "getInputOptions", {
12
12
  enumerable: true,
13
- get: function () { return chunkIMGVLBV7_cjs.getInputOptions; }
13
+ get: function () { return chunkL57D5DQ7_cjs.getInputOptions; }
14
14
  });
@@ -1 +1 @@
1
- export { createBundler, getInputOptions } from '../chunk-HHOCIHND.js';
1
+ export { createBundler, getInputOptions } from '../chunk-SRKUJD34.js';
@@ -1,44 +1,44 @@
1
1
  'use strict';
2
2
 
3
- var chunkUTZFG7JQ_cjs = require('../chunk-UTZFG7JQ.cjs');
4
- var chunkIFU2DUSR_cjs = require('../chunk-IFU2DUSR.cjs');
5
- var chunkF4JNMQTU_cjs = require('../chunk-F4JNMQTU.cjs');
6
- var chunkIMGVLBV7_cjs = require('../chunk-IMGVLBV7.cjs');
3
+ var chunkK3FREUH7_cjs = require('../chunk-K3FREUH7.cjs');
4
+ var chunkM2VZQFTW_cjs = require('../chunk-M2VZQFTW.cjs');
5
+ var chunkXKH6F4NE_cjs = require('../chunk-XKH6F4NE.cjs');
6
+ var chunkL57D5DQ7_cjs = require('../chunk-L57D5DQ7.cjs');
7
7
  var chunk7ICGDVC3_cjs = require('../chunk-7ICGDVC3.cjs');
8
8
 
9
9
 
10
10
 
11
11
  Object.defineProperty(exports, "createWatcher", {
12
12
  enumerable: true,
13
- get: function () { return chunkUTZFG7JQ_cjs.createWatcher; }
13
+ get: function () { return chunkK3FREUH7_cjs.createWatcher; }
14
14
  });
15
15
  Object.defineProperty(exports, "getServerOptions", {
16
16
  enumerable: true,
17
- get: function () { return chunkUTZFG7JQ_cjs.getServerOptions; }
17
+ get: function () { return chunkK3FREUH7_cjs.getServerOptions; }
18
18
  });
19
19
  Object.defineProperty(exports, "getWatcherInputOptions", {
20
20
  enumerable: true,
21
- get: function () { return chunkUTZFG7JQ_cjs.getInputOptions; }
21
+ get: function () { return chunkK3FREUH7_cjs.getInputOptions; }
22
22
  });
23
23
  Object.defineProperty(exports, "writeTelemetryConfig", {
24
24
  enumerable: true,
25
- get: function () { return chunkIFU2DUSR_cjs.writeTelemetryConfig; }
25
+ get: function () { return chunkM2VZQFTW_cjs.writeTelemetryConfig; }
26
26
  });
27
27
  Object.defineProperty(exports, "analyzeBundle", {
28
28
  enumerable: true,
29
- get: function () { return chunkF4JNMQTU_cjs.analyzeBundle; }
29
+ get: function () { return chunkXKH6F4NE_cjs.analyzeBundle; }
30
30
  });
31
31
  Object.defineProperty(exports, "getBundlerOptions", {
32
32
  enumerable: true,
33
- get: function () { return chunkF4JNMQTU_cjs.getBundlerOptions; }
33
+ get: function () { return chunkXKH6F4NE_cjs.getBundlerOptions; }
34
34
  });
35
35
  Object.defineProperty(exports, "createBundler", {
36
36
  enumerable: true,
37
- get: function () { return chunkIMGVLBV7_cjs.createBundler; }
37
+ get: function () { return chunkL57D5DQ7_cjs.createBundler; }
38
38
  });
39
39
  Object.defineProperty(exports, "getBundlerInputOptions", {
40
40
  enumerable: true,
41
- get: function () { return chunkIMGVLBV7_cjs.getInputOptions; }
41
+ get: function () { return chunkL57D5DQ7_cjs.getInputOptions; }
42
42
  });
43
43
  Object.defineProperty(exports, "Deps", {
44
44
  enumerable: true,
@@ -1,5 +1,5 @@
1
- export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-MGULNF6D.js';
2
- export { writeTelemetryConfig } from '../chunk-KJINZD6K.js';
3
- export { analyzeBundle, getBundlerOptions } from '../chunk-J2V6UIZO.js';
4
- export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-HHOCIHND.js';
1
+ export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-IS3ZPPA4.js';
2
+ export { writeTelemetryConfig } from '../chunk-ENT5RDOI.js';
3
+ export { analyzeBundle, getBundlerOptions } from '../chunk-UYQZMNZL.js';
4
+ export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-SRKUJD34.js';
5
5
  export { Deps, FileService } from '../chunk-4VKGIENI.js';
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkQGO33MM3_cjs = require('../chunk-QGO33MM3.cjs');
3
+ var chunkJFHPQX74_cjs = require('../chunk-JFHPQX74.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "Bundler", {
8
8
  enumerable: true,
9
- get: function () { return chunkQGO33MM3_cjs.Bundler; }
9
+ get: function () { return chunkJFHPQX74_cjs.Bundler; }
10
10
  });
@@ -1 +1 @@
1
- export { Bundler } from '../chunk-72MENR23.js';
1
+ export { Bundler } from '../chunk-XQ4IV7UB.js';
@@ -1,4 +1,4 @@
1
- import { recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-J2V6UIZO.js';
1
+ import { recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-UYQZMNZL.js';
2
2
  import * as babel from '@babel/core';
3
3
  import { rollup } from 'rollup';
4
4
  import esbuild from 'rollup-plugin-esbuild';
@@ -1,5 +1,5 @@
1
- import { aliasHono, recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-J2V6UIZO.js';
2
- import { getInputOptions } from './chunk-HHOCIHND.js';
1
+ import { aliasHono, recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-UYQZMNZL.js';
2
+ import { getInputOptions } from './chunk-SRKUJD34.js';
3
3
  import { tsConfigPaths } from './chunk-Z544XXXK.js';
4
4
  import { watch, rollup } from 'rollup';
5
5
  import { extname, dirname } from 'path';
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkIFU2DUSR_cjs = require('./chunk-IFU2DUSR.cjs');
4
- var chunkF4JNMQTU_cjs = require('./chunk-F4JNMQTU.cjs');
5
- var chunkIMGVLBV7_cjs = require('./chunk-IMGVLBV7.cjs');
3
+ var chunkM2VZQFTW_cjs = require('./chunk-M2VZQFTW.cjs');
4
+ var chunkXKH6F4NE_cjs = require('./chunk-XKH6F4NE.cjs');
5
+ var chunkL57D5DQ7_cjs = require('./chunk-L57D5DQ7.cjs');
6
6
  var chunk7ICGDVC3_cjs = require('./chunk-7ICGDVC3.cjs');
7
7
  var fs = require('fs');
8
8
  var promises = require('fs/promises');
@@ -128,7 +128,7 @@ var Bundler = class extends bundler.MastraBundler {
128
128
  }
129
129
  async writeInstrumentationFile(outputDirectory) {
130
130
  const instrumentationFile = path.join(outputDirectory, "instrumentation.mjs");
131
- 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-QGO33MM3.cjs', document.baseURI).href))));
131
+ 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-JFHPQX74.cjs', document.baseURI).href))));
132
132
  await fsExtra.copy(path.join(__dirname, "templates", "instrumentation-template.js"), instrumentationFile);
133
133
  }
134
134
  async writePackageJson(outputDirectory, dependencies, resolutions) {
@@ -180,10 +180,10 @@ var Bundler = class extends bundler.MastraBundler {
180
180
  );
181
181
  }
182
182
  createBundler(inputOptions, outputOptions) {
183
- return chunkIMGVLBV7_cjs.createBundler(inputOptions, outputOptions);
183
+ return chunkL57D5DQ7_cjs.createBundler(inputOptions, outputOptions);
184
184
  }
185
185
  async analyze(entry, mastraFile, outputDirectory) {
186
- return await chunkF4JNMQTU_cjs.analyzeBundle(
186
+ return await chunkXKH6F4NE_cjs.analyzeBundle(
187
187
  [].concat(entry),
188
188
  mastraFile,
189
189
  path.join(outputDirectory, this.analyzeOutputDir),
@@ -206,7 +206,7 @@ var Bundler = class extends bundler.MastraBundler {
206
206
  await fsExtra.copy(publicDir, path.join(outputDirectory, this.outputDir));
207
207
  }
208
208
  async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths) {
209
- const inputOptions = await chunkIMGVLBV7_cjs.getInputOptions(mastraEntryFile, analyzedBundleInfo, "node", {
209
+ const inputOptions = await chunkL57D5DQ7_cjs.getInputOptions(mastraEntryFile, analyzedBundleInfo, "node", {
210
210
  "process.env.NODE_ENV": JSON.stringify("production")
211
211
  });
212
212
  const isVirtual = serverFile.includes("\n") || fs.existsSync(serverFile);
@@ -254,7 +254,7 @@ var Bundler = class extends bundler.MastraBundler {
254
254
  let analyzedBundleInfo;
255
255
  try {
256
256
  const resolvedToolsPaths = await this.getToolsInputOptions(toolsPaths);
257
- analyzedBundleInfo = await chunkF4JNMQTU_cjs.analyzeBundle(
257
+ analyzedBundleInfo = await chunkXKH6F4NE_cjs.analyzeBundle(
258
258
  [serverFile, ...Object.values(resolvedToolsPaths)],
259
259
  mastraEntryFile,
260
260
  path.join(outputDirectory, this.analyzeOutputDir),
@@ -275,7 +275,7 @@ var Bundler = class extends bundler.MastraBundler {
275
275
  }
276
276
  let externalDependencies;
277
277
  try {
278
- const result = await chunkIFU2DUSR_cjs.writeTelemetryConfig(mastraEntryFile, path.join(outputDirectory, this.outputDir));
278
+ const result = await chunkM2VZQFTW_cjs.writeTelemetryConfig(mastraEntryFile, path.join(outputDirectory, this.outputDir));
279
279
  externalDependencies = result.externalDependencies;
280
280
  } catch (error$1) {
281
281
  const message = error$1 instanceof Error ? error$1.message : String(error$1);
@@ -370,8 +370,19 @@ var Bundler = class extends bundler.MastraBundler {
370
370
  }
371
371
  );
372
372
  await bundler.write();
373
- const toolsInputOptions = Array.from(Object.keys(inputOptions.input || {})).filter((key) => key.startsWith("tools/")).map((key) => `./${key}.mjs`);
374
- await promises.writeFile(path.join(bundleLocation, "tools.mjs"), `export const tools = ${JSON.stringify(toolsInputOptions)};`);
373
+ const toolImports = [];
374
+ const toolsExports = [];
375
+ Array.from(Object.keys(inputOptions.input || {})).filter((key) => key.startsWith("tools/")).forEach((key, index) => {
376
+ const toolExport = `tool${index}`;
377
+ toolImports.push(`import * as ${toolExport} from './${key}.mjs';`);
378
+ toolsExports.push(toolExport);
379
+ });
380
+ await promises.writeFile(
381
+ path.join(bundleLocation, "tools.mjs"),
382
+ `${toolImports.join("\n")}
383
+
384
+ export const tools = [${toolsExports.join(", ")}]`
385
+ );
375
386
  this.logger.info("Bundling Mastra done");
376
387
  this.logger.info("Copying public files");
377
388
  await this.copyPublic(path.dirname(mastraEntryFile), outputDirectory);
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkF4JNMQTU_cjs = require('./chunk-F4JNMQTU.cjs');
4
- var chunkIMGVLBV7_cjs = require('./chunk-IMGVLBV7.cjs');
3
+ var chunkXKH6F4NE_cjs = require('./chunk-XKH6F4NE.cjs');
4
+ var chunkL57D5DQ7_cjs = require('./chunk-L57D5DQ7.cjs');
5
5
  var chunk54KOF3NB_cjs = require('./chunk-54KOF3NB.cjs');
6
6
  var rollup = require('rollup');
7
7
  var path = require('path');
@@ -106,7 +106,7 @@ function nodeModulesExtensionResolver() {
106
106
 
107
107
  // src/build/watcher.ts
108
108
  async function getInputOptions2(entryFile, platform, env) {
109
- const inputOptions = await chunkIMGVLBV7_cjs.getInputOptions(
109
+ const inputOptions = await chunkL57D5DQ7_cjs.getInputOptions(
110
110
  entryFile,
111
111
  {
112
112
  dependencies: /* @__PURE__ */ new Map(),
@@ -121,7 +121,7 @@ async function getInputOptions2(entryFile, platform, env) {
121
121
  // @ts-ignore
122
122
  (plugin) => !plugin || !plugin?.name || plugin.name !== "node-resolve"
123
123
  );
124
- inputOptions.plugins.push(chunkF4JNMQTU_cjs.aliasHono());
124
+ inputOptions.plugins.push(chunkXKH6F4NE_cjs.aliasHono());
125
125
  inputOptions.plugins.push(nodeModulesExtensionResolver());
126
126
  }
127
127
  return inputOptions;
@@ -141,7 +141,7 @@ async function createWatcher(inputOptions, outputOptions) {
141
141
 
142
142
  // src/build/babel/remove-all-options-server.ts
143
143
  function removeAllOptionsExceptServer(result) {
144
- return chunkF4JNMQTU_cjs.removeAllOptionsFromMastraExcept(result, "server");
144
+ return chunkXKH6F4NE_cjs.removeAllOptionsFromMastraExcept(result, "server");
145
145
  }
146
146
  function getServerOptionsBundler(entryFile, result) {
147
147
  return rollup.rollup({
@@ -204,7 +204,7 @@ function getServerOptionsBundler(entryFile, result) {
204
204
  if (id !== entryFile) {
205
205
  return;
206
206
  }
207
- return chunkF4JNMQTU_cjs.recursiveRemoveNonReferencedNodes(code);
207
+ return chunkXKH6F4NE_cjs.recursiveRemoveNonReferencedNodes(code);
208
208
  }
209
209
  },
210
210
  // let esbuild remove all unused imports
@@ -88,6 +88,17 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
88
88
  { find: /^\#mastra$/, replacement: normalizedEntryFile }
89
89
  ]
90
90
  }),
91
+ {
92
+ name: "tools-rewriter",
93
+ resolveId(id) {
94
+ if (id === "#tools") {
95
+ return {
96
+ id: "./tools.mjs",
97
+ external: true
98
+ };
99
+ }
100
+ }
101
+ },
91
102
  esbuild__default.default({
92
103
  target: "node20",
93
104
  platform,
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkF4JNMQTU_cjs = require('./chunk-F4JNMQTU.cjs');
3
+ var chunkXKH6F4NE_cjs = require('./chunk-XKH6F4NE.cjs');
4
4
  var babel = require('@babel/core');
5
5
  var rollup = require('rollup');
6
6
  var esbuild = require('rollup-plugin-esbuild');
@@ -32,7 +32,7 @@ var commonjs__default = /*#__PURE__*/_interopDefault(commonjs);
32
32
 
33
33
  // src/build/babel/remove-all-options-telemetry.ts
34
34
  function removeAllOptionsExceptTelemetry(result) {
35
- return chunkF4JNMQTU_cjs.removeAllOptionsFromMastraExcept(result, "telemetry");
35
+ return chunkXKH6F4NE_cjs.removeAllOptionsFromMastraExcept(result, "telemetry");
36
36
  }
37
37
 
38
38
  // src/build/telemetry.ts
@@ -96,7 +96,7 @@ function getTelemetryBundler(entryFile, result) {
96
96
  if (id !== entryFile) {
97
97
  return;
98
98
  }
99
- return chunkF4JNMQTU_cjs.recursiveRemoveNonReferencedNodes(code);
99
+ return chunkXKH6F4NE_cjs.recursiveRemoveNonReferencedNodes(code);
100
100
  }
101
101
  },
102
102
  // let esbuild remove all unused imports
@@ -78,6 +78,17 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
78
78
  { find: /^\#mastra$/, replacement: normalizedEntryFile }
79
79
  ]
80
80
  }),
81
+ {
82
+ name: "tools-rewriter",
83
+ resolveId(id) {
84
+ if (id === "#tools") {
85
+ return {
86
+ id: "./tools.mjs",
87
+ external: true
88
+ };
89
+ }
90
+ }
91
+ },
81
92
  esbuild({
82
93
  target: "node20",
83
94
  platform,
@@ -354,6 +354,12 @@ async function analyze(entry, mastraEntry, isVirtualFile, platform, logger) {
354
354
  if (id.startsWith("@mastra/server")) {
355
355
  return fileURLToPath(import.meta.resolve(id));
356
356
  }
357
+ if (id === "#tools") {
358
+ return {
359
+ id: "#tools",
360
+ external: true
361
+ };
362
+ }
357
363
  }
358
364
  },
359
365
  json(),
@@ -388,10 +394,15 @@ async function analyze(entry, mastraEntry, isVirtualFile, platform, logger) {
388
394
  }
389
395
  }
390
396
  for (const o of output) {
391
- if (o.type !== "chunk" || o.dynamicImports.length === 0) {
397
+ if (o.type !== "chunk") {
398
+ continue;
399
+ }
400
+ const dynamicImports = o.dynamicImports.filter((d) => d !== "#tools");
401
+ if (!dynamicImports.length) {
392
402
  continue;
393
403
  }
394
- for (const dynamicImport of o.dynamicImports) {
404
+ console.log(dynamicImports);
405
+ for (const dynamicImport of dynamicImports) {
395
406
  if (!depsToOptimize.has(dynamicImport) && !isNodeBuiltin(dynamicImport)) {
396
407
  depsToOptimize.set(dynamicImport, ["*"]);
397
408
  }
@@ -382,6 +382,12 @@ async function analyze(entry, mastraEntry, isVirtualFile, platform, logger) {
382
382
  if (id.startsWith("@mastra/server")) {
383
383
  return url.fileURLToPath(undefined(id));
384
384
  }
385
+ if (id === "#tools") {
386
+ return {
387
+ id: "#tools",
388
+ external: true
389
+ };
390
+ }
385
391
  }
386
392
  },
387
393
  json__default.default(),
@@ -416,10 +422,15 @@ async function analyze(entry, mastraEntry, isVirtualFile, platform, logger) {
416
422
  }
417
423
  }
418
424
  for (const o of output) {
419
- if (o.type !== "chunk" || o.dynamicImports.length === 0) {
425
+ if (o.type !== "chunk") {
426
+ continue;
427
+ }
428
+ const dynamicImports = o.dynamicImports.filter((d) => d !== "#tools");
429
+ if (!dynamicImports.length) {
420
430
  continue;
421
431
  }
422
- for (const dynamicImport of o.dynamicImports) {
432
+ console.log(dynamicImports);
433
+ for (const dynamicImport of dynamicImports) {
423
434
  if (!depsToOptimize.has(dynamicImport) && !isNodeBuiltin(dynamicImport)) {
424
435
  depsToOptimize.set(dynamicImport, ["*"]);
425
436
  }
@@ -1,6 +1,6 @@
1
- import { writeTelemetryConfig } from './chunk-KJINZD6K.js';
2
- import { analyzeBundle } from './chunk-J2V6UIZO.js';
3
- import { createBundler, getInputOptions } from './chunk-HHOCIHND.js';
1
+ import { writeTelemetryConfig } from './chunk-ENT5RDOI.js';
2
+ import { analyzeBundle } from './chunk-UYQZMNZL.js';
3
+ import { createBundler, getInputOptions } from './chunk-SRKUJD34.js';
4
4
  import { DepsService, FileService } from './chunk-4VKGIENI.js';
5
5
  import { existsSync } from 'fs';
6
6
  import { writeFile, stat } from 'fs/promises';
@@ -360,8 +360,19 @@ var Bundler = class extends MastraBundler {
360
360
  }
361
361
  );
362
362
  await bundler.write();
363
- const toolsInputOptions = Array.from(Object.keys(inputOptions.input || {})).filter((key) => key.startsWith("tools/")).map((key) => `./${key}.mjs`);
364
- await writeFile(join(bundleLocation, "tools.mjs"), `export const tools = ${JSON.stringify(toolsInputOptions)};`);
363
+ const toolImports = [];
364
+ const toolsExports = [];
365
+ Array.from(Object.keys(inputOptions.input || {})).filter((key) => key.startsWith("tools/")).forEach((key, index) => {
366
+ const toolExport = `tool${index}`;
367
+ toolImports.push(`import * as ${toolExport} from './${key}.mjs';`);
368
+ toolsExports.push(toolExport);
369
+ });
370
+ await writeFile(
371
+ join(bundleLocation, "tools.mjs"),
372
+ `${toolImports.join("\n")}
373
+
374
+ export const tools = [${toolsExports.join(", ")}]`
375
+ );
365
376
  this.logger.info("Bundling Mastra done");
366
377
  this.logger.info("Copying public files");
367
378
  await this.copyPublic(dirname(mastraEntryFile), outputDirectory);
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkQGO33MM3_cjs = require('./chunk-QGO33MM3.cjs');
4
- var chunkF4JNMQTU_cjs = require('./chunk-F4JNMQTU.cjs');
3
+ var chunkJFHPQX74_cjs = require('./chunk-JFHPQX74.cjs');
4
+ var chunkXKH6F4NE_cjs = require('./chunk-XKH6F4NE.cjs');
5
5
  var chunk7ICGDVC3_cjs = require('./chunk-7ICGDVC3.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 chunkQGO33MM3_cjs.Bundler {
36
+ var Deployer = class extends chunkJFHPQX74_cjs.Bundler {
37
37
  deps = new chunk7ICGDVC3_cjs.DepsService();
38
38
  constructor(args) {
39
39
  super(args.name, "DEPLOYER");
@@ -148,7 +148,7 @@ function getDeployerBundler(entryFile, result) {
148
148
  if (id !== entryFile) {
149
149
  return;
150
150
  }
151
- return chunkF4JNMQTU_cjs.recursiveRemoveNonReferencedNodes(code);
151
+ return chunkXKH6F4NE_cjs.recursiveRemoveNonReferencedNodes(code);
152
152
  }
153
153
  },
154
154
  // let esbuild remove all unused imports
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { Bundler } from './chunk-72MENR23.js';
2
- import { recursiveRemoveNonReferencedNodes } from './chunk-J2V6UIZO.js';
1
+ import { Bundler } from './chunk-XQ4IV7UB.js';
2
+ import { recursiveRemoveNonReferencedNodes } from './chunk-UYQZMNZL.js';
3
3
  import { DepsService, FileService } from './chunk-4VKGIENI.js';
4
4
  export { Deps, FileService, createChildProcessLogger, createPinoStream } from './chunk-4VKGIENI.js';
5
5
  import * as babel from '@babel/core';
@@ -737,7 +737,7 @@ var middleware = (options) => async (c2) => {
737
737
  );
738
738
  };
739
739
 
740
- // ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.8.1_openapi-types@12.1.3_zod@3.25.67/node_modules/hono-openapi/utils.js
740
+ // ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.8.3_openapi-types@12.1.3_zod@3.25.67/node_modules/hono-openapi/utils.js
741
741
  var e = Symbol("openapi");
742
742
  var n = ["GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE"];
743
743
  var s2 = (e2) => e2.charAt(0).toUpperCase() + e2.slice(1);
@@ -4553,6 +4553,21 @@ async function getWorkflowRunExecutionResultHandler(c2) {
4553
4553
  return handleError(error, "Error getting workflow run execution result");
4554
4554
  }
4555
4555
  }
4556
+ async function cancelWorkflowRunHandler(c2) {
4557
+ try {
4558
+ const mastra = c2.get("mastra");
4559
+ const workflowId = c2.req.param("workflowId");
4560
+ const runId = c2.req.param("runId");
4561
+ const result = await workflows.cancelWorkflowRunHandler({
4562
+ mastra,
4563
+ workflowId,
4564
+ runId
4565
+ });
4566
+ return c2.json(result);
4567
+ } catch (error) {
4568
+ return handleError(error, "Error canceling workflow run");
4569
+ }
4570
+ }
4556
4571
 
4557
4572
  // src/server/welcome.ts
4558
4573
  var html2 = `
@@ -4667,14 +4682,7 @@ async function createHonoServer(mastra, options = {}) {
4667
4682
  const server = mastra.getServer();
4668
4683
  let tools = {};
4669
4684
  try {
4670
- const toolsPath = "./tools.mjs";
4671
- const mastraToolsPaths = (await import(toolsPath)).tools;
4672
- const toolImports = mastraToolsPaths ? await Promise.all(
4673
- // @ts-ignore
4674
- mastraToolsPaths.map(async (toolPath) => {
4675
- return import(toolPath);
4676
- })
4677
- ) : [];
4685
+ const toolImports = (await import('#tools')).tools;
4678
4686
  tools = toolImports.reduce((acc, toolModule) => {
4679
4687
  Object.entries(toolModule).forEach(([key, tool]) => {
4680
4688
  acc[key] = tool;
@@ -7698,6 +7706,33 @@ ${err.stack.split("\n").slice(1).join("\n")}
7698
7706
  }),
7699
7707
  watchWorkflowHandler
7700
7708
  );
7709
+ app.post(
7710
+ "/api/workflows/:workflowId/runs/:runId/cancel",
7711
+ w({
7712
+ description: "Cancel a workflow run",
7713
+ parameters: [
7714
+ {
7715
+ name: "workflowId",
7716
+ in: "path",
7717
+ required: true,
7718
+ schema: { type: "string" }
7719
+ },
7720
+ {
7721
+ name: "runId",
7722
+ in: "path",
7723
+ required: true,
7724
+ schema: { type: "string" }
7725
+ }
7726
+ ],
7727
+ tags: ["workflows"],
7728
+ responses: {
7729
+ 200: {
7730
+ description: "workflow run cancelled"
7731
+ }
7732
+ }
7733
+ }),
7734
+ cancelWorkflowRunHandler
7735
+ );
7701
7736
  app.get(
7702
7737
  "/api/logs",
7703
7738
  w({
@@ -32,7 +32,7 @@ import { executeAgentToolHandler as executeAgentToolHandler$1, getToolsHandler a
32
32
  import { upsertVectors as upsertVectors$1, createIndex as createIndex$1, queryVectors as queryVectors$1, listIndexes as listIndexes$1, describeIndex as describeIndex$1, deleteIndex as deleteIndex$1 } from '@mastra/server/handlers/vector';
33
33
  import { getVNextNetworksHandler as getVNextNetworksHandler$1, getVNextNetworkByIdHandler as getVNextNetworkByIdHandler$1, generateVNextNetworkHandler as generateVNextNetworkHandler$1, loopVNextNetworkHandler as loopVNextNetworkHandler$1, loopStreamVNextNetworkHandler as loopStreamVNextNetworkHandler$1, streamGenerateVNextNetworkHandler as streamGenerateVNextNetworkHandler$1 } from '@mastra/server/handlers/vNextNetwork';
34
34
  import { getSpeakersHandler as getSpeakersHandler$1, generateSpeechHandler, getListenerHandler as getListenerHandler$1, transcribeSpeechHandler } from '@mastra/server/handlers/voice';
35
- import { getWorkflowsHandler as getWorkflowsHandler$1, getWorkflowByIdHandler as getWorkflowByIdHandler$1, getWorkflowRunsHandler as getWorkflowRunsHandler$1, getWorkflowRunExecutionResultHandler as getWorkflowRunExecutionResultHandler$1, getWorkflowRunByIdHandler as getWorkflowRunByIdHandler$1, resumeWorkflowHandler as resumeWorkflowHandler$1, resumeAsyncWorkflowHandler as resumeAsyncWorkflowHandler$1, streamWorkflowHandler as streamWorkflowHandler$1, createWorkflowRunHandler as createWorkflowRunHandler$1, startAsyncWorkflowHandler as startAsyncWorkflowHandler$1, startWorkflowRunHandler as startWorkflowRunHandler$1, watchWorkflowHandler as watchWorkflowHandler$1 } from '@mastra/server/handlers/workflows';
35
+ import { getWorkflowsHandler as getWorkflowsHandler$1, getWorkflowByIdHandler as getWorkflowByIdHandler$1, getWorkflowRunsHandler as getWorkflowRunsHandler$1, getWorkflowRunExecutionResultHandler as getWorkflowRunExecutionResultHandler$1, getWorkflowRunByIdHandler as getWorkflowRunByIdHandler$1, resumeWorkflowHandler as resumeWorkflowHandler$1, resumeAsyncWorkflowHandler as resumeAsyncWorkflowHandler$1, streamWorkflowHandler as streamWorkflowHandler$1, createWorkflowRunHandler as createWorkflowRunHandler$1, startAsyncWorkflowHandler as startAsyncWorkflowHandler$1, startWorkflowRunHandler as startWorkflowRunHandler$1, watchWorkflowHandler as watchWorkflowHandler$1, cancelWorkflowRunHandler as cancelWorkflowRunHandler$1 } from '@mastra/server/handlers/workflows';
36
36
 
37
37
  // src/server/index.ts
38
38
  var RequestError = class extends Error {
@@ -730,7 +730,7 @@ var middleware = (options) => async (c2) => {
730
730
  );
731
731
  };
732
732
 
733
- // ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.8.1_openapi-types@12.1.3_zod@3.25.67/node_modules/hono-openapi/utils.js
733
+ // ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.8.3_openapi-types@12.1.3_zod@3.25.67/node_modules/hono-openapi/utils.js
734
734
  var e = Symbol("openapi");
735
735
  var n = ["GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE"];
736
736
  var s2 = (e2) => e2.charAt(0).toUpperCase() + e2.slice(1);
@@ -4546,6 +4546,21 @@ async function getWorkflowRunExecutionResultHandler(c2) {
4546
4546
  return handleError(error, "Error getting workflow run execution result");
4547
4547
  }
4548
4548
  }
4549
+ async function cancelWorkflowRunHandler(c2) {
4550
+ try {
4551
+ const mastra = c2.get("mastra");
4552
+ const workflowId = c2.req.param("workflowId");
4553
+ const runId = c2.req.param("runId");
4554
+ const result = await cancelWorkflowRunHandler$1({
4555
+ mastra,
4556
+ workflowId,
4557
+ runId
4558
+ });
4559
+ return c2.json(result);
4560
+ } catch (error) {
4561
+ return handleError(error, "Error canceling workflow run");
4562
+ }
4563
+ }
4549
4564
 
4550
4565
  // src/server/welcome.ts
4551
4566
  var html2 = `
@@ -4660,14 +4675,7 @@ async function createHonoServer(mastra, options = {}) {
4660
4675
  const server = mastra.getServer();
4661
4676
  let tools = {};
4662
4677
  try {
4663
- const toolsPath = "./tools.mjs";
4664
- const mastraToolsPaths = (await import(toolsPath)).tools;
4665
- const toolImports = mastraToolsPaths ? await Promise.all(
4666
- // @ts-ignore
4667
- mastraToolsPaths.map(async (toolPath) => {
4668
- return import(toolPath);
4669
- })
4670
- ) : [];
4678
+ const toolImports = (await import('#tools')).tools;
4671
4679
  tools = toolImports.reduce((acc, toolModule) => {
4672
4680
  Object.entries(toolModule).forEach(([key, tool]) => {
4673
4681
  acc[key] = tool;
@@ -7691,6 +7699,33 @@ ${err.stack.split("\n").slice(1).join("\n")}
7691
7699
  }),
7692
7700
  watchWorkflowHandler
7693
7701
  );
7702
+ app.post(
7703
+ "/api/workflows/:workflowId/runs/:runId/cancel",
7704
+ w({
7705
+ description: "Cancel a workflow run",
7706
+ parameters: [
7707
+ {
7708
+ name: "workflowId",
7709
+ in: "path",
7710
+ required: true,
7711
+ schema: { type: "string" }
7712
+ },
7713
+ {
7714
+ name: "runId",
7715
+ in: "path",
7716
+ required: true,
7717
+ schema: { type: "string" }
7718
+ }
7719
+ ],
7720
+ tags: ["workflows"],
7721
+ responses: {
7722
+ 200: {
7723
+ description: "workflow run cancelled"
7724
+ }
7725
+ }
7726
+ }),
7727
+ cancelWorkflowRunHandler
7728
+ );
7694
7729
  app.get(
7695
7730
  "/api/logs",
7696
7731
  w({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer",
3
- "version": "0.10.8",
3
+ "version": "0.10.9",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -101,14 +101,14 @@
101
101
  "find-workspaces": "^0.3.1",
102
102
  "fs-extra": "^11.3.0",
103
103
  "globby": "^14.1.0",
104
- "hono": "^4.7.11",
104
+ "hono": "^4.8.3",
105
105
  "resolve-from": "^5.0.0",
106
106
  "rollup": "^4.43.0",
107
107
  "rollup-plugin-esbuild": "^6.2.1",
108
108
  "rollup-plugin-node-externals": "^8.0.1",
109
109
  "typescript-paths": "^1.5.1",
110
110
  "zod": "^3.25.67",
111
- "@mastra/server": "^0.10.8"
111
+ "@mastra/server": "^0.10.9"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@hono/node-server": "^1.14.4",
@@ -126,13 +126,13 @@
126
126
  "tsup": "^8.5.0",
127
127
  "type-fest": "^4.41.0",
128
128
  "typescript": "^5.8.3",
129
- "vitest": "^2.1.9",
130
- "@internal/lint": "0.0.15",
129
+ "vitest": "^3.2.4",
130
+ "@internal/lint": "0.0.16",
131
131
  "@mastra/mcp": "^0.10.5",
132
- "@mastra/core": "0.10.8"
132
+ "@mastra/core": "0.10.9"
133
133
  },
134
134
  "peerDependencies": {
135
- "@mastra/core": "^0.10.2-alpha.0"
135
+ "@mastra/core": ">=0.10.9-0 <0.11.0-0"
136
136
  },
137
137
  "scripts": {
138
138
  "build": "tsup src/index.ts src/build/index.ts src/server/index.ts src/build/bundler.ts src/build/analyze.ts src/bundler/index.ts src/services/index.ts src/validator/loader.ts src/validator/custom-resolver.ts src/instrumentation-template.ts --format esm,cjs --clean --experimental-dts --treeshake=smallest --splitting --publicDir",