@mastra/server 0.0.0-expose-more-playground-ui-20250502141824 → 0.0.0-feat-tool-input-validation-20250731232758
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/LICENSE.md +11 -42
- package/README.md +48 -135
- package/dist/_tsup-dts-rollup.d.cts +715 -109
- package/dist/_tsup-dts-rollup.d.ts +715 -109
- package/dist/{chunk-FV45V6WC.cjs → chunk-2KZFMI6P.cjs} +1 -7
- package/dist/{chunk-5YGDYMRB.cjs → chunk-2SLFAFTR.cjs} +14 -13
- package/dist/chunk-36BLNJHS.js +2039 -0
- package/dist/chunk-424T5F2J.cjs +157 -0
- package/dist/chunk-4D66QEKC.js +81 -0
- package/dist/chunk-6KP2OBYA.cjs +544 -0
- package/dist/chunk-6T5JUKOQ.js +149 -0
- package/dist/chunk-75ZPJI57.cjs +9 -0
- package/dist/{chunk-M56ECCHK.cjs → chunk-7TP2LX5L.cjs} +20 -19
- package/dist/{chunk-QN4KF3BH.cjs → chunk-CCGRCYWJ.cjs} +2 -2
- package/dist/{chunk-QJ3AHN64.js → chunk-CRCR3ZUK.js} +4 -3
- package/dist/{chunk-7IWQE76Z.cjs → chunk-G7KH752Y.cjs} +16 -10
- package/dist/chunk-GHC4YV6R.js +504 -0
- package/dist/chunk-HISYIDYH.cjs +2042 -0
- package/dist/{chunk-D3G23FP3.cjs → chunk-HRSAZUIK.cjs} +24 -22
- package/dist/chunk-I5JKUCGE.cjs +308 -0
- package/dist/{chunk-Q6SHQECN.js → chunk-KHZKYUNR.js} +34 -10
- package/dist/{chunk-TRDNDNGQ.js → chunk-LCM566I4.js} +2 -7
- package/dist/chunk-LF7P5PLR.js +14 -0
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/chunk-PIAJQ75M.js +539 -0
- package/dist/chunk-PZQDCRPV.cjs +16 -0
- package/dist/chunk-QGX47B5D.cjs +86 -0
- package/dist/{chunk-WTHDCRMY.js → chunk-RG473F6Y.js} +12 -6
- package/dist/chunk-RHSWAXKB.cjs +118 -0
- package/dist/{chunk-L7XE5QTW.js → chunk-RSEO4XPX.js} +1 -1
- package/dist/chunk-SDPGVWQJ.cjs +512 -0
- package/dist/chunk-T7HAZC2E.js +527 -0
- package/dist/chunk-UCV4247U.cjs +332 -0
- package/dist/chunk-UEVYOKAH.cjs +555 -0
- package/dist/{chunk-Y3SV5XK4.js → chunk-VTTN2FW3.js} +136 -18
- package/dist/{chunk-5JNVY6DU.js → chunk-WBRFIHSF.js} +7 -5
- package/dist/{chunk-4JINXASC.js → chunk-WNVFNNWN.js} +5 -4
- package/dist/{chunk-M3YJLWTU.js → chunk-ZYAFP2AV.js} +68 -57
- package/dist/server/handlers/a2a.cjs +30 -0
- package/dist/server/handlers/a2a.d.cts +6 -0
- package/dist/server/handlers/a2a.d.ts +6 -0
- package/dist/server/handlers/a2a.js +1 -0
- package/dist/server/handlers/agents.cjs +11 -7
- package/dist/server/handlers/agents.d.cts +1 -0
- package/dist/server/handlers/agents.d.ts +1 -0
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/error.cjs +2 -2
- package/dist/server/handlers/error.js +1 -1
- package/dist/server/handlers/legacyWorkflows.cjs +46 -0
- package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
- package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
- package/dist/server/handlers/legacyWorkflows.js +1 -0
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +33 -9
- package/dist/server/handlers/memory.d.cts +6 -0
- package/dist/server/handlers/memory.d.ts +6 -0
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/network.cjs +5 -5
- package/dist/server/handlers/network.js +1 -1
- package/dist/server/handlers/scores.cjs +30 -0
- package/dist/server/handlers/scores.d.cts +6 -0
- package/dist/server/handlers/scores.d.ts +6 -0
- package/dist/server/handlers/scores.js +1 -0
- package/dist/server/handlers/telemetry.cjs +3 -3
- package/dist/server/handlers/telemetry.js +1 -1
- package/dist/server/handlers/tools.cjs +5 -5
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/utils.cjs +2 -2
- package/dist/server/handlers/utils.js +1 -1
- package/dist/server/handlers/vNextNetwork.cjs +218 -0
- package/dist/server/handlers/vNextNetwork.d.cts +6 -0
- package/dist/server/handlers/vNextNetwork.d.ts +6 -0
- package/dist/server/handlers/vNextNetwork.js +211 -0
- package/dist/server/handlers/vector.cjs +7 -7
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/voice.cjs +8 -4
- package/dist/server/handlers/voice.d.cts +1 -0
- package/dist/server/handlers/voice.d.ts +1 -0
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +33 -13
- package/dist/server/handlers/workflows.d.cts +7 -2
- package/dist/server/handlers/workflows.d.ts +7 -2
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +39 -29
- package/dist/server/handlers.d.cts +4 -2
- package/dist/server/handlers.d.ts +4 -2
- package/dist/server/handlers.js +12 -10
- package/package.json +17 -15
- package/dist/chunk-2FJURXCL.cjs +0 -213
- package/dist/chunk-3AHQ5RGN.js +0 -11
- package/dist/chunk-3EJZQ6TQ.js +0 -49
- package/dist/chunk-4BIX6GMY.cjs +0 -189
- package/dist/chunk-55HTWX4C.cjs +0 -93
- package/dist/chunk-5SWCVTNL.cjs +0 -5579
- package/dist/chunk-AELYAUEE.cjs +0 -316
- package/dist/chunk-EVCC233P.cjs +0 -321
- package/dist/chunk-JPB6RPGB.js +0 -304
- package/dist/chunk-OMN3UI6X.js +0 -5576
- package/dist/chunk-RBQASTUP.js +0 -203
- package/dist/chunk-SKBVVI24.cjs +0 -54
- package/dist/chunk-ZLBRQFDD.cjs +0 -13
- package/dist/server/handlers/vNextWorkflows.cjs +0 -46
- package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
- package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
- package/dist/server/handlers/vNextWorkflows.js +0 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkPZQDCRPV_cjs = require('./chunk-PZQDCRPV.cjs');
|
|
4
|
+
var chunk2KZFMI6P_cjs = require('./chunk-2KZFMI6P.cjs');
|
|
5
|
+
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
5
6
|
|
|
6
7
|
// src/server/handlers/vector.ts
|
|
7
8
|
var vector_exports = {};
|
|
8
|
-
|
|
9
|
+
chunk75ZPJI57_cjs.__export(vector_exports, {
|
|
9
10
|
createIndex: () => createIndex,
|
|
10
11
|
deleteIndex: () => deleteIndex,
|
|
11
12
|
describeIndex: () => describeIndex,
|
|
@@ -15,24 +16,24 @@ chunkFV45V6WC_cjs.__export(vector_exports, {
|
|
|
15
16
|
});
|
|
16
17
|
function getVector(mastra, vectorName) {
|
|
17
18
|
if (!vectorName) {
|
|
18
|
-
throw new
|
|
19
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Vector name is required" });
|
|
19
20
|
}
|
|
20
21
|
const vector = mastra.getVector(vectorName);
|
|
21
22
|
if (!vector) {
|
|
22
|
-
throw new
|
|
23
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: `Vector store ${vectorName} not found` });
|
|
23
24
|
}
|
|
24
25
|
return vector;
|
|
25
26
|
}
|
|
26
27
|
async function upsertVectors({ mastra, vectorName, index }) {
|
|
27
28
|
try {
|
|
28
29
|
if (!index?.indexName || !index?.vectors || !Array.isArray(index.vectors)) {
|
|
29
|
-
throw new
|
|
30
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Invalid request index. indexName and vectors array are required." });
|
|
30
31
|
}
|
|
31
32
|
const vector = getVector(mastra, vectorName);
|
|
32
33
|
const result = await vector.upsert(index);
|
|
33
34
|
return { ids: result };
|
|
34
35
|
} catch (error) {
|
|
35
|
-
return
|
|
36
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error upserting vectors");
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
async function createIndex({
|
|
@@ -43,18 +44,18 @@ async function createIndex({
|
|
|
43
44
|
try {
|
|
44
45
|
const { indexName, dimension, metric } = index;
|
|
45
46
|
if (!indexName || typeof dimension !== "number" || dimension <= 0) {
|
|
46
|
-
throw new
|
|
47
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, {
|
|
47
48
|
message: "Invalid request index, indexName and positive dimension number are required."
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
if (metric && !["cosine", "euclidean", "dotproduct"].includes(metric)) {
|
|
51
|
-
throw new
|
|
52
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Invalid metric. Must be one of: cosine, euclidean, dotproduct" });
|
|
52
53
|
}
|
|
53
54
|
const vector = getVector(mastra, vectorName);
|
|
54
55
|
await vector.createIndex({ indexName, dimension, metric });
|
|
55
56
|
return { success: true };
|
|
56
57
|
} catch (error) {
|
|
57
|
-
return
|
|
58
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error creating index");
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
async function queryVectors({
|
|
@@ -64,13 +65,13 @@ async function queryVectors({
|
|
|
64
65
|
}) {
|
|
65
66
|
try {
|
|
66
67
|
if (!query?.indexName || !query?.queryVector || !Array.isArray(query.queryVector)) {
|
|
67
|
-
throw new
|
|
68
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Invalid request query. indexName and queryVector array are required." });
|
|
68
69
|
}
|
|
69
70
|
const vector = getVector(mastra, vectorName);
|
|
70
71
|
const results = await vector.query(query);
|
|
71
72
|
return results;
|
|
72
73
|
} catch (error) {
|
|
73
|
-
return
|
|
74
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error querying vectors");
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
async function listIndexes({ mastra, vectorName }) {
|
|
@@ -79,7 +80,7 @@ async function listIndexes({ mastra, vectorName }) {
|
|
|
79
80
|
const indexes = await vector.listIndexes();
|
|
80
81
|
return indexes.filter(Boolean);
|
|
81
82
|
} catch (error) {
|
|
82
|
-
return
|
|
83
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error listing indexes");
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
async function describeIndex({
|
|
@@ -89,17 +90,17 @@ async function describeIndex({
|
|
|
89
90
|
}) {
|
|
90
91
|
try {
|
|
91
92
|
if (!indexName) {
|
|
92
|
-
throw new
|
|
93
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Index name is required" });
|
|
93
94
|
}
|
|
94
95
|
const vector = getVector(mastra, vectorName);
|
|
95
|
-
const stats = await vector.describeIndex(indexName);
|
|
96
|
+
const stats = await vector.describeIndex({ indexName });
|
|
96
97
|
return {
|
|
97
98
|
dimension: stats.dimension,
|
|
98
99
|
count: stats.count,
|
|
99
100
|
metric: stats.metric?.toLowerCase()
|
|
100
101
|
};
|
|
101
102
|
} catch (error) {
|
|
102
|
-
return
|
|
103
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error describing index");
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
async function deleteIndex({
|
|
@@ -109,13 +110,13 @@ async function deleteIndex({
|
|
|
109
110
|
}) {
|
|
110
111
|
try {
|
|
111
112
|
if (!indexName) {
|
|
112
|
-
throw new
|
|
113
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Index name is required" });
|
|
113
114
|
}
|
|
114
115
|
const vector = getVector(mastra, vectorName);
|
|
115
|
-
await vector.deleteIndex(indexName);
|
|
116
|
+
await vector.deleteIndex({ indexName });
|
|
116
117
|
return { success: true };
|
|
117
118
|
} catch (error) {
|
|
118
|
-
return
|
|
119
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error deleting index");
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2KZFMI6P_cjs = require('./chunk-2KZFMI6P.cjs');
|
|
4
4
|
|
|
5
5
|
// src/server/handlers/utils.ts
|
|
6
6
|
function validateBody(body) {
|
|
@@ -11,7 +11,7 @@ function validateBody(body) {
|
|
|
11
11
|
return acc;
|
|
12
12
|
}, {});
|
|
13
13
|
if (Object.keys(errorResponse).length > 0) {
|
|
14
|
-
throw new
|
|
14
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: Object.values(errorResponse)[0] });
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { validateBody } from './chunk-
|
|
2
|
-
import { handleError } from './chunk-
|
|
3
|
-
import {
|
|
1
|
+
import { validateBody } from './chunk-RSEO4XPX.js';
|
|
2
|
+
import { handleError } from './chunk-LF7P5PLR.js';
|
|
3
|
+
import { HTTPException } from './chunk-LCM566I4.js';
|
|
4
|
+
import { __export } from './chunk-MLKGABMK.js';
|
|
4
5
|
|
|
5
6
|
// src/server/handlers/network.ts
|
|
6
7
|
var network_exports = {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkPZQDCRPV_cjs = require('./chunk-PZQDCRPV.cjs');
|
|
4
|
+
var chunk2KZFMI6P_cjs = require('./chunk-2KZFMI6P.cjs');
|
|
5
|
+
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
5
6
|
|
|
6
7
|
// src/server/handlers/telemetry.ts
|
|
7
8
|
var telemetry_exports = {};
|
|
8
|
-
|
|
9
|
+
chunk75ZPJI57_cjs.__export(telemetry_exports, {
|
|
9
10
|
getTelemetryHandler: () => getTelemetryHandler,
|
|
10
11
|
storeTelemetryHandler: () => storeTelemetryHandler
|
|
11
12
|
});
|
|
@@ -14,15 +15,15 @@ async function getTelemetryHandler({ mastra, body }) {
|
|
|
14
15
|
const telemetry = mastra.getTelemetry();
|
|
15
16
|
const storage = mastra.getStorage();
|
|
16
17
|
if (!telemetry) {
|
|
17
|
-
throw new
|
|
18
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Telemetry is not initialized" });
|
|
18
19
|
}
|
|
19
20
|
if (!storage) {
|
|
20
|
-
|
|
21
|
+
return [];
|
|
21
22
|
}
|
|
22
23
|
if (!body) {
|
|
23
|
-
throw new
|
|
24
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Body is required" });
|
|
24
25
|
}
|
|
25
|
-
const { name, scope, page, perPage, attribute } = body;
|
|
26
|
+
const { name, scope, page, perPage, attribute, fromDate, toDate } = body;
|
|
26
27
|
const attributes = attribute ? Object.fromEntries(
|
|
27
28
|
(Array.isArray(attribute) ? attribute : [attribute]).map((attr) => {
|
|
28
29
|
const [key, value] = attr.split(":");
|
|
@@ -34,11 +35,13 @@ async function getTelemetryHandler({ mastra, body }) {
|
|
|
34
35
|
scope,
|
|
35
36
|
page: Number(page ?? 0),
|
|
36
37
|
perPage: Number(perPage ?? 100),
|
|
37
|
-
attributes
|
|
38
|
+
attributes,
|
|
39
|
+
fromDate: fromDate ? new Date(fromDate) : void 0,
|
|
40
|
+
toDate: toDate ? new Date(toDate) : void 0
|
|
38
41
|
});
|
|
39
42
|
return traces;
|
|
40
43
|
} catch (error2) {
|
|
41
|
-
return
|
|
44
|
+
return chunkPZQDCRPV_cjs.handleError(error2, "Error getting telemetry");
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
async function storeTelemetryHandler({ mastra, body }) {
|
|
@@ -46,7 +49,10 @@ async function storeTelemetryHandler({ mastra, body }) {
|
|
|
46
49
|
const storage = mastra.getStorage();
|
|
47
50
|
const logger = mastra.getLogger();
|
|
48
51
|
if (!storage) {
|
|
49
|
-
|
|
52
|
+
return {
|
|
53
|
+
status: "error",
|
|
54
|
+
message: "Storage is not initialized"
|
|
55
|
+
};
|
|
50
56
|
}
|
|
51
57
|
const now = /* @__PURE__ */ new Date();
|
|
52
58
|
const items = body?.resourceSpans?.[0]?.scopeSpans;
|