@mastra/deployer 0.14.0-alpha.3 → 0.14.0-alpha.5

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 (87) hide show
  1. package/dist/build/analyze.cjs +3 -3
  2. package/dist/build/analyze.d.ts.map +1 -1
  3. package/dist/build/analyze.js +1 -1
  4. package/dist/build/babel/remove-all-options-bundler.d.ts +2 -1
  5. package/dist/build/babel/remove-all-options-bundler.d.ts.map +1 -1
  6. package/dist/build/babel/remove-all-options-deployer.d.ts +5 -0
  7. package/dist/build/babel/remove-all-options-deployer.d.ts.map +1 -0
  8. package/dist/build/babel/remove-all-options-except.d.ts +2 -1
  9. package/dist/build/babel/remove-all-options-except.d.ts.map +1 -1
  10. package/dist/build/babel/remove-all-options-server.d.ts +2 -1
  11. package/dist/build/babel/remove-all-options-server.d.ts.map +1 -1
  12. package/dist/build/babel/remove-all-options-telemetry.d.ts +1 -1
  13. package/dist/build/babel/remove-all-options-telemetry.d.ts.map +1 -1
  14. package/dist/build/bundler.cjs +3 -3
  15. package/dist/build/bundler.d.ts.map +1 -1
  16. package/dist/build/bundler.js +1 -1
  17. package/dist/build/bundlerOptions.d.ts +3 -2
  18. package/dist/build/bundlerOptions.d.ts.map +1 -1
  19. package/dist/build/customInstrumentation.d.ts.map +1 -1
  20. package/dist/build/deployer.d.ts +4 -3
  21. package/dist/build/deployer.d.ts.map +1 -1
  22. package/dist/build/index.cjs +12 -12
  23. package/dist/build/index.js +4 -4
  24. package/dist/build/plugins/esbuild.d.ts +3 -0
  25. package/dist/build/plugins/esbuild.d.ts.map +1 -0
  26. package/dist/build/plugins/tsconfig-paths.d.ts.map +1 -1
  27. package/dist/build/serverOptions.d.ts +3 -2
  28. package/dist/build/serverOptions.d.ts.map +1 -1
  29. package/dist/build/shared/extract-mastra-option.d.ts +15 -0
  30. package/dist/build/shared/extract-mastra-option.d.ts.map +1 -0
  31. package/dist/build/telemetry.d.ts +3 -11
  32. package/dist/build/telemetry.d.ts.map +1 -1
  33. package/dist/bundler/index.cjs +2 -2
  34. package/dist/bundler/index.d.ts.map +1 -1
  35. package/dist/bundler/index.js +1 -1
  36. package/dist/{chunk-SA7YCRKF.js → chunk-3ZVEABRA.js} +21 -100
  37. package/dist/chunk-3ZVEABRA.js.map +1 -0
  38. package/dist/{chunk-3RRMEPHU.js → chunk-4HS72TCL.js} +13 -24
  39. package/dist/chunk-4HS72TCL.js.map +1 -0
  40. package/dist/{chunk-J42QUFVB.cjs → chunk-FIOHFXQ4.cjs} +8 -14
  41. package/dist/chunk-FIOHFXQ4.cjs.map +1 -0
  42. package/dist/{chunk-MRJUFOEN.cjs → chunk-G4TSJE4W.cjs} +47 -52
  43. package/dist/chunk-G4TSJE4W.cjs.map +1 -0
  44. package/dist/{chunk-4CTQZBDI.js → chunk-GXPWEOOA.js} +43 -47
  45. package/dist/chunk-GXPWEOOA.js.map +1 -0
  46. package/dist/chunk-HHNOUMJH.js +26 -0
  47. package/dist/chunk-HHNOUMJH.js.map +1 -0
  48. package/dist/{chunk-VAE7BL7I.cjs → chunk-LG5W6D2R.cjs} +19 -10
  49. package/dist/chunk-LG5W6D2R.cjs.map +1 -0
  50. package/dist/{chunk-OOVC5E4J.js → chunk-NOI4CTSN.js} +18 -10
  51. package/dist/chunk-NOI4CTSN.js.map +1 -0
  52. package/dist/{chunk-N66CXJKO.js → chunk-SBEJU32H.js} +4 -9
  53. package/dist/chunk-SBEJU32H.js.map +1 -0
  54. package/dist/chunk-UD4WRJI3.cjs +28 -0
  55. package/dist/chunk-UD4WRJI3.cjs.map +1 -0
  56. package/dist/{chunk-PBN66NLE.cjs → chunk-UYBVYWPG.cjs} +24 -124
  57. package/dist/chunk-UYBVYWPG.cjs.map +1 -0
  58. package/dist/{chunk-PO2BAZ5A.cjs → chunk-V7XDPQFQ.cjs} +19 -31
  59. package/dist/chunk-V7XDPQFQ.cjs.map +1 -0
  60. package/dist/index.cjs +20 -154
  61. package/dist/index.cjs.map +1 -1
  62. package/dist/index.js +19 -129
  63. package/dist/index.js.map +1 -1
  64. package/dist/server/handlers/routes/agents/handlers.d.ts +12 -1
  65. package/dist/server/handlers/routes/agents/handlers.d.ts.map +1 -1
  66. package/dist/server/handlers/routes/agents/router.d.ts.map +1 -1
  67. package/dist/server/handlers/routes/scores/handlers.d.ts +50 -0
  68. package/dist/server/handlers/routes/scores/handlers.d.ts.map +1 -1
  69. package/dist/server/index.cjs +228 -5
  70. package/dist/server/index.cjs.map +1 -1
  71. package/dist/server/index.js +229 -6
  72. package/dist/server/index.js.map +1 -1
  73. package/package.json +4 -4
  74. package/dist/chunk-3RRMEPHU.js.map +0 -1
  75. package/dist/chunk-4CTQZBDI.js.map +0 -1
  76. package/dist/chunk-EFPKWUPY.js +0 -107
  77. package/dist/chunk-EFPKWUPY.js.map +0 -1
  78. package/dist/chunk-J42QUFVB.cjs.map +0 -1
  79. package/dist/chunk-MRJUFOEN.cjs.map +0 -1
  80. package/dist/chunk-N66CXJKO.js.map +0 -1
  81. package/dist/chunk-OOVC5E4J.js.map +0 -1
  82. package/dist/chunk-PBN66NLE.cjs.map +0 -1
  83. package/dist/chunk-PO2BAZ5A.cjs.map +0 -1
  84. package/dist/chunk-SA7YCRKF.js.map +0 -1
  85. package/dist/chunk-VAE7BL7I.cjs.map +0 -1
  86. package/dist/chunk-ZGXUX6Z6.cjs +0 -133
  87. package/dist/chunk-ZGXUX6Z6.cjs.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,41 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkPO2BAZ5A_cjs = require('./chunk-PO2BAZ5A.cjs');
