@mastra/deployer 0.17.0-alpha.5 → 0.17.0-alpha.7
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/CHANGELOG.md +29 -0
- package/dist/build/analyze.cjs +2 -2
- package/dist/build/analyze.js +1 -1
- package/dist/build/bundler.cjs +3 -3
- package/dist/build/bundler.js +1 -1
- package/dist/build/index.cjs +15 -15
- package/dist/build/index.js +5 -5
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-M54YPGM4.cjs → chunk-36EU6KMX.cjs} +5 -5
- package/dist/{chunk-M54YPGM4.cjs.map → chunk-36EU6KMX.cjs.map} +1 -1
- package/dist/{chunk-YHISSTZJ.cjs → chunk-4PSE6XXT.cjs} +14 -15
- package/dist/chunk-4PSE6XXT.cjs.map +1 -0
- package/dist/{chunk-4SIOF7ZD.cjs → chunk-AGJGRBDD.cjs} +5 -5
- package/dist/{chunk-4SIOF7ZD.cjs.map → chunk-AGJGRBDD.cjs.map} +1 -1
- package/dist/{chunk-RZAGSFAM.js → chunk-ANCH5GYJ.js} +6 -6
- package/dist/{chunk-RZAGSFAM.js.map → chunk-ANCH5GYJ.js.map} +1 -1
- package/dist/{chunk-J3J7AMBG.js → chunk-AUXVJBHV.js} +3 -3
- package/dist/{chunk-J3J7AMBG.js.map → chunk-AUXVJBHV.js.map} +1 -1
- package/dist/{chunk-MIQJS7XN.js → chunk-BNYQVIRY.js} +6 -7
- package/dist/chunk-BNYQVIRY.js.map +1 -0
- package/dist/{chunk-YKVNJVGJ.cjs → chunk-BZDTNUHJ.cjs} +7 -7
- package/dist/{chunk-YKVNJVGJ.cjs.map → chunk-BZDTNUHJ.cjs.map} +1 -1
- package/dist/{chunk-HR2HOA5D.cjs → chunk-CGLMV75H.cjs} +8 -8
- package/dist/chunk-CGLMV75H.cjs.map +1 -0
- package/dist/{chunk-YOULDYHE.js → chunk-CHKSDG3W.js} +6 -6
- package/dist/chunk-CHKSDG3W.js.map +1 -0
- package/dist/{chunk-YJOKHEUC.js → chunk-E3RTDQG6.js} +3 -3
- package/dist/{chunk-YJOKHEUC.js.map → chunk-E3RTDQG6.js.map} +1 -1
- package/dist/{chunk-TWABWFKL.js → chunk-IARXPG3L.js} +3 -3
- package/dist/{chunk-TWABWFKL.js.map → chunk-IARXPG3L.js.map} +1 -1
- package/dist/{chunk-2JXD2KJI.cjs → chunk-Q7ZL5HZV.cjs} +21 -21
- package/dist/{chunk-2JXD2KJI.cjs.map → chunk-Q7ZL5HZV.cjs.map} +1 -1
- package/dist/index.cjs +12 -12
- package/dist/index.js +4 -4
- package/dist/server/handlers/auth/helpers.d.ts.map +1 -1
- package/dist/server/handlers/routes/networks/router.d.ts +0 -1
- package/dist/server/handlers/routes/networks/router.d.ts.map +1 -1
- package/dist/server/handlers/routes/workflows/handlers.d.ts +1 -0
- package/dist/server/handlers/routes/workflows/handlers.d.ts.map +1 -1
- package/dist/server/handlers/routes/workflows/router.d.ts.map +1 -1
- package/dist/server/index.cjs +75 -206
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +76 -207
- package/dist/server/index.js.map +1 -1
- package/dist/services/index.cjs +4 -4
- package/dist/services/index.js +1 -1
- package/package.json +8 -8
- package/dist/chunk-HR2HOA5D.cjs.map +0 -1
- package/dist/chunk-MIQJS7XN.js.map +0 -1
- package/dist/chunk-YHISSTZJ.cjs.map +0 -1
- package/dist/chunk-YOULDYHE.js.map +0 -1
- package/dist/server/handlers/routes/networks/network.d.ts +0 -6
- package/dist/server/handlers/routes/networks/network.d.ts.map +0 -1
package/dist/server/index.cjs
CHANGED
|
@@ -33,7 +33,6 @@ var logs = require('@mastra/server/handlers/logs');
|
|
|
33
33
|
var util = require('util');
|
|
34
34
|
var buffer = require('buffer');
|
|
35
35
|
var memory = require('@mastra/server/handlers/memory');
|
|
36
|
-
var network = require('@mastra/server/handlers/network');
|
|
37
36
|
var vNextNetwork = require('@mastra/server/handlers/vNextNetwork');
|
|
38
37
|
var aiTracing = require('@mastra/core/ai-tracing');
|
|
39
38
|
var observability = require('@mastra/server/handlers/observability');
|
|
@@ -439,8 +438,9 @@ var responseViaCache = async (res, outgoing) => {
|
|
|
439
438
|
}
|
|
440
439
|
outgoing[outgoingEnded]?.();
|
|
441
440
|
};
|
|
441
|
+
var isPromise = (res) => typeof res.then === "function";
|
|
442
442
|
var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
|
443
|
-
if (res
|
|
443
|
+
if (isPromise(res)) {
|
|
444
444
|
if (options.errorHandler) {
|
|
445
445
|
try {
|
|
446
446
|
res = await res;
|
|
@@ -1128,7 +1128,6 @@ var pathMatchesRule = (path, rulePath) => {
|
|
|
1128
1128
|
return pathMatchesPattern(path, rulePath);
|
|
1129
1129
|
}
|
|
1130
1130
|
if (rulePath instanceof RegExp) {
|
|
1131
|
-
console.log("rulePath", rulePath, path, rulePath.test(path));
|
|
1132
1131
|
return rulePath.test(path);
|
|
1133
1132
|
}
|
|
1134
1133
|
if (Array.isArray(rulePath)) {
|
|
@@ -1308,11 +1307,11 @@ function handleTriggerClientsRefresh(c2) {
|
|
|
1308
1307
|
}
|
|
1309
1308
|
function disableHotReload() {
|
|
1310
1309
|
hotReloadDisabled = true;
|
|
1311
|
-
console.
|
|
1310
|
+
console.info("\u{1F512} Hot reload disabled for template installation");
|
|
1312
1311
|
}
|
|
1313
1312
|
function enableHotReload() {
|
|
1314
1313
|
hotReloadDisabled = false;
|
|
1315
|
-
console.
|
|
1314
|
+
console.info("\u{1F513} Hot reload re-enabled after template installation");
|
|
1316
1315
|
}
|
|
1317
1316
|
function isHotReloadDisabled() {
|
|
1318
1317
|
return hotReloadDisabled;
|
|
@@ -8257,68 +8256,6 @@ function memoryRoutes(bodyLimitOptions) {
|
|
|
8257
8256
|
);
|
|
8258
8257
|
return router;
|
|
8259
8258
|
}
|
|
8260
|
-
async function getNetworksHandler(c2) {
|
|
8261
|
-
try {
|
|
8262
|
-
const mastra = c2.get("mastra");
|
|
8263
|
-
const runtimeContext = c2.get("runtimeContext");
|
|
8264
|
-
const networks = await network.getNetworksHandler({
|
|
8265
|
-
mastra,
|
|
8266
|
-
runtimeContext
|
|
8267
|
-
});
|
|
8268
|
-
return c2.json(networks);
|
|
8269
|
-
} catch (error) {
|
|
8270
|
-
return handleError(error, "Error getting networks");
|
|
8271
|
-
}
|
|
8272
|
-
}
|
|
8273
|
-
async function getNetworkByIdHandler(c2) {
|
|
8274
|
-
try {
|
|
8275
|
-
const mastra = c2.get("mastra");
|
|
8276
|
-
const networkId = c2.req.param("networkId");
|
|
8277
|
-
const runtimeContext = c2.get("runtimeContext");
|
|
8278
|
-
const network$1 = await network.getNetworkByIdHandler({
|
|
8279
|
-
mastra,
|
|
8280
|
-
networkId,
|
|
8281
|
-
runtimeContext
|
|
8282
|
-
});
|
|
8283
|
-
return c2.json(network$1);
|
|
8284
|
-
} catch (error) {
|
|
8285
|
-
return handleError(error, "Error getting network by ID");
|
|
8286
|
-
}
|
|
8287
|
-
}
|
|
8288
|
-
async function generateHandler2(c2) {
|
|
8289
|
-
try {
|
|
8290
|
-
const mastra = c2.get("mastra");
|
|
8291
|
-
const runtimeContext = c2.get("runtimeContext");
|
|
8292
|
-
const networkId = c2.req.param("networkId");
|
|
8293
|
-
const body = await c2.req.json();
|
|
8294
|
-
const result = await network.generateHandler({
|
|
8295
|
-
mastra,
|
|
8296
|
-
runtimeContext,
|
|
8297
|
-
networkId,
|
|
8298
|
-
body
|
|
8299
|
-
});
|
|
8300
|
-
return c2.json(result);
|
|
8301
|
-
} catch (error) {
|
|
8302
|
-
return handleError(error, "Error generating from network");
|
|
8303
|
-
}
|
|
8304
|
-
}
|
|
8305
|
-
async function streamGenerateHandler2(c2) {
|
|
8306
|
-
try {
|
|
8307
|
-
const mastra = c2.get("mastra");
|
|
8308
|
-
const runtimeContext = c2.get("runtimeContext");
|
|
8309
|
-
const networkId = c2.req.param("networkId");
|
|
8310
|
-
const body = await c2.req.json();
|
|
8311
|
-
const streamResponse = await network.streamGenerateHandler({
|
|
8312
|
-
mastra,
|
|
8313
|
-
runtimeContext,
|
|
8314
|
-
networkId,
|
|
8315
|
-
body
|
|
8316
|
-
});
|
|
8317
|
-
return streamResponse;
|
|
8318
|
-
} catch (error) {
|
|
8319
|
-
return handleError(error, "Error streaming from network");
|
|
8320
|
-
}
|
|
8321
|
-
}
|
|
8322
8259
|
async function getVNextNetworksHandler(c2) {
|
|
8323
8260
|
try {
|
|
8324
8261
|
const mastra = c2.get("mastra");
|
|
@@ -8696,143 +8633,6 @@ function vNextNetworksRouter(bodyLimitOptions) {
|
|
|
8696
8633
|
);
|
|
8697
8634
|
return router;
|
|
8698
8635
|
}
|
|
8699
|
-
function networksRouter(bodyLimitOptions) {
|
|
8700
|
-
const router = new hono.Hono();
|
|
8701
|
-
router.get(
|
|
8702
|
-
"/",
|
|
8703
|
-
w({
|
|
8704
|
-
description: "Get all available networks",
|
|
8705
|
-
tags: ["networks"],
|
|
8706
|
-
responses: {
|
|
8707
|
-
200: {
|
|
8708
|
-
description: "List of all networks"
|
|
8709
|
-
}
|
|
8710
|
-
}
|
|
8711
|
-
}),
|
|
8712
|
-
getNetworksHandler
|
|
8713
|
-
);
|
|
8714
|
-
router.get(
|
|
8715
|
-
"/:networkId",
|
|
8716
|
-
w({
|
|
8717
|
-
description: "Get network by ID",
|
|
8718
|
-
tags: ["networks"],
|
|
8719
|
-
parameters: [
|
|
8720
|
-
{
|
|
8721
|
-
name: "networkId",
|
|
8722
|
-
in: "path",
|
|
8723
|
-
required: true,
|
|
8724
|
-
schema: { type: "string" }
|
|
8725
|
-
}
|
|
8726
|
-
],
|
|
8727
|
-
responses: {
|
|
8728
|
-
200: {
|
|
8729
|
-
description: "Network details"
|
|
8730
|
-
},
|
|
8731
|
-
404: {
|
|
8732
|
-
description: "Network not found"
|
|
8733
|
-
}
|
|
8734
|
-
}
|
|
8735
|
-
}),
|
|
8736
|
-
getNetworkByIdHandler
|
|
8737
|
-
);
|
|
8738
|
-
router.post(
|
|
8739
|
-
"/:networkId/generate",
|
|
8740
|
-
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
8741
|
-
w({
|
|
8742
|
-
description: "Generate a response from a network",
|
|
8743
|
-
tags: ["networks"],
|
|
8744
|
-
parameters: [
|
|
8745
|
-
{
|
|
8746
|
-
name: "networkId",
|
|
8747
|
-
in: "path",
|
|
8748
|
-
required: true,
|
|
8749
|
-
schema: { type: "string" }
|
|
8750
|
-
}
|
|
8751
|
-
],
|
|
8752
|
-
requestBody: {
|
|
8753
|
-
required: true,
|
|
8754
|
-
content: {
|
|
8755
|
-
"application/json": {
|
|
8756
|
-
schema: {
|
|
8757
|
-
type: "object",
|
|
8758
|
-
properties: {
|
|
8759
|
-
input: {
|
|
8760
|
-
oneOf: [
|
|
8761
|
-
{ type: "string" },
|
|
8762
|
-
{
|
|
8763
|
-
type: "array",
|
|
8764
|
-
items: { type: "object" }
|
|
8765
|
-
}
|
|
8766
|
-
],
|
|
8767
|
-
description: "Input for the network, can be a string or an array of CoreMessage objects"
|
|
8768
|
-
}
|
|
8769
|
-
},
|
|
8770
|
-
required: ["input"]
|
|
8771
|
-
}
|
|
8772
|
-
}
|
|
8773
|
-
}
|
|
8774
|
-
},
|
|
8775
|
-
responses: {
|
|
8776
|
-
200: {
|
|
8777
|
-
description: "Generated response"
|
|
8778
|
-
},
|
|
8779
|
-
404: {
|
|
8780
|
-
description: "Network not found"
|
|
8781
|
-
}
|
|
8782
|
-
}
|
|
8783
|
-
}),
|
|
8784
|
-
generateHandler2
|
|
8785
|
-
);
|
|
8786
|
-
router.post(
|
|
8787
|
-
"/:networkId/stream",
|
|
8788
|
-
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
8789
|
-
w({
|
|
8790
|
-
description: "Generate a response from a network",
|
|
8791
|
-
tags: ["networks"],
|
|
8792
|
-
parameters: [
|
|
8793
|
-
{
|
|
8794
|
-
name: "networkId",
|
|
8795
|
-
in: "path",
|
|
8796
|
-
required: true,
|
|
8797
|
-
schema: { type: "string" }
|
|
8798
|
-
}
|
|
8799
|
-
],
|
|
8800
|
-
requestBody: {
|
|
8801
|
-
required: true,
|
|
8802
|
-
content: {
|
|
8803
|
-
"application/json": {
|
|
8804
|
-
schema: {
|
|
8805
|
-
type: "object",
|
|
8806
|
-
properties: {
|
|
8807
|
-
input: {
|
|
8808
|
-
oneOf: [
|
|
8809
|
-
{ type: "string" },
|
|
8810
|
-
{
|
|
8811
|
-
type: "array",
|
|
8812
|
-
items: { type: "object" }
|
|
8813
|
-
}
|
|
8814
|
-
],
|
|
8815
|
-
description: "Input for the network, can be a string or an array of CoreMessage objects"
|
|
8816
|
-
}
|
|
8817
|
-
},
|
|
8818
|
-
required: ["input"]
|
|
8819
|
-
}
|
|
8820
|
-
}
|
|
8821
|
-
}
|
|
8822
|
-
},
|
|
8823
|
-
responses: {
|
|
8824
|
-
200: {
|
|
8825
|
-
description: "Generated response"
|
|
8826
|
-
},
|
|
8827
|
-
404: {
|
|
8828
|
-
description: "Network not found"
|
|
8829
|
-
}
|
|
8830
|
-
}
|
|
8831
|
-
}),
|
|
8832
|
-
streamGenerateHandler2
|
|
8833
|
-
);
|
|
8834
|
-
return router;
|
|
8835
|
-
}
|
|
8836
8636
|
async function getAITraceHandler(c2) {
|
|
8837
8637
|
try {
|
|
8838
8638
|
const mastra = c2.get("mastra");
|
|
@@ -9897,6 +9697,46 @@ async function streamWorkflowHandler(c2) {
|
|
|
9897
9697
|
return handleError(error, "Error streaming workflow");
|
|
9898
9698
|
}
|
|
9899
9699
|
}
|
|
9700
|
+
async function observeStreamWorkflowHandler(c2) {
|
|
9701
|
+
try {
|
|
9702
|
+
const mastra = c2.get("mastra");
|
|
9703
|
+
const logger2 = mastra.getLogger();
|
|
9704
|
+
const workflowId = c2.req.param("workflowId");
|
|
9705
|
+
const runId = c2.req.query("runId");
|
|
9706
|
+
if (!runId) {
|
|
9707
|
+
throw new httpException.HTTPException(400, { message: "runId required to observe workflow stream" });
|
|
9708
|
+
}
|
|
9709
|
+
c2.header("Transfer-Encoding", "chunked");
|
|
9710
|
+
return streaming.stream(
|
|
9711
|
+
c2,
|
|
9712
|
+
async (stream7) => {
|
|
9713
|
+
try {
|
|
9714
|
+
const result = await workflows.observeStreamWorkflowHandler({
|
|
9715
|
+
mastra,
|
|
9716
|
+
workflowId,
|
|
9717
|
+
runId
|
|
9718
|
+
});
|
|
9719
|
+
const reader = result.getReader();
|
|
9720
|
+
stream7.onAbort(() => {
|
|
9721
|
+
void reader.cancel("request aborted");
|
|
9722
|
+
});
|
|
9723
|
+
let chunkResult;
|
|
9724
|
+
while ((chunkResult = await reader.read()) && !chunkResult.done) {
|
|
9725
|
+
await stream7.write(JSON.stringify(chunkResult.value) + "");
|
|
9726
|
+
}
|
|
9727
|
+
} catch (err) {
|
|
9728
|
+
logger2.error("Error in workflow observe stream: " + (err?.message ?? "Unknown error"));
|
|
9729
|
+
}
|
|
9730
|
+
await stream7.close();
|
|
9731
|
+
},
|
|
9732
|
+
async (err) => {
|
|
9733
|
+
logger2.error("Error in workflow observe stream: " + err?.message);
|
|
9734
|
+
}
|
|
9735
|
+
);
|
|
9736
|
+
} catch (error) {
|
|
9737
|
+
return handleError(error, "Error observing workflow stream");
|
|
9738
|
+
}
|
|
9739
|
+
}
|
|
9900
9740
|
async function streamVNextWorkflowHandler(c2) {
|
|
9901
9741
|
try {
|
|
9902
9742
|
const mastra = c2.get("mastra");
|
|
@@ -10167,7 +10007,7 @@ function watchLegacyWorkflowHandler(c2) {
|
|
|
10167
10007
|
await stream7.write(chunk.toString() + "");
|
|
10168
10008
|
}
|
|
10169
10009
|
} catch (err) {
|
|
10170
|
-
console.
|
|
10010
|
+
console.error(err);
|
|
10171
10011
|
}
|
|
10172
10012
|
},
|
|
10173
10013
|
async (err) => {
|
|
@@ -10779,6 +10619,36 @@ function workflowsRouter(bodyLimitOptions) {
|
|
|
10779
10619
|
}),
|
|
10780
10620
|
streamWorkflowHandler
|
|
10781
10621
|
);
|
|
10622
|
+
router.post(
|
|
10623
|
+
"/:workflowId/observe-stream",
|
|
10624
|
+
w({
|
|
10625
|
+
description: "Observe workflow stream in real-time",
|
|
10626
|
+
parameters: [
|
|
10627
|
+
{
|
|
10628
|
+
name: "workflowId",
|
|
10629
|
+
in: "path",
|
|
10630
|
+
required: true,
|
|
10631
|
+
schema: { type: "string" }
|
|
10632
|
+
},
|
|
10633
|
+
{
|
|
10634
|
+
name: "runId",
|
|
10635
|
+
in: "query",
|
|
10636
|
+
required: true,
|
|
10637
|
+
schema: { type: "string" }
|
|
10638
|
+
}
|
|
10639
|
+
],
|
|
10640
|
+
responses: {
|
|
10641
|
+
200: {
|
|
10642
|
+
description: "workflow stream observed"
|
|
10643
|
+
},
|
|
10644
|
+
404: {
|
|
10645
|
+
description: "workflow not found"
|
|
10646
|
+
}
|
|
10647
|
+
},
|
|
10648
|
+
tags: ["workflows"]
|
|
10649
|
+
}),
|
|
10650
|
+
observeStreamWorkflowHandler
|
|
10651
|
+
);
|
|
10782
10652
|
router.post(
|
|
10783
10653
|
"/:workflowId/streamVNext",
|
|
10784
10654
|
w({
|
|
@@ -11483,7 +11353,6 @@ async function createHonoServer(mastra, options = {
|
|
|
11483
11353
|
);
|
|
11484
11354
|
app.route("/api/agents", agentsRouter(bodyLimitOptions));
|
|
11485
11355
|
app.route("/api/networks", vNextNetworksRouter(bodyLimitOptions));
|
|
11486
|
-
app.route("/api/networks", networksRouter(bodyLimitOptions));
|
|
11487
11356
|
if (options.isDev) {
|
|
11488
11357
|
app.route("/api/agents", agentsRouterDev(bodyLimitOptions));
|
|
11489
11358
|
}
|