@mastra/deployer 0.10.4-alpha.0 → 0.10.4-alpha.1
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.
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-YLTLG56Z.js → chunk-77XOUHT3.js} +10 -2
- package/dist/{chunk-3W43JESU.cjs → chunk-ZEUV45KC.cjs} +11 -3
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/server/index.cjs +27 -30
- package/dist/server/index.js +27 -30
- package/dist/templates/instrumentation-template.js +52 -8
- package/package.json +14 -14
package/dist/bundler/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkZEUV45KC_cjs = require('../chunk-ZEUV45KC.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "Bundler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkZEUV45KC_cjs.Bundler; }
|
|
10
10
|
});
|
package/dist/bundler/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Bundler } from '../chunk-
|
|
1
|
+
export { Bundler } from '../chunk-77XOUHT3.js';
|
|
@@ -138,7 +138,15 @@ var Bundler = class extends MastraBundler {
|
|
|
138
138
|
dependenciesMap.set(pkgName, value);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
dependenciesMap.set("@opentelemetry/
|
|
141
|
+
dependenciesMap.set("@opentelemetry/core", "^2.0.1");
|
|
142
|
+
dependenciesMap.set("@opentelemetry/auto-instrumentations-node", "^0.59.0");
|
|
143
|
+
dependenciesMap.set("@opentelemetry/exporter-trace-otlp-grpc", "^0.201.0");
|
|
144
|
+
dependenciesMap.set("@opentelemetry/exporter-trace-otlp-http", "^0.201.0");
|
|
145
|
+
dependenciesMap.set("@opentelemetry/resources", "^2.0.1");
|
|
146
|
+
dependenciesMap.set("@opentelemetry/sdk-node", "^0.201.0");
|
|
147
|
+
dependenciesMap.set("@opentelemetry/sdk-trace-base", "^2.0.1");
|
|
148
|
+
dependenciesMap.set("@opentelemetry/semantic-conventions", "^1.33.0");
|
|
149
|
+
dependenciesMap.set("@opentelemetry/instrumentation", "^0.202.0");
|
|
142
150
|
await writeFile(
|
|
143
151
|
pkgPath,
|
|
144
152
|
JSON.stringify(
|
|
@@ -149,7 +157,7 @@ var Bundler = class extends MastraBundler {
|
|
|
149
157
|
type: "module",
|
|
150
158
|
main: "index.mjs",
|
|
151
159
|
scripts: {
|
|
152
|
-
start: "node ./index.mjs"
|
|
160
|
+
start: "node --import=./instrumentation.mjs --import=@opentelemetry/instrumentation/hook.mjs ./index.mjs"
|
|
153
161
|
},
|
|
154
162
|
author: "Mastra",
|
|
155
163
|
license: "ISC",
|
|
@@ -131,7 +131,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
131
131
|
}
|
|
132
132
|
async writeInstrumentationFile(outputDirectory) {
|
|
133
133
|
const instrumentationFile = path.join(outputDirectory, "instrumentation.mjs");
|
|
134
|
-
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-
|
|
134
|
+
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-ZEUV45KC.cjs', document.baseURI).href))));
|
|
135
135
|
await fsExtra.copy(path.join(__dirname, "templates", "instrumentation-template.js"), instrumentationFile);
|
|
136
136
|
}
|
|
137
137
|
async writePackageJson(outputDirectory, dependencies, resolutions) {
|
|
@@ -148,7 +148,15 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
148
148
|
dependenciesMap.set(pkgName, value);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
dependenciesMap.set("@opentelemetry/
|
|
151
|
+
dependenciesMap.set("@opentelemetry/core", "^2.0.1");
|
|
152
|
+
dependenciesMap.set("@opentelemetry/auto-instrumentations-node", "^0.59.0");
|
|
153
|
+
dependenciesMap.set("@opentelemetry/exporter-trace-otlp-grpc", "^0.201.0");
|
|
154
|
+
dependenciesMap.set("@opentelemetry/exporter-trace-otlp-http", "^0.201.0");
|
|
155
|
+
dependenciesMap.set("@opentelemetry/resources", "^2.0.1");
|
|
156
|
+
dependenciesMap.set("@opentelemetry/sdk-node", "^0.201.0");
|
|
157
|
+
dependenciesMap.set("@opentelemetry/sdk-trace-base", "^2.0.1");
|
|
158
|
+
dependenciesMap.set("@opentelemetry/semantic-conventions", "^1.33.0");
|
|
159
|
+
dependenciesMap.set("@opentelemetry/instrumentation", "^0.202.0");
|
|
152
160
|
await promises.writeFile(
|
|
153
161
|
pkgPath,
|
|
154
162
|
JSON.stringify(
|
|
@@ -159,7 +167,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
159
167
|
type: "module",
|
|
160
168
|
main: "index.mjs",
|
|
161
169
|
scripts: {
|
|
162
|
-
start: "node ./index.mjs"
|
|
170
|
+
start: "node --import=./instrumentation.mjs --import=@opentelemetry/instrumentation/hook.mjs ./index.mjs"
|
|
163
171
|
},
|
|
164
172
|
author: "Mastra",
|
|
165
173
|
license: "ISC",
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkZEUV45KC_cjs = require('./chunk-ZEUV45KC.cjs');
|
|
4
4
|
var chunkTSG63RGL_cjs = require('./chunk-TSG63RGL.cjs');
|
|
5
5
|
var chunk4VC5Z4YR_cjs = require('./chunk-4VC5Z4YR.cjs');
|
|
6
6
|
var babel = require('@babel/core');
|
|
@@ -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
|
|
36
|
+
var Deployer = class extends chunkZEUV45KC_cjs.Bundler {
|
|
37
37
|
deps = new chunk4VC5Z4YR_cjs.DepsService();
|
|
38
38
|
constructor(args) {
|
|
39
39
|
super(args.name, "DEPLOYER");
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bundler } from './chunk-
|
|
1
|
+
import { Bundler } from './chunk-77XOUHT3.js';
|
|
2
2
|
import { recursiveRemoveNonReferencedNodes } from './chunk-WGJTOVLL.js';
|
|
3
3
|
import { DepsService, FileService } from './chunk-UV4RQQ3R.js';
|
|
4
4
|
export { Deps, FileService, createChildProcessLogger, createPinoStream } from './chunk-UV4RQQ3R.js';
|
package/dist/server/index.cjs
CHANGED
|
@@ -729,7 +729,7 @@ var middleware = (options) => async (c2) => {
|
|
|
729
729
|
);
|
|
730
730
|
};
|
|
731
731
|
|
|
732
|
-
// ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.7.11_openapi-types@12.1.3_zod@3.25.
|
|
732
|
+
// ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.7.11_openapi-types@12.1.3_zod@3.25.56/node_modules/hono-openapi/utils.js
|
|
733
733
|
var e = Symbol("openapi");
|
|
734
734
|
var n = ["GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE"];
|
|
735
735
|
var s2 = (e2) => e2.charAt(0).toUpperCase() + e2.slice(1);
|
|
@@ -951,10 +951,12 @@ async function getAgentByIdHandler(c2) {
|
|
|
951
951
|
const mastra = c2.get("mastra");
|
|
952
952
|
const agentId = c2.req.param("agentId");
|
|
953
953
|
const runtimeContext = c2.get("runtimeContext");
|
|
954
|
+
const isPlayground = c2.req.header("x-mastra-dev-playground") === "true";
|
|
954
955
|
const result = await agents.getAgentByIdHandler({
|
|
955
956
|
mastra,
|
|
956
957
|
agentId,
|
|
957
|
-
runtimeContext
|
|
958
|
+
runtimeContext,
|
|
959
|
+
isPlayground
|
|
958
960
|
});
|
|
959
961
|
return c2.json(result);
|
|
960
962
|
}
|
|
@@ -3922,14 +3924,13 @@ function executeToolHandler(tools$1) {
|
|
|
3922
3924
|
const runtimeContext = c2.get("runtimeContext");
|
|
3923
3925
|
const toolId = decodeURIComponent(c2.req.param("toolId"));
|
|
3924
3926
|
const runId = c2.req.query("runId");
|
|
3925
|
-
const { data
|
|
3927
|
+
const { data } = await c2.req.json();
|
|
3926
3928
|
const result = await tools.executeToolHandler(tools$1)({
|
|
3927
3929
|
mastra,
|
|
3928
3930
|
toolId,
|
|
3929
3931
|
data,
|
|
3930
3932
|
runtimeContext,
|
|
3931
|
-
runId
|
|
3932
|
-
runtimeContextFromRequest
|
|
3933
|
+
runId
|
|
3933
3934
|
});
|
|
3934
3935
|
return c2.json(result);
|
|
3935
3936
|
} catch (error) {
|
|
@@ -3943,14 +3944,13 @@ async function executeAgentToolHandler(c2) {
|
|
|
3943
3944
|
const runtimeContext = c2.get("runtimeContext");
|
|
3944
3945
|
const agentId = c2.req.param("agentId");
|
|
3945
3946
|
const toolId = c2.req.param("toolId");
|
|
3946
|
-
const { data
|
|
3947
|
+
const { data } = await c2.req.json();
|
|
3947
3948
|
const result = await tools.executeAgentToolHandler({
|
|
3948
3949
|
mastra,
|
|
3949
3950
|
agentId,
|
|
3950
3951
|
toolId,
|
|
3951
3952
|
data,
|
|
3952
|
-
runtimeContext
|
|
3953
|
-
runtimeContextFromRequest
|
|
3953
|
+
runtimeContext
|
|
3954
3954
|
});
|
|
3955
3955
|
return c2.json(result);
|
|
3956
3956
|
} catch (error) {
|
|
@@ -4171,12 +4171,11 @@ async function startAsyncWorkflowHandler(c2) {
|
|
|
4171
4171
|
const mastra = c2.get("mastra");
|
|
4172
4172
|
const workflowId = c2.req.param("workflowId");
|
|
4173
4173
|
const runtimeContext = c2.get("runtimeContext");
|
|
4174
|
-
const { inputData
|
|
4174
|
+
const { inputData } = await c2.req.json();
|
|
4175
4175
|
const runId = c2.req.query("runId");
|
|
4176
4176
|
const result = await workflows.startAsyncWorkflowHandler({
|
|
4177
4177
|
mastra,
|
|
4178
4178
|
runtimeContext,
|
|
4179
|
-
runtimeContextFromRequest,
|
|
4180
4179
|
workflowId,
|
|
4181
4180
|
runId,
|
|
4182
4181
|
inputData
|
|
@@ -4191,12 +4190,11 @@ async function startWorkflowRunHandler(c2) {
|
|
|
4191
4190
|
const mastra = c2.get("mastra");
|
|
4192
4191
|
const workflowId = c2.req.param("workflowId");
|
|
4193
4192
|
const runtimeContext = c2.get("runtimeContext");
|
|
4194
|
-
const { inputData
|
|
4193
|
+
const { inputData } = await c2.req.json();
|
|
4195
4194
|
const runId = c2.req.query("runId");
|
|
4196
4195
|
await workflows.startWorkflowRunHandler({
|
|
4197
4196
|
mastra,
|
|
4198
4197
|
runtimeContext,
|
|
4199
|
-
runtimeContextFromRequest,
|
|
4200
4198
|
workflowId,
|
|
4201
4199
|
runId,
|
|
4202
4200
|
inputData
|
|
@@ -4250,7 +4248,7 @@ async function streamWorkflowHandler(c2) {
|
|
|
4250
4248
|
const logger2 = mastra.getLogger();
|
|
4251
4249
|
const workflowId = c2.req.param("workflowId");
|
|
4252
4250
|
const runtimeContext = c2.get("runtimeContext");
|
|
4253
|
-
const { inputData
|
|
4251
|
+
const { inputData } = await c2.req.json();
|
|
4254
4252
|
const runId = c2.req.query("runId");
|
|
4255
4253
|
return streaming.stream(
|
|
4256
4254
|
c2,
|
|
@@ -4261,8 +4259,7 @@ async function streamWorkflowHandler(c2) {
|
|
|
4261
4259
|
workflowId,
|
|
4262
4260
|
runId,
|
|
4263
4261
|
inputData,
|
|
4264
|
-
runtimeContext
|
|
4265
|
-
runtimeContextFromRequest
|
|
4262
|
+
runtimeContext
|
|
4266
4263
|
});
|
|
4267
4264
|
const reader = result.stream.getReader();
|
|
4268
4265
|
stream4.onAbort(() => {
|
|
@@ -4290,14 +4287,13 @@ async function resumeAsyncWorkflowHandler(c2) {
|
|
|
4290
4287
|
const workflowId = c2.req.param("workflowId");
|
|
4291
4288
|
const runId = c2.req.query("runId");
|
|
4292
4289
|
const runtimeContext = c2.get("runtimeContext");
|
|
4293
|
-
const { step, resumeData
|
|
4290
|
+
const { step, resumeData } = await c2.req.json();
|
|
4294
4291
|
if (!runId) {
|
|
4295
4292
|
throw new httpException.HTTPException(400, { message: "runId required to resume workflow" });
|
|
4296
4293
|
}
|
|
4297
4294
|
const result = await workflows.resumeAsyncWorkflowHandler({
|
|
4298
4295
|
mastra,
|
|
4299
4296
|
runtimeContext,
|
|
4300
|
-
runtimeContextFromRequest,
|
|
4301
4297
|
workflowId,
|
|
4302
4298
|
runId,
|
|
4303
4299
|
body: { step, resumeData }
|
|
@@ -4504,20 +4500,21 @@ ${err.stack.split("\n").slice(1).join("\n")}
|
|
|
4504
4500
|
}
|
|
4505
4501
|
});
|
|
4506
4502
|
app.onError(errorHandler);
|
|
4507
|
-
app.use("*", function setContext(c2, next) {
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4503
|
+
app.use("*", async function setContext(c2, next) {
|
|
4504
|
+
let runtimeContext$1 = new runtimeContext.RuntimeContext();
|
|
4505
|
+
if (c2.req.method === "POST" || c2.req.method === "PUT") {
|
|
4506
|
+
const contentType = c2.req.header("content-type");
|
|
4507
|
+
if (contentType?.includes("application/json")) {
|
|
4508
|
+
try {
|
|
4509
|
+
const body = await c2.req.json();
|
|
4510
|
+
if (body.runtimeContext) {
|
|
4511
|
+
runtimeContext$1 = new runtimeContext.RuntimeContext(Object.entries(body.runtimeContext));
|
|
4512
|
+
}
|
|
4513
|
+
} catch {
|
|
4514
|
+
}
|
|
4518
4515
|
}
|
|
4519
|
-
}
|
|
4520
|
-
c2.set("runtimeContext",
|
|
4516
|
+
}
|
|
4517
|
+
c2.set("runtimeContext", runtimeContext$1);
|
|
4521
4518
|
c2.set("mastra", mastra);
|
|
4522
4519
|
c2.set("tools", tools);
|
|
4523
4520
|
c2.set("playground", options.playground === true);
|
package/dist/server/index.js
CHANGED
|
@@ -722,7 +722,7 @@ var middleware = (options) => async (c2) => {
|
|
|
722
722
|
);
|
|
723
723
|
};
|
|
724
724
|
|
|
725
|
-
// ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.7.11_openapi-types@12.1.3_zod@3.25.
|
|
725
|
+
// ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.7.11_openapi-types@12.1.3_zod@3.25.56/node_modules/hono-openapi/utils.js
|
|
726
726
|
var e = Symbol("openapi");
|
|
727
727
|
var n = ["GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE"];
|
|
728
728
|
var s2 = (e2) => e2.charAt(0).toUpperCase() + e2.slice(1);
|
|
@@ -944,10 +944,12 @@ async function getAgentByIdHandler(c2) {
|
|
|
944
944
|
const mastra = c2.get("mastra");
|
|
945
945
|
const agentId = c2.req.param("agentId");
|
|
946
946
|
const runtimeContext = c2.get("runtimeContext");
|
|
947
|
+
const isPlayground = c2.req.header("x-mastra-dev-playground") === "true";
|
|
947
948
|
const result = await getAgentByIdHandler$1({
|
|
948
949
|
mastra,
|
|
949
950
|
agentId,
|
|
950
|
-
runtimeContext
|
|
951
|
+
runtimeContext,
|
|
952
|
+
isPlayground
|
|
951
953
|
});
|
|
952
954
|
return c2.json(result);
|
|
953
955
|
}
|
|
@@ -3915,14 +3917,13 @@ function executeToolHandler(tools) {
|
|
|
3915
3917
|
const runtimeContext = c2.get("runtimeContext");
|
|
3916
3918
|
const toolId = decodeURIComponent(c2.req.param("toolId"));
|
|
3917
3919
|
const runId = c2.req.query("runId");
|
|
3918
|
-
const { data
|
|
3920
|
+
const { data } = await c2.req.json();
|
|
3919
3921
|
const result = await executeToolHandler$1(tools)({
|
|
3920
3922
|
mastra,
|
|
3921
3923
|
toolId,
|
|
3922
3924
|
data,
|
|
3923
3925
|
runtimeContext,
|
|
3924
|
-
runId
|
|
3925
|
-
runtimeContextFromRequest
|
|
3926
|
+
runId
|
|
3926
3927
|
});
|
|
3927
3928
|
return c2.json(result);
|
|
3928
3929
|
} catch (error) {
|
|
@@ -3936,14 +3937,13 @@ async function executeAgentToolHandler(c2) {
|
|
|
3936
3937
|
const runtimeContext = c2.get("runtimeContext");
|
|
3937
3938
|
const agentId = c2.req.param("agentId");
|
|
3938
3939
|
const toolId = c2.req.param("toolId");
|
|
3939
|
-
const { data
|
|
3940
|
+
const { data } = await c2.req.json();
|
|
3940
3941
|
const result = await executeAgentToolHandler$1({
|
|
3941
3942
|
mastra,
|
|
3942
3943
|
agentId,
|
|
3943
3944
|
toolId,
|
|
3944
3945
|
data,
|
|
3945
|
-
runtimeContext
|
|
3946
|
-
runtimeContextFromRequest
|
|
3946
|
+
runtimeContext
|
|
3947
3947
|
});
|
|
3948
3948
|
return c2.json(result);
|
|
3949
3949
|
} catch (error) {
|
|
@@ -4164,12 +4164,11 @@ async function startAsyncWorkflowHandler(c2) {
|
|
|
4164
4164
|
const mastra = c2.get("mastra");
|
|
4165
4165
|
const workflowId = c2.req.param("workflowId");
|
|
4166
4166
|
const runtimeContext = c2.get("runtimeContext");
|
|
4167
|
-
const { inputData
|
|
4167
|
+
const { inputData } = await c2.req.json();
|
|
4168
4168
|
const runId = c2.req.query("runId");
|
|
4169
4169
|
const result = await startAsyncWorkflowHandler$1({
|
|
4170
4170
|
mastra,
|
|
4171
4171
|
runtimeContext,
|
|
4172
|
-
runtimeContextFromRequest,
|
|
4173
4172
|
workflowId,
|
|
4174
4173
|
runId,
|
|
4175
4174
|
inputData
|
|
@@ -4184,12 +4183,11 @@ async function startWorkflowRunHandler(c2) {
|
|
|
4184
4183
|
const mastra = c2.get("mastra");
|
|
4185
4184
|
const workflowId = c2.req.param("workflowId");
|
|
4186
4185
|
const runtimeContext = c2.get("runtimeContext");
|
|
4187
|
-
const { inputData
|
|
4186
|
+
const { inputData } = await c2.req.json();
|
|
4188
4187
|
const runId = c2.req.query("runId");
|
|
4189
4188
|
await startWorkflowRunHandler$1({
|
|
4190
4189
|
mastra,
|
|
4191
4190
|
runtimeContext,
|
|
4192
|
-
runtimeContextFromRequest,
|
|
4193
4191
|
workflowId,
|
|
4194
4192
|
runId,
|
|
4195
4193
|
inputData
|
|
@@ -4243,7 +4241,7 @@ async function streamWorkflowHandler(c2) {
|
|
|
4243
4241
|
const logger2 = mastra.getLogger();
|
|
4244
4242
|
const workflowId = c2.req.param("workflowId");
|
|
4245
4243
|
const runtimeContext = c2.get("runtimeContext");
|
|
4246
|
-
const { inputData
|
|
4244
|
+
const { inputData } = await c2.req.json();
|
|
4247
4245
|
const runId = c2.req.query("runId");
|
|
4248
4246
|
return stream(
|
|
4249
4247
|
c2,
|
|
@@ -4254,8 +4252,7 @@ async function streamWorkflowHandler(c2) {
|
|
|
4254
4252
|
workflowId,
|
|
4255
4253
|
runId,
|
|
4256
4254
|
inputData,
|
|
4257
|
-
runtimeContext
|
|
4258
|
-
runtimeContextFromRequest
|
|
4255
|
+
runtimeContext
|
|
4259
4256
|
});
|
|
4260
4257
|
const reader = result.stream.getReader();
|
|
4261
4258
|
stream4.onAbort(() => {
|
|
@@ -4283,14 +4280,13 @@ async function resumeAsyncWorkflowHandler(c2) {
|
|
|
4283
4280
|
const workflowId = c2.req.param("workflowId");
|
|
4284
4281
|
const runId = c2.req.query("runId");
|
|
4285
4282
|
const runtimeContext = c2.get("runtimeContext");
|
|
4286
|
-
const { step, resumeData
|
|
4283
|
+
const { step, resumeData } = await c2.req.json();
|
|
4287
4284
|
if (!runId) {
|
|
4288
4285
|
throw new HTTPException(400, { message: "runId required to resume workflow" });
|
|
4289
4286
|
}
|
|
4290
4287
|
const result = await resumeAsyncWorkflowHandler$1({
|
|
4291
4288
|
mastra,
|
|
4292
4289
|
runtimeContext,
|
|
4293
|
-
runtimeContextFromRequest,
|
|
4294
4290
|
workflowId,
|
|
4295
4291
|
runId,
|
|
4296
4292
|
body: { step, resumeData }
|
|
@@ -4497,20 +4493,21 @@ ${err.stack.split("\n").slice(1).join("\n")}
|
|
|
4497
4493
|
}
|
|
4498
4494
|
});
|
|
4499
4495
|
app.onError(errorHandler);
|
|
4500
|
-
app.use("*", function setContext(c2, next) {
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4496
|
+
app.use("*", async function setContext(c2, next) {
|
|
4497
|
+
let runtimeContext = new RuntimeContext();
|
|
4498
|
+
if (c2.req.method === "POST" || c2.req.method === "PUT") {
|
|
4499
|
+
const contentType = c2.req.header("content-type");
|
|
4500
|
+
if (contentType?.includes("application/json")) {
|
|
4501
|
+
try {
|
|
4502
|
+
const body = await c2.req.json();
|
|
4503
|
+
if (body.runtimeContext) {
|
|
4504
|
+
runtimeContext = new RuntimeContext(Object.entries(body.runtimeContext));
|
|
4505
|
+
}
|
|
4506
|
+
} catch {
|
|
4507
|
+
}
|
|
4511
4508
|
}
|
|
4512
|
-
}
|
|
4513
|
-
c2.set("runtimeContext",
|
|
4509
|
+
}
|
|
4510
|
+
c2.set("runtimeContext", runtimeContext);
|
|
4514
4511
|
c2.set("mastra", mastra);
|
|
4515
4512
|
c2.set("tools", tools);
|
|
4516
4513
|
c2.set("playground", options.playground === true);
|
|
@@ -1,17 +1,61 @@
|
|
|
1
|
+
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
|
|
2
|
+
import { ExportResultCode } from '@opentelemetry/core';
|
|
3
|
+
import { OTLPTraceExporter as OTLPGrpcExporter } from '@opentelemetry/exporter-trace-otlp-grpc';
|
|
4
|
+
import { OTLPTraceExporter as OTLPHttpExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
5
|
+
import { resourceFromAttributes } from '@opentelemetry/resources';
|
|
6
|
+
import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
1
7
|
import {
|
|
2
|
-
NodeSDK,
|
|
3
|
-
getNodeAutoInstrumentations,
|
|
4
|
-
ATTR_SERVICE_NAME,
|
|
5
8
|
ParentBasedSampler,
|
|
6
9
|
TraceIdRatioBasedSampler,
|
|
7
10
|
AlwaysOnSampler,
|
|
8
11
|
AlwaysOffSampler,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
CompositeExporter,
|
|
12
|
-
resourceFromAttributes,
|
|
13
|
-
} from '@mastra/core/telemetry/otel-vendor';
|
|
12
|
+
} from '@opentelemetry/sdk-trace-base';
|
|
13
|
+
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
|
|
14
14
|
import { telemetry } from './telemetry-config.mjs';
|
|
15
|
+
class CompositeExporter {
|
|
16
|
+
constructor(exporters) {
|
|
17
|
+
this.exporters = exporters;
|
|
18
|
+
}
|
|
19
|
+
export(spans, resultCallback) {
|
|
20
|
+
const telemetryTraceIds = new Set(
|
|
21
|
+
spans.filter((span) => {
|
|
22
|
+
const attrs = span.attributes || {};
|
|
23
|
+
const httpTarget = attrs["http.target"];
|
|
24
|
+
return httpTarget === "/api/telemetry";
|
|
25
|
+
}).map((span) => span.spanContext().traceId)
|
|
26
|
+
);
|
|
27
|
+
const filteredSpans = spans.filter((span) => !telemetryTraceIds.has(span.spanContext().traceId));
|
|
28
|
+
if (filteredSpans.length === 0) {
|
|
29
|
+
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
void Promise.all(
|
|
33
|
+
this.exporters.map(
|
|
34
|
+
(exporter) => new Promise((resolve) => {
|
|
35
|
+
if (exporter.export) {
|
|
36
|
+
exporter.export(filteredSpans, resolve);
|
|
37
|
+
} else {
|
|
38
|
+
resolve({ code: ExportResultCode.FAILED });
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
)
|
|
42
|
+
).then((results) => {
|
|
43
|
+
const hasError = results.some((r) => r.code === ExportResultCode.FAILED);
|
|
44
|
+
resultCallback({
|
|
45
|
+
code: hasError ? ExportResultCode.FAILED : ExportResultCode.SUCCESS
|
|
46
|
+
});
|
|
47
|
+
}).catch((error) => {
|
|
48
|
+
console.error("[CompositeExporter] Export error:", error);
|
|
49
|
+
resultCallback({ code: ExportResultCode.FAILED, error });
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
shutdown() {
|
|
53
|
+
return Promise.all(this.exporters.map((e) => e.shutdown?.() ?? Promise.resolve())).then(() => void 0);
|
|
54
|
+
}
|
|
55
|
+
forceFlush() {
|
|
56
|
+
return Promise.all(this.exporters.map((e) => e.forceFlush?.() ?? Promise.resolve())).then(() => void 0);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
15
59
|
|
|
16
60
|
function getSampler(config) {
|
|
17
61
|
if (!config.sampling) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer",
|
|
3
|
-
"version": "0.10.4-alpha.
|
|
3
|
+
"version": "0.10.4-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -85,13 +85,13 @@
|
|
|
85
85
|
"author": "",
|
|
86
86
|
"license": "Elastic-2.0",
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@babel/core": "^7.
|
|
89
|
-
"@babel/helper-module-imports": "^7.
|
|
88
|
+
"@babel/core": "^7.27.4",
|
|
89
|
+
"@babel/helper-module-imports": "^7.27.1",
|
|
90
90
|
"@neon-rs/load": "^0.1.82",
|
|
91
91
|
"@rollup/plugin-alias": "^5.1.1",
|
|
92
92
|
"@rollup/plugin-commonjs": "^28.0.3",
|
|
93
93
|
"@rollup/plugin-json": "^6.1.0",
|
|
94
|
-
"@rollup/plugin-node-resolve": "^16.0.
|
|
94
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
95
95
|
"@rollup/plugin-virtual": "^3.0.2",
|
|
96
96
|
"@sindresorhus/slugify": "^2.2.1",
|
|
97
97
|
"builtins": "^5.1.0",
|
|
@@ -101,17 +101,17 @@
|
|
|
101
101
|
"find-workspaces": "^0.3.1",
|
|
102
102
|
"fs-extra": "^11.3.0",
|
|
103
103
|
"globby": "^14.1.0",
|
|
104
|
-
"hono": "^4.7.
|
|
104
|
+
"hono": "^4.7.11",
|
|
105
105
|
"resolve-from": "^5.0.0",
|
|
106
106
|
"rollup": "^4.41.1",
|
|
107
107
|
"rollup-plugin-esbuild": "^6.2.1",
|
|
108
108
|
"rollup-plugin-node-externals": "^8.0.0",
|
|
109
109
|
"typescript-paths": "^1.5.1",
|
|
110
|
-
"zod": "^3.
|
|
111
|
-
"@mastra/server": "^0.10.4-alpha.
|
|
110
|
+
"zod": "^3.25.56",
|
|
111
|
+
"@mastra/server": "^0.10.4-alpha.1"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
|
-
"@hono/node-server": "^1.
|
|
114
|
+
"@hono/node-server": "^1.14.3",
|
|
115
115
|
"@hono/swagger-ui": "^0.5.1",
|
|
116
116
|
"@microsoft/api-extractor": "^7.52.8",
|
|
117
117
|
"@types/babel__core": "^7.20.5",
|
|
@@ -120,22 +120,22 @@
|
|
|
120
120
|
"@types/node": "^20.17.57",
|
|
121
121
|
"eslint": "^9.28.0",
|
|
122
122
|
"fetch-to-node": "^2.1.0",
|
|
123
|
-
"hono-openapi": "^0.4.
|
|
123
|
+
"hono-openapi": "^0.4.8",
|
|
124
124
|
"rollup-plugin-visualizer": "^5.14.0",
|
|
125
125
|
"superjson": "^2.2.2",
|
|
126
126
|
"tsup": "^8.5.0",
|
|
127
|
-
"type-fest": "^4.
|
|
127
|
+
"type-fest": "^4.41.0",
|
|
128
128
|
"typescript": "^5.8.2",
|
|
129
129
|
"vitest": "^2.1.9",
|
|
130
|
-
"@
|
|
131
|
-
"@mastra/mcp": "^0.10.
|
|
132
|
-
"@
|
|
130
|
+
"@mastra/core": "0.10.4-alpha.1",
|
|
131
|
+
"@mastra/mcp": "^0.10.3-alpha.0",
|
|
132
|
+
"@internal/lint": "0.0.10"
|
|
133
133
|
},
|
|
134
134
|
"peerDependencies": {
|
|
135
135
|
"@mastra/core": "^0.10.2-alpha.0"
|
|
136
136
|
},
|
|
137
137
|
"scripts": {
|
|
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 --format esm,cjs --clean --experimental-dts --treeshake=smallest --splitting --publicDir",
|
|
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",
|
|
139
139
|
"build:watch": "pnpm build --watch",
|
|
140
140
|
"pull:openapispec": "node src/server/openapi.script.js",
|
|
141
141
|
"test": "vitest run",
|