4
- var chunkMRJUFOEN_cjs = require('./chunk-MRJUFOEN.cjs');
3
+ var chunkV7XDPQFQ_cjs = require('./chunk-V7XDPQFQ.cjs');
4
+ var chunkG4TSJE4W_cjs = require('./chunk-G4TSJE4W.cjs');
5
5
  var chunkJ4SL7224_cjs = require('./chunk-J4SL7224.cjs');
6
- var babel = require('@babel/core');
7
- var rollup = require('rollup');
8
- var esbuild = require('rollup-plugin-esbuild');
9
- var commonjs = require('@rollup/plugin-commonjs');
10
- var json = require('@rollup/plugin-json');
11
-
12
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
-
14
- function _interopNamespace(e) {
15
- if (e && e.__esModule) return e;
16
- var n = Object.create(null);
17
- if (e) {
18
- Object.keys(e).forEach(function (k) {
19
- if (k !== 'default') {
20
- var d = Object.getOwnPropertyDescriptor(e, k);
21
- Object.defineProperty(n, k, d.get ? d : {
22
- enumerable: true,
23
- get: function () { return e[k]; }
24
- });
25
- }
26
- });
27
- }
28
- n.default = e;
29
- return Object.freeze(n);
30
- }
31
-
32
- var babel__namespace = /*#__PURE__*/_interopNamespace(babel);
33
- var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
34
- var commonjs__default = /*#__PURE__*/_interopDefault(commonjs);
35
- var json__default = /*#__PURE__*/_interopDefault(json);
36
6
 
37
7
  // src/deploy/base.ts
38
- var Deployer = class extends chunkPO2BAZ5A_cjs.Bundler {
8
+ var Deployer = class extends chunkV7XDPQFQ_cjs.Bundler {
39
9
  deps = new chunkJ4SL7224_cjs.DepsService();
40
10
  constructor(args) {
41
11
  super(args.name, "DEPLOYER");
@@ -52,129 +22,25 @@ var Deployer = class extends chunkPO2BAZ5A_cjs.Bundler {
52
22
  return Promise.resolve([]);
53
23
  }
54
24
  };
55
- function removeAllExceptDeployer() {
56
- const t = babel__namespace.default.types;
57
- return {
58
- name: "remove-all-except-deployer",
59
- visitor: {
60
- ExportNamedDeclaration: {
61
- // remove all exports
62
- exit(path) {
63
- path.remove();
64
- }
65
- },
66
- NewExpression(path) {
67
- const varDeclaratorPath = path.findParent((path2) => t.isVariableDeclarator(path2.node));
68
- if (!varDeclaratorPath) {
69
- return;
70
- }
71
- const parentNode = path.parentPath.node;
72
- if (!t.isVariableDeclarator(parentNode) || !t.isIdentifier(parentNode.id) || parentNode.id.name !== "mastra") {
73
- return;
74
- }
75
- const deployer = path.node.arguments[0]?.properties?.find(
76
- // @ts-ignore
77
- (prop) => prop.key.name === "deployer"
78
- );
79
- const programPath = path.scope.getProgramParent().path;
80
- if (!deployer || !programPath) {
81
- return;
82
- }
83
- const exportDeclaration = t.exportNamedDeclaration(
84
- t.variableDeclaration("const", [t.variableDeclarator(t.identifier("deployer"), deployer.value)]),
85
- []
86
- );
87
- programPath.node.body.push(exportDeclaration);
88
- }
89
- }
90
- };
91
- }
92
- function getDeployerBundler(entryFile, result) {
93
- return rollup.rollup({
94
- logLevel: "silent",
95
- input: {
96
- deployer: entryFile
97
- },
98
- treeshake: "smallest",
99
- plugins: [
100
- // transpile typescript to something we understand
101
- esbuild__default.default({
102
- target: "node20",
103
- platform: "node",
104
- minify: false
105
- }),
106
- commonjs__default.default({
107
- extensions: [".js", ".ts"],
108
- strictRequires: "strict",
109
- transformMixedEsModules: true,
110
- ignoreTryCatch: false
111
- }),
112
- {
113
- name: "get-deployer",
114
- transform(code, id) {
115
- if (id !== entryFile) {
116
- return;
117
- }
118
- result.isDeployerRemoved = true;
119
- return new Promise((resolve, reject) => {
120
- babel__namespace.transform(
121
- code,
122
- {
123
- babelrc: false,
124
- configFile: false,
125
- filename: id,
126
- plugins: [removeAllExceptDeployer]
127
- },
128
- (err, result2) => {
129
- if (err) {
130
- return reject(err);
131
- }
132
- resolve({
133
- code: result2.code,
134
- map: result2.map
135
- });
136
- }
137
- );
138
- });
139
- }
140
- },
141
- // let esbuild remove all unused imports
142
- esbuild__default.default({
143
- target: "node20",
144
- platform: "node",
145
- minify: false
146
- }),
147
- {
148
- name: "cleanup-nodes",
149
- transform(code, id) {
150
- if (id !== entryFile) {
151
- return;
152
- }
153
- return chunkMRJUFOEN_cjs.recursiveRemoveNonReferencedNodes(code);
154
- }
155
- },
156
- // let esbuild remove all unused imports
157
- esbuild__default.default({
158
- target: "node20",
159
- platform: "node",
160
- minify: false
161
- }),
162
- json__default.default()
163
- ]
164
- });
25
+
26
+ // src/build/babel/remove-all-options-deployer.ts
27
+ function removeAllOptionsExceptDeployer(result, logger) {
28
+ return chunkG4TSJE4W_cjs.removeAllOptionsFromMastraExcept(result, "deployer", logger);
165
29
  }
166
- async function getDeployer(entryFile, outputDir) {
167
- const result = { isDeployerRemoved: false };
168
- const bundle = await getDeployerBundler(entryFile, result);
169
- await bundle.write({
170
- dir: outputDir,
171
- format: "es",
172
- entryFileNames: "[name].mjs"
173
- });
174
- if (!result.isDeployerRemoved) {
175
- return;
30
+
31
+ // src/build/deployer.ts
32
+ async function getDeployer(entryFile, outputDir, logger) {
33
+ const result = await chunkG4TSJE4W_cjs.extractMastraOption(
34
+ "deployer",
35
+ entryFile,
36
+ removeAllOptionsExceptDeployer,
37
+ outputDir,
38
+ logger
39
+ );
40
+ if (!result) {
41
+ return null;
176
42
  }
177
- return (await import(`file:${outputDir}/deployer.mjs`)).deployer;
43
+ return result.getConfig();
178
44
  }
179
45
 
180
46
  Object.defineProperty(exports, "Deps", {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/deploy/base.ts","../src/build/babel/get-deployer.ts","../src/build/deployer.ts"],"names":["Bundler","DepsService","FileService","babel","path","rollup","esbuild","commonjs","babel2","result","recursiveRemoveNonReferencedNodes","json"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMO,IAAe,QAAA,GAAf,cAAgCA,yBAAA,CAA6B;AAAA,EAClE,IAAA,GAAoB,IAAIC,6BAAA,EAAY;AAAA,EAEpC,YAAY,IAAA,EAAwB;AAClC,IAAA,KAAA,CAAM,IAAA,CAAK,MAAM,UAAU,CAAA;AAE3B,IAAA,IAAA,CAAK,IAAA,CAAK,WAAA,CAAY,IAAA,CAAK,MAAM,CAAA;AAAA,EACnC;AAAA,EAEA,WAAA,GAAiC;AAC/B,IAAA,MAAM,aAAA,GAAgB,CAAC,iBAAA,EAAmB,YAAA,EAAc,MAAM,CAAA;AAE9D,IAAA,IAAI;AACF,MAAA,MAAM,WAAA,GAAc,IAAIC,6BAAA,EA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AAAA,IACjB,GAAA,EAAK,SAAA;AAAA,IACL,MAAA,EAAQ,IAAA;AAAA,IACR,cAAA,EAAgB;AAAA,GACjB,CAAA;AAED,EAAA,IAAI,CAAC,OAAO,iBAAA,EAAmB;AAC7B,IAAA;AAAA,EACF;AAEA,EAAA,OAAA,CAAQ,MAAM,OAAO,CAAA,KAAA,EAAQ,SAAS,CAAA,aAAA,CAAA,CAAA,EAAkB,QAAA;AAC1D","file":"index.cjs","sourcesContent":["import type { IDeployer } from '@mastra/core/deployer';\n\nimport { Bundler } from '../bundler';\nimport { DepsService } from '../services/deps.js';\nimport { FileService } from '../services/fs.js';\n\nexport abstract class Deployer extends Bundler implements IDeployer {\n deps: DepsService = new DepsService();\n\n constructor(args: { name: string }) {\n super(args.name, 'DEPLOYER');\n\n this.deps.__setLogger(this.logger);\n }\n\n getEnvFiles(): Promise<string[]> {\n const possibleFiles = ['.env.production', '.env.local', '.env'];\n\n try {\n const fileService = new FileService();\n const envFile = fileService.getFirstExistingFile(possibleFiles);\n\n return Promise.resolve([envFile]);\n } catch {}\n\n return Promise.resolve([]);\n }\n\n abstract deploy(outputDirectory: string): Promise<void>;\n}\n","import babel from '@babel/core';\n\nexport function removeAllExceptDeployer() {\n const t = babel.types;\n\n return {\n name: 'remove-all-except-deployer',\n visitor: {\n ExportNamedDeclaration: {\n // remove all exports\n exit(path) {\n path.remove();\n },\n },\n\n NewExpression(path) {\n // is a variable declaration\n const varDeclaratorPath = path.findParent(path => t.isVariableDeclarator(path.node));\n if (!varDeclaratorPath) {\n return;\n }\n\n const parentNode = path.parentPath.node;\n // check if it's a const of mastra\n if (!t.isVariableDeclarator(parentNode) || !t.isIdentifier(parentNode.id) || parentNode.id.name !== 'mastra') {\n return;\n }\n\n // @ts-ignore\n const deployer = path.node.arguments[0]?.properties?.find(\n // @ts-ignore\n prop => prop.key.name === 'deployer',\n );\n\n const programPath = path.scope.getProgramParent().path;\n if (!deployer || !programPath) {\n return;\n }\n\n // add the deployer export\n const exportDeclaration = t.exportNamedDeclaration(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier('deployer'), deployer.value)]),\n [],\n );\n\n // @ts-ignore\n programPath.node.body.push(exportDeclaration);\n },\n },\n } as babel.PluginObj;\n}\n","import * as babel from '@babel/core';\nimport type { MastraDeployer } from '@mastra/core';\nimport { rollup } from 'rollup';\nimport esbuild from 'rollup-plugin-esbuild';\n\nimport { removeAllExceptDeployer } from './babel/get-deployer';\nimport commonjs from '@rollup/plugin-commonjs';\nimport json from '@rollup/plugin-json';\nimport { recursiveRemoveNonReferencedNodes } from './plugins/remove-unused-references';\n\nexport function getDeployerBundler(entryFile: string, result: { isDeployerRemoved: boolean }) {\n return rollup({\n logLevel: 'silent',\n input: {\n deployer: entryFile,\n },\n treeshake: 'smallest',\n plugins: [\n // transpile typescript to something we understand\n esbuild({\n target: 'node20',\n platform: 'node',\n minify: false,\n }),\n commonjs({\n extensions: ['.js', '.ts'],\n strictRequires: 'strict',\n transformMixedEsModules: true,\n ignoreTryCatch: false,\n }),\n {\n name: 'get-deployer',\n transform(code, id) {\n if (id !== entryFile) {\n return;\n }\n\n result.isDeployerRemoved = true;\n return new Promise((resolve, reject) => {\n babel.transform(\n code,\n {\n babelrc: false,\n configFile: false,\n filename: id,\n plugins: [removeAllExceptDeployer],\n },\n (err, result) => {\n if (err) {\n return reject(err);\n }\n\n resolve({\n code: result!.code!,\n map: result!.map!,\n });\n },\n );\n });\n },\n },\n // let esbuild remove all unused imports\n esbuild({\n target: 'node20',\n platform: 'node',\n minify: false,\n }),\n {\n name: 'cleanup-nodes',\n transform(code, id) {\n if (id !== entryFile) {\n return;\n }\n\n return recursiveRemoveNonReferencedNodes(code);\n },\n },\n // let esbuild remove all unused imports\n esbuild({\n target: 'node20',\n platform: 'node',\n minify: false,\n }),\n json(),\n ],\n });\n}\n\nexport async function getDeployer(entryFile: string, outputDir: string) {\n const result: { isDeployerRemoved: boolean } = { isDeployerRemoved: false };\n const bundle = await getDeployerBundler(entryFile, result);\n\n await bundle.write({\n dir: outputDir,\n format: 'es',\n entryFileNames: '[name].mjs',\n });\n\n if (!result.isDeployerRemoved) {\n return;\n }\n\n return (await import(`file:${outputDir}/deployer.mjs`)).deployer as unknown as MastraDeployer;\n}\n"]}
1
+ {"version":3,"sources":["../src/deploy/base.ts","../src/build/babel/remove-all-options-deployer.ts","../src/build/deployer.ts"],"names":["Bundler","DepsService","FileService","removeAllOptionsFromMastraExcept","extractMastraOption"],"mappings":";;;;;;;AAMO,IAAe,QAAA,GAAf,cAAgCA,yBAAA,CAA6B;AAAA,EAClE,IAAA,GAAoB,IAAIC,6BAAA,EAAY;AAAA,EAEpC,YAAY,IAAA,EAAwB;AAClC,IAAA,KAAA,CAAM,IAAA,CAAK,MAAM,UAAU,CAAA;AAE3B,IAAA,IAAA,CAAK,IAAA,CAAK,WAAA,CAAY,IAAA,CAAK,MAAM,CAAA;AAAA,EACnC;AAAA,EAEA,WAAA,GAAiC;AAC/B,IAAA,MAAM,aAAA,GAAgB,CAAC,iBAAA,EAAmB,YAAA,EAAc,MAAM,CAAA;AAE9D,IAAA,IAAI;AACF,MAAA,MAAM,WAAA,GAAc,IAAIC,6BAAA,EAAY;AACpC,MAAA,MAAM,OAAA,GAAU,WAAA,CAAY,oBAAA,CAAqB,aAAa,CAAA;AAE9D,MAAA,OAAO,OAAA,CAAQ,OAAA,CAAQ,CAAC,OAAO,CAAC,CAAA;AAAA,IAClC,CAAA,CAAA,MAAQ;AAAA,IAAC;AAET,IAAA,OAAO,OAAA,CAAQ,OAAA,CAAQ,EAAE,CAAA;AAAA,EAC3B;AAGF;;;AC1BO,SAAS,8BAAA,CAA+B,QAAsC,MAAA,EAAwB;AAC3G,EAAA,OAAOC,kDAAA,CAAiC,MAAA,EAAQ,UAAA,EAAY,MAAM,CAAA;AACpE;;;ACSA,eAAsB,WAAA,CACpB,SAAA,EACA,SAAA,EACA,MAAA,EACoC;AACpC,EAAA,MAAM,SAAS,MAAMC,qCAAA;AAAA,IACnB,UAAA;AAAA,IACA,SAAA;AAAA,IACA,8BAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,OAAO,SAAA,EAAU;AAC1B","file":"index.cjs","sourcesContent":["import type { IDeployer } from '@mastra/core/deployer';\n\nimport { Bundler } from '../bundler';\nimport { DepsService } from '../services/deps.js';\nimport { FileService } from '../services/fs.js';\n\nexport abstract class Deployer extends Bundler implements IDeployer {\n deps: DepsService = new DepsService();\n\n constructor(args: { name: string }) {\n super(args.name, 'DEPLOYER');\n\n this.deps.__setLogger(this.logger);\n }\n\n getEnvFiles(): Promise<string[]> {\n const possibleFiles = ['.env.production', '.env.local', '.env'];\n\n try {\n const fileService = new FileService();\n const envFile = fileService.getFirstExistingFile(possibleFiles);\n\n return Promise.resolve([envFile]);\n } catch {}\n\n return Promise.resolve([]);\n }\n\n abstract deploy(outputDirectory: string): Promise<void>;\n}\n","import { removeAllOptionsFromMastraExcept } from './remove-all-options-except';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function removeAllOptionsExceptDeployer(result: { hasCustomConfig: boolean }, logger?: IMastraLogger) {\n return removeAllOptionsFromMastraExcept(result, 'deployer', logger);\n}\n","import { removeAllOptionsExceptDeployer } from './babel/remove-all-options-deployer';\nimport type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function getDeployerBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('deployer', entryFile, removeAllOptionsExceptDeployer, result);\n}\n\nexport async function getDeployer(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['deployer'] | null> {\n const result = await extractMastraOption<Config['deployer']>(\n 'deployer',\n entryFile,\n removeAllOptionsExceptDeployer,\n outputDir,\n logger,\n );\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"]}
package/dist/index.js CHANGED
@@ -1,13 +1,7 @@
1
- import { Bundler } from './chunk-3RRMEPHU.js';
2
- import { recursiveRemoveNonReferencedNodes } from './chunk-4CTQZBDI.js';
1
+ import { Bundler } from './chunk-4HS72TCL.js';
2
+ import { extractMastraOption, removeAllOptionsFromMastraExcept } from './chunk-GXPWEOOA.js';
3
3
  import { DepsService, FileService } from './chunk-37Q52RJU.js';
4
4
  export { Deps, FileService, createChildProcessLogger, createPinoStream } from './chunk-37Q52RJU.js';
5
- import * as babel from '@babel/core';
6
- import babel__default from '@babel/core';
7
- import { rollup } from 'rollup';
8
- import esbuild from 'rollup-plugin-esbuild';
9
- import commonjs from '@rollup/plugin-commonjs';
10
- import json from '@rollup/plugin-json';
11
5
 
12
6
  // src/deploy/base.ts
13
7
  var Deployer = class extends Bundler {
@@ -27,129 +21,25 @@ var Deployer = class extends Bundler {
27
21
  return Promise.resolve([]);
28
22
  }
29
23
  };
30
- function removeAllExceptDeployer() {
31
- const t = babel__default.types;
32
- return {
33
- name: "remove-all-except-deployer",
34
- visitor: {
35
- ExportNamedDeclaration: {
36
- // remove all exports
37
- exit(path) {
38
- path.remove();
39
- }
40
- },
41
- NewExpression(path) {
42
- const varDeclaratorPath = path.findParent((path2) => t.isVariableDeclarator(path2.node));
43
- if (!varDeclaratorPath) {
44
- return;
45
- }
46
- const parentNode = path.parentPath.node;
47
- if (!t.isVariableDeclarator(parentNode) || !t.isIdentifier(parentNode.id) || parentNode.id.name !== "mastra") {
48
- return;
49
- }
50
- const deployer = path.node.arguments[0]?.properties?.find(
51
- // @ts-ignore
52
- (prop) => prop.key.name === "deployer"
53
- );
54
- const programPath = path.scope.getProgramParent().path;
55
- if (!deployer || !programPath) {
56
- return;
57
- }
58
- const exportDeclaration = t.exportNamedDeclaration(
59
- t.variableDeclaration("const", [t.variableDeclarator(t.identifier("deployer"), deployer.value)]),
60
- []
61
- );
62
- programPath.node.body.push(exportDeclaration);
63
- }
64
- }
65
- };
66
- }
67
- function getDeployerBundler(entryFile, result) {
68
- return rollup({
69
- logLevel: "silent",
70
- input: {
71
- deployer: entryFile
72
- },
73
- treeshake: "smallest",
74
- plugins: [
75
- // transpile typescript to something we understand
76
- esbuild({
77
- target: "node20",
78
- platform: "node",
79
- minify: false
80
- }),
81
- commonjs({
82
- extensions: [".js", ".ts"],
83
- strictRequires: "strict",
84
- transformMixedEsModules: true,
85
- ignoreTryCatch: false
86
- }),
87
- {
88
- name: "get-deployer",
89
- transform(code, id) {
90
- if (id !== entryFile) {
91
- return;
92
- }
93
- result.isDeployerRemoved = true;
94
- return new Promise((resolve, reject) => {
95
- babel.transform(
96
- code,
97
- {
98
- babelrc: false,
99
- configFile: false,
100
- filename: id,
101
- plugins: [removeAllExceptDeployer]
102
- },
103
- (err, result2) => {
104
- if (err) {
105
- return reject(err);
106
- }
107
- resolve({
108
- code: result2.code,
109
- map: result2.map
110
- });
111
- }
112
- );
113
- });
114
- }
115
- },
116
- // let esbuild remove all unused imports
117
- esbuild({
118
- target: "node20",
119
- platform: "node",
120
- minify: false
121
- }),
122
- {
123
- name: "cleanup-nodes",
124
- transform(code, id) {
125
- if (id !== entryFile) {
126
- return;
127
- }
128
- return recursiveRemoveNonReferencedNodes(code);
129
- }
130
- },
131
- // let esbuild remove all unused imports
132
- esbuild({
133
- target: "node20",
134
- platform: "node",
135
- minify: false
136
- }),
137
- json()
138
- ]
139
- });
24
+
25
+ // src/build/babel/remove-all-options-deployer.ts
26
+ function removeAllOptionsExceptDeployer(result, logger) {
27
+ return removeAllOptionsFromMastraExcept(result, "deployer", logger);
140
28
  }
141
- async function getDeployer(entryFile, outputDir) {
142
- const result = { isDeployerRemoved: false };
143
- const bundle = await getDeployerBundler(entryFile, result);
144
- await bundle.write({
145
- dir: outputDir,
146
- format: "es",
147
- entryFileNames: "[name].mjs"
148
- });
149
- if (!result.isDeployerRemoved) {
150
- return;
29
+
30
+ // src/build/deployer.ts
31
+ async function getDeployer(entryFile, outputDir, logger) {
32
+ const result = await extractMastraOption(
33
+ "deployer",
34
+ entryFile,
35
+ removeAllOptionsExceptDeployer,
36
+ outputDir,
37
+ logger
38
+ );
39
+ if (!result) {
40
+ return null;
151
41
  }
152
- return (await import(`file:${outputDir}/deployer.mjs`)).deployer;
42
+ return result.getConfig();
153
43
  }
154
44
 
155
45
  export { Deployer, getDeployer };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/deploy/base.ts","../src/build/babel/get-deployer.ts","../src/build/deployer.ts"],"names":["babel","path","babel2","result"],"mappings":";;;;;;;;;;;;AAMO,IAAe,QAAA,GAAf,cAAgC,OAAA,CAA6B;AAAA,EAClE,IAAA,GAAoB,IAAI,WAAA,EAAY;AAAA,EAEpC,YAAY,IAAA,EAAwB;AAClC,IAAA,KAAA,CAAM,IAAA,CAAK,MAAM,UAAU,CAAA;AAE3B,IAAA,IAAA,CAAK,IAAA,CAAK,WAAA,CAAY,IAAA,CAAK,MAAM,CAAA;AAAA,EACnC;AAAA,EAEA,WAAA,GAAiC;AAC/B,IAAA,MAAM,aAAA,GAAgB,CAAC,iBAAA,EAAmB,YAAA,EAAc,MAAM,CAAA;AAE9D,IAAA,IAAI;AACF,MAAA,MAAM,WAAA,GAAc,IAAI,WAAA,EAAY;AACpC,MAAA,MAAM,OAAA,GAAU,WAAA,CAAY,oBAAA,CAAqB,aAAa,CAAA;AAE9D,MAAA,OAAO,OAAA,CAAQ,OAAA,CAAQ,CAAC,OAAO,CAAC,CAAA;AAAA,IAClC,CAAA,CAAA,MAAQ;AAAA,IAAC;AAET,IAAA,OAAO,OAAA,CAAQ,OAAA,CAAQ,EAAE,CAAA;AAAA,EAC3B;AAGF;AC3BO,SAAS,uBAAA,GAA0B;AACxC,EAAA,MAAM,IAAIA,cAAA,CAAM,KAAA;AAEhB,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,4BAAA;AAAA,IACN,OAAA,EAAS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AA,iBACd,CAAA;AAAA,cACH;AAAA,aACF;AAAA,UACF,CAAC,CAAA;AAAA,QACH;AAAA,OACF;AAAA;AAAA,MAEA,OAAA,CAAQ;AAAA,QACN,MAAA,EAAQ,QAAA;AAAA,QACR,QAAA,EAAU,MAAA;AAAA,QACV,MAAA,EAAQ;AAAA,OACT,CAAA;AAAA,MACD;AAAA,QACE,IAAA,EAAM,eAAA;AAAA,QACN,SAAA,CAAU,MAAM,EAAA,EAAI;AAClB,UAAA,IAAI,OAAO,SAAA,EAAW;AACpB,YAAA;AAAA,UACF;AAEA,UAAA,OAAO,kCAAkC,IAAI,CAAA;AAAA,QAC/C;AAAA,OACF;AAAA;AAAA,MAEA,OAAA,CAAQ;AAAA,QACN,MAAA,EAAQ,QAAA;AAAA,QACR,QAAA,EAAU,MAAA;AAAA,QACV,MAAA,EAAQ;AAAA,OACT,CAAA;AAAA,MACD,IAAA;AAAK;AACP,GACD,CAAA;AACH;AAEA,eAAsB,WAAA,CAAY,WAAmB,SAAA,EAAmB;AACtE,EAAA,MAAM,MAAA,GAAyC,EAAE,iBAAA,EAAmB,KAAA,EAAM;AAC1E,EAAA,MAAM,MAAA,GAAS,MAAM,kBAAA,CAAmB,SAAA,EAAW,MAAM,CAAA;AAEzD,EAAA,MAAM,OAAO,KAAA,CAAM;AAAA,IACjB,GAAA,EAAK,SAAA;AAAA,IACL,MAAA,EAAQ,IAAA;AAAA,IACR,cAAA,EAAgB;AAAA,GACjB,CAAA;AAED,EAAA,IAAI,CAAC,OAAO,iBAAA,EAAmB;AAC7B,IAAA;AAAA,EACF;AAEA,EAAA,OAAA,CAAQ,MAAM,OAAO,CAAA,KAAA,EAAQ,SAAS,CAAA,aAAA,CAAA,CAAA,EAAkB,QAAA;AAC1D","file":"index.js","sourcesContent":["import type { IDeployer } from '@mastra/core/deployer';\n\nimport { Bundler } from '../bundler';\nimport { DepsService } from '../services/deps.js';\nimport { FileService } from '../services/fs.js';\n\nexport abstract class Deployer extends Bundler implements IDeployer {\n deps: DepsService = new DepsService();\n\n constructor(args: { name: string }) {\n super(args.name, 'DEPLOYER');\n\n this.deps.__setLogger(this.logger);\n }\n\n getEnvFiles(): Promise<string[]> {\n const possibleFiles = ['.env.production', '.env.local', '.env'];\n\n try {\n const fileService = new FileService();\n const envFile = fileService.getFirstExistingFile(possibleFiles);\n\n return Promise.resolve([envFile]);\n } catch {}\n\n return Promise.resolve([]);\n }\n\n abstract deploy(outputDirectory: string): Promise<void>;\n}\n","import babel from '@babel/core';\n\nexport function removeAllExceptDeployer() {\n const t = babel.types;\n\n return {\n name: 'remove-all-except-deployer',\n visitor: {\n ExportNamedDeclaration: {\n // remove all exports\n exit(path) {\n path.remove();\n },\n },\n\n NewExpression(path) {\n // is a variable declaration\n const varDeclaratorPath = path.findParent(path => t.isVariableDeclarator(path.node));\n if (!varDeclaratorPath) {\n return;\n }\n\n const parentNode = path.parentPath.node;\n // check if it's a const of mastra\n if (!t.isVariableDeclarator(parentNode) || !t.isIdentifier(parentNode.id) || parentNode.id.name !== 'mastra') {\n return;\n }\n\n // @ts-ignore\n const deployer = path.node.arguments[0]?.properties?.find(\n // @ts-ignore\n prop => prop.key.name === 'deployer',\n );\n\n const programPath = path.scope.getProgramParent().path;\n if (!deployer || !programPath) {\n return;\n }\n\n // add the deployer export\n const exportDeclaration = t.exportNamedDeclaration(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier('deployer'), deployer.value)]),\n [],\n );\n\n // @ts-ignore\n programPath.node.body.push(exportDeclaration);\n },\n },\n } as babel.PluginObj;\n}\n","import * as babel from '@babel/core';\nimport type { MastraDeployer } from '@mastra/core';\nimport { rollup } from 'rollup';\nimport esbuild from 'rollup-plugin-esbuild';\n\nimport { removeAllExceptDeployer } from './babel/get-deployer';\nimport commonjs from '@rollup/plugin-commonjs';\nimport json from '@rollup/plugin-json';\nimport { recursiveRemoveNonReferencedNodes } from './plugins/remove-unused-references';\n\nexport function getDeployerBundler(entryFile: string, result: { isDeployerRemoved: boolean }) {\n return rollup({\n logLevel: 'silent',\n input: {\n deployer: entryFile,\n },\n treeshake: 'smallest',\n plugins: [\n // transpile typescript to something we understand\n esbuild({\n target: 'node20',\n platform: 'node',\n minify: false,\n }),\n commonjs({\n extensions: ['.js', '.ts'],\n strictRequires: 'strict',\n transformMixedEsModules: true,\n ignoreTryCatch: false,\n }),\n {\n name: 'get-deployer',\n transform(code, id) {\n if (id !== entryFile) {\n return;\n }\n\n result.isDeployerRemoved = true;\n return new Promise((resolve, reject) => {\n babel.transform(\n code,\n {\n babelrc: false,\n configFile: false,\n filename: id,\n plugins: [removeAllExceptDeployer],\n },\n (err, result) => {\n if (err) {\n return reject(err);\n }\n\n resolve({\n code: result!.code!,\n map: result!.map!,\n });\n },\n );\n });\n },\n },\n // let esbuild remove all unused imports\n esbuild({\n target: 'node20',\n platform: 'node',\n minify: false,\n }),\n {\n name: 'cleanup-nodes',\n transform(code, id) {\n if (id !== entryFile) {\n return;\n }\n\n return recursiveRemoveNonReferencedNodes(code);\n },\n },\n // let esbuild remove all unused imports\n esbuild({\n target: 'node20',\n platform: 'node',\n minify: false,\n }),\n json(),\n ],\n });\n}\n\nexport async function getDeployer(entryFile: string, outputDir: string) {\n const result: { isDeployerRemoved: boolean } = { isDeployerRemoved: false };\n const bundle = await getDeployerBundler(entryFile, result);\n\n await bundle.write({\n dir: outputDir,\n format: 'es',\n entryFileNames: '[name].mjs',\n });\n\n if (!result.isDeployerRemoved) {\n return;\n }\n\n return (await import(`file:${outputDir}/deployer.mjs`)).deployer as unknown as MastraDeployer;\n}\n"]}
1
+ {"version":3,"sources":["../src/deploy/base.ts","../src/build/babel/remove-all-options-deployer.ts","../src/build/deployer.ts"],"names":[],"mappings":";;;;;;AAMO,IAAe,QAAA,GAAf,cAAgC,OAAA,CAA6B;AAAA,EAClE,IAAA,GAAoB,IAAI,WAAA,EAAY;AAAA,EAEpC,YAAY,IAAA,EAAwB;AAClC,IAAA,KAAA,CAAM,IAAA,CAAK,MAAM,UAAU,CAAA;AAE3B,IAAA,IAAA,CAAK,IAAA,CAAK,WAAA,CAAY,IAAA,CAAK,MAAM,CAAA;AAAA,EACnC;AAAA,EAEA,WAAA,GAAiC;AAC/B,IAAA,MAAM,aAAA,GAAgB,CAAC,iBAAA,EAAmB,YAAA,EAAc,MAAM,CAAA;AAE9D,IAAA,IAAI;AACF,MAAA,MAAM,WAAA,GAAc,IAAI,WAAA,EAAY;AACpC,MAAA,MAAM,OAAA,GAAU,WAAA,CAAY,oBAAA,CAAqB,aAAa,CAAA;AAE9D,MAAA,OAAO,OAAA,CAAQ,OAAA,CAAQ,CAAC,OAAO,CAAC,CAAA;AAAA,IAClC,CAAA,CAAA,MAAQ;AAAA,IAAC;AAET,IAAA,OAAO,OAAA,CAAQ,OAAA,CAAQ,EAAE,CAAA;AAAA,EAC3B;AAGF;;;AC1BO,SAAS,8BAAA,CAA+B,QAAsC,MAAA,EAAwB;AAC3G,EAAA,OAAO,gCAAA,CAAiC,MAAA,EAAQ,UAAA,EAAY,MAAM,CAAA;AACpE;;;ACSA,eAAsB,WAAA,CACpB,SAAA,EACA,SAAA,EACA,MAAA,EACoC;AACpC,EAAA,MAAM,SAAS,MAAM,mBAAA;AAAA,IACnB,UAAA;AAAA,IACA,SAAA;AAAA,IACA,8BAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,OAAO,SAAA,EAAU;AAC1B","file":"index.js","sourcesContent":["import type { IDeployer } from '@mastra/core/deployer';\n\nimport { Bundler } from '../bundler';\nimport { DepsService } from '../services/deps.js';\nimport { FileService } from '../services/fs.js';\n\nexport abstract class Deployer extends Bundler implements IDeployer {\n deps: DepsService = new DepsService();\n\n constructor(args: { name: string }) {\n super(args.name, 'DEPLOYER');\n\n this.deps.__setLogger(this.logger);\n }\n\n getEnvFiles(): Promise<string[]> {\n const possibleFiles = ['.env.production', '.env.local', '.env'];\n\n try {\n const fileService = new FileService();\n const envFile = fileService.getFirstExistingFile(possibleFiles);\n\n return Promise.resolve([envFile]);\n } catch {}\n\n return Promise.resolve([]);\n }\n\n abstract deploy(outputDirectory: string): Promise<void>;\n}\n","import { removeAllOptionsFromMastraExcept } from './remove-all-options-except';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function removeAllOptionsExceptDeployer(result: { hasCustomConfig: boolean }, logger?: IMastraLogger) {\n return removeAllOptionsFromMastraExcept(result, 'deployer', logger);\n}\n","import { removeAllOptionsExceptDeployer } from './babel/remove-all-options-deployer';\nimport type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function getDeployerBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('deployer', entryFile, removeAllOptionsExceptDeployer, result);\n}\n\nexport async function getDeployer(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['deployer'] | null> {\n const result = await extractMastraOption<Config['deployer']>(\n 'deployer',\n entryFile,\n removeAllOptionsExceptDeployer,\n outputDir,\n logger,\n );\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"]}
@@ -1,12 +1,14 @@
1
1
  import type { Context } from 'hono';
2
+ export declare const vNextBodyOptions: any;
2
3
  export declare function getAgentsHandler(c: Context): Promise<Response & import("hono").TypedResponse<{
3
4
  [x: string]: {
5
+ workflows: {};
4
6
  name: any;
5
7
  tools: any;
6
- workflows: {};
7
8
  provider: string;
8
9
  instructions: string;
9
10
  modelId: string;
11
+ modelVersion: "v2" | "v1";
10
12
  defaultGenerateOptions: any;
11
13
  defaultStreamOptions: any;
12
14
  };
@@ -18,6 +20,7 @@ export declare function getAgentByIdHandler(c: Context): Promise<Response & impo
18
20
  workflows: {};
19
21
  provider: string;
20
22
  modelId: string;
23
+ modelVersion: "v2" | "v1";
21
24
  defaultGenerateOptions: any;
22
25
  defaultStreamOptions: any;
23
26
  }, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
@@ -72,10 +75,18 @@ export declare function getLiveEvalsByAgentIdHandler(c: Context): Promise<Respon
72
75
  }[];
73
76
  }, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
74
77
  export declare function generateHandler(c: Context): Promise<Response>;
78
+ export declare function generateVNextHandler(c: Context): Promise<Response>;
75
79
  export declare function streamGenerateHandler(c: Context): Promise<Response | undefined>;
76
80
  export declare function streamVNextGenerateHandler(c: Context): Promise<Response | undefined>;
81
+ export declare function streamVNextUIMessageHandler(c: Context): Promise<Response | undefined>;
77
82
  export declare function setAgentInstructionsHandler(c: Context): Promise<Response>;
78
83
  export declare function updateAgentModelHandler(c: Context): Promise<Response>;
84
+ export declare function deprecatedStreamVNextHandler(c: Context): Promise<Response & import("hono").TypedResponse<{
85
+ error: string;
86
+ message: string;
87
+ deprecated_endpoint: string;
88
+ replacement_endpoint: string;
89
+ }, 410, "json">>;
79
90
  export declare function getModelProvidersHandler(c: Context): Promise<(Response & import("hono").TypedResponse<{
80
91
  error: string;
81
92
  }, 403, "json">) | (Response & import("hono").TypedResponse<string[], import("hono/utils/http-status").ContentfulStatusCode, "json">)>;
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../../../src/server/handlers/routes/agents/handlers.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAOpC,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,OAAO;;;;;;;;;;;mEAOhD;AAED,wBAAsB,mBAAmB,CAAC,CAAC,EAAE,OAAO;;;;;;;;;mEAcnD;AAED,wBAAsB,wBAAwB,CAAC,CAAC,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;mEAYxD;AAED,wBAAsB,4BAA4B,CAAC,CAAC,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;mEAY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,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAmB3F;AAED,wBAAsB,2BAA2B,CAAC,CAAC,EAAE,OAAO,qBAgC3D;AAED,wBAAsB,uBAAuB,CAAC,CAAC,EAAE,OAAO,qBAgBvD;AAED,wBAAsB,4BAA4B,CAAC,CAAC,EAAE,OAAO;;;;;iBAU5D;AAED,wBAAsB,wBAAwB,CAAC,CAAC,EAAE,OAAO;;uIAWxD"}
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/server/handlers/routes/agents/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAgBvD,wBAAgB,YAAY,CAAC,gBAAgB,EAAE,gBAAgB,8EAowB9D;AAED,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,gBAAgB,8EAyHjE"}
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/server/handlers/routes/agents/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAoBvD,wBAAgB,YAAY,CAAC,gBAAgB,EAAE,gBAAgB,8EAi4B9D;AAED,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,gBAAgB,8EAyHjE"}
@@ -16,6 +16,31 @@ export declare function getScorerHandler(c: Context): Promise<Response & import(
16
16
  supportsUrl?: {} | undefined;
17
17
  doGenerate: {};
18
18
  doStream: {};
19
+ } | {
20
+ readonly specificationVersion: "v2";
21
+ readonly provider: string;
22
+ readonly modelId: string;
23
+ supportedUrls: {
24
+ [x: string]: {
25
+ exec: {};
26
+ test: {};
27
+ readonly source: string;
28
+ readonly global: boolean;
29
+ readonly ignoreCase: boolean;
30
+ readonly multiline: boolean;
31
+ lastIndex: number;
32
+ compile: {};
33
+ readonly flags: string;
34
+ readonly sticky: boolean;
35
+ readonly unicode: boolean;
36
+ readonly dotAll: boolean;
37
+ readonly hasIndices: boolean;
38
+ }[];
39
+ } | {
40
+ then: {};
41
+ };
42
+ doGenerate: {};
43
+ doStream: {};
19
44
  };
20
45
  instructions: string;
21
46
  } | undefined;
@@ -33,6 +58,31 @@ export declare function getScorerHandler(c: Context): Promise<Response & import(
33
58
  supportsUrl?: {} | undefined;
34
59
  doGenerate: {};
35
60
  doStream: {};
61
+ } | {
62
+ readonly specificationVersion: "v2";
63
+ readonly provider: string;
64
+ readonly modelId: string;
65
+ supportedUrls: {
66
+ [x: string]: {
67
+ exec: {};
68
+ test: {};
69
+ readonly source: string;
70
+ readonly global: boolean;
71
+ readonly ignoreCase: boolean;
72
+ readonly multiline: boolean;
73
+ lastIndex: number;
74
+ compile: {};
75
+ readonly flags: string;
76
+ readonly sticky: boolean;
77
+ readonly unicode: boolean;
78
+ readonly dotAll: boolean;
79
+ readonly hasIndices: boolean;
80
+ }[];
81
+ } | {
82
+ then: {};
83
+ };
84
+ doGenerate: {};
85
+ doStream: {};
36
86
  };
37
87
  instructions: string;
38
88
  } | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../../../src/server/handlers/routes/scores/handlers.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,OAAO,qBAUjD;AAED,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0EAYhD;AAED,wBAAsB,uBAAuB,CAAC,CAAC,EAAE,OAAO,qBAkBvD;AAED,wBAAsB,0BAA0B,CAAC,CAAC,EAAE,OAAO,qBAsB1D;AAED,wBAAsB,0BAA0B,CAAC,CAAC,EAAE,OAAO,qBAqB1D;AAED,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,OAAO,qBAchD"}
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../../../src/server/handlers/routes/scores/handlers.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,OAAO,qBAUjD;AAED,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0EAYhD;AAED,wBAAsB,uBAAuB,CAAC,CAAC,EAAE,OAAO,qBAkBvD;AAED,wBAAsB,0BAA0B,CAAC,CAAC,EAAE,OAAO,qBAsB1D;AAED,wBAAsB,0BAA0B,CAAC,CAAC,EAAE,OAAO,qBAqB1D;AAED,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,OAAO,qBAchD"}