@mastra/server 0.0.1-alpha.3 → 0.0.1-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.
- package/dist/_tsup-dts-rollup.d.cts +3 -5
- package/dist/_tsup-dts-rollup.d.ts +3 -5
- package/dist/{chunk-C7YHIQWA.js → chunk-BMA2ORRT.js} +2 -2
- package/dist/{chunk-YCJ2OJTL.cjs → chunk-CWSDZEZG.cjs} +17 -7
- package/dist/{chunk-A4DCRMIV.js → chunk-DVPP5S6I.js} +15 -5
- package/dist/{chunk-4AZGCOFY.cjs → chunk-GV52BII2.cjs} +2 -2
- package/dist/server/handlers/agents.cjs +7 -7
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/telemetry.cjs +3 -3
- package/dist/server/handlers/telemetry.js +1 -1
- package/dist/server/handlers.cjs +4 -4
- package/dist/server/handlers.js +2 -2
- package/package.json +4 -4
|
@@ -211,9 +211,7 @@ export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): P
|
|
|
211
211
|
voiceId: string;
|
|
212
212
|
}[]>;
|
|
213
213
|
|
|
214
|
-
export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<
|
|
215
|
-
traces: any[];
|
|
216
|
-
}>;
|
|
214
|
+
export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<any[]>;
|
|
217
215
|
|
|
218
216
|
export declare function getThreadByIdHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<StorageThreadType>;
|
|
219
217
|
|
|
@@ -410,11 +408,11 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
|
|
|
410
408
|
}): Promise<{
|
|
411
409
|
status: string;
|
|
412
410
|
message: string;
|
|
413
|
-
|
|
411
|
+
error: any;
|
|
414
412
|
} | {
|
|
415
413
|
status: string;
|
|
416
414
|
message: string;
|
|
417
|
-
|
|
415
|
+
traceCount: number;
|
|
418
416
|
}>;
|
|
419
417
|
|
|
420
418
|
export declare function streamGenerateHandler({ mastra, agentId, body, }: Context & {
|
|
@@ -211,9 +211,7 @@ export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): P
|
|
|
211
211
|
voiceId: string;
|
|
212
212
|
}[]>;
|
|
213
213
|
|
|
214
|
-
export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<
|
|
215
|
-
traces: any[];
|
|
216
|
-
}>;
|
|
214
|
+
export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<any[]>;
|
|
217
215
|
|
|
218
216
|
export declare function getThreadByIdHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<StorageThreadType>;
|
|
219
217
|
|
|
@@ -410,11 +408,11 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
|
|
|
410
408
|
}): Promise<{
|
|
411
409
|
status: string;
|
|
412
410
|
message: string;
|
|
413
|
-
|
|
411
|
+
error: any;
|
|
414
412
|
} | {
|
|
415
413
|
status: string;
|
|
416
414
|
message: string;
|
|
417
|
-
|
|
415
|
+
traceCount: number;
|
|
418
416
|
}>;
|
|
419
417
|
|
|
420
418
|
export declare function streamGenerateHandler({ mastra, agentId, body, }: Context & {
|
|
@@ -70,7 +70,7 @@ async function getAgentByIdHandler({ mastra, agentId }) {
|
|
|
70
70
|
async function getEvalsByAgentIdHandler({ mastra, agentId }) {
|
|
71
71
|
try {
|
|
72
72
|
const agent = mastra.getAgent(agentId);
|
|
73
|
-
const evals = await mastra.getStorage()?.
|
|
73
|
+
const evals = await mastra.getStorage()?.__getEvalsByAgentName?.(agent.name, "test") || [];
|
|
74
74
|
return {
|
|
75
75
|
id: agentId,
|
|
76
76
|
name: agent.name,
|
|
@@ -84,7 +84,7 @@ async function getEvalsByAgentIdHandler({ mastra, agentId }) {
|
|
|
84
84
|
async function getLiveEvalsByAgentIdHandler({ mastra, agentId }) {
|
|
85
85
|
try {
|
|
86
86
|
const agent = mastra.getAgent(agentId);
|
|
87
|
-
const evals = await mastra.getStorage()?.
|
|
87
|
+
const evals = await mastra.getStorage()?.__getEvalsByAgentName?.(agent.name, "live") || [];
|
|
88
88
|
return {
|
|
89
89
|
id: agentId,
|
|
90
90
|
name: agent.name,
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkZLBRQFDD_cjs = require('./chunk-ZLBRQFDD.cjs');
|
|
4
4
|
var chunkFV45V6WC_cjs = require('./chunk-FV45V6WC.cjs');
|
|
5
|
-
var storage = require('@mastra/core/storage');
|
|
6
5
|
|
|
7
6
|
// src/server/handlers/telemetry.ts
|
|
8
7
|
var telemetry_exports = {};
|
|
@@ -30,26 +29,38 @@ async function getTelemetryHandler({ mastra, body }) {
|
|
|
30
29
|
return [key, value];
|
|
31
30
|
})
|
|
32
31
|
) : void 0;
|
|
33
|
-
const traces = await storage.
|
|
32
|
+
const traces = await storage.__getTraces({
|
|
34
33
|
name,
|
|
35
34
|
scope,
|
|
36
35
|
page: Number(page ?? 0),
|
|
37
36
|
perPage: Number(perPage ?? 100),
|
|
38
37
|
attributes
|
|
39
38
|
});
|
|
40
|
-
return
|
|
39
|
+
return traces;
|
|
41
40
|
} catch (error2) {
|
|
42
41
|
return chunkZLBRQFDD_cjs.handleError(error2, "Error getting telemetry");
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
async function storeTelemetryHandler({ mastra, body }) {
|
|
46
45
|
try {
|
|
47
|
-
const storage
|
|
48
|
-
|
|
46
|
+
const storage = mastra.getStorage();
|
|
47
|
+
const logger = mastra.getLogger();
|
|
48
|
+
if (!storage) {
|
|
49
49
|
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Storage is not initialized" });
|
|
50
50
|
}
|
|
51
51
|
const now = /* @__PURE__ */ new Date();
|
|
52
52
|
const items = body?.resourceSpans?.[0]?.scopeSpans;
|
|
53
|
+
logger.debug("[Telemetry Handler] Received spans:", {
|
|
54
|
+
totalSpans: items?.reduce((acc, scope) => acc + scope.spans.length, 0) || 0,
|
|
55
|
+
timestamp: now.toISOString()
|
|
56
|
+
});
|
|
57
|
+
if (!items?.length) {
|
|
58
|
+
return {
|
|
59
|
+
status: "success",
|
|
60
|
+
message: "No spans to process",
|
|
61
|
+
traceCount: 0
|
|
62
|
+
};
|
|
63
|
+
}
|
|
53
64
|
const allSpans = items.reduce((acc, scopedSpans) => {
|
|
54
65
|
const { scope, spans } = scopedSpans;
|
|
55
66
|
for (const span of spans) {
|
|
@@ -96,8 +107,7 @@ async function storeTelemetryHandler({ mastra, body }) {
|
|
|
96
107
|
}
|
|
97
108
|
return acc;
|
|
98
109
|
}, []);
|
|
99
|
-
return storage
|
|
100
|
-
tableName: storage.TABLE_TRACES,
|
|
110
|
+
return storage.__batchTraceInsert({
|
|
101
111
|
records: allSpans
|
|
102
112
|
}).then(() => {
|
|
103
113
|
return {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { handleError } from './chunk-3AHQ5RGN.js';
|
|
2
2
|
import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
|
|
3
|
-
import { TABLE_TRACES } from '@mastra/core/storage';
|
|
4
3
|
|
|
5
4
|
// src/server/handlers/telemetry.ts
|
|
6
5
|
var telemetry_exports = {};
|
|
@@ -28,14 +27,14 @@ async function getTelemetryHandler({ mastra, body }) {
|
|
|
28
27
|
return [key, value];
|
|
29
28
|
})
|
|
30
29
|
) : void 0;
|
|
31
|
-
const traces = await storage.
|
|
30
|
+
const traces = await storage.__getTraces({
|
|
32
31
|
name,
|
|
33
32
|
scope,
|
|
34
33
|
page: Number(page ?? 0),
|
|
35
34
|
perPage: Number(perPage ?? 100),
|
|
36
35
|
attributes
|
|
37
36
|
});
|
|
38
|
-
return
|
|
37
|
+
return traces;
|
|
39
38
|
} catch (error2) {
|
|
40
39
|
return handleError(error2, "Error getting telemetry");
|
|
41
40
|
}
|
|
@@ -43,11 +42,23 @@ async function getTelemetryHandler({ mastra, body }) {
|
|
|
43
42
|
async function storeTelemetryHandler({ mastra, body }) {
|
|
44
43
|
try {
|
|
45
44
|
const storage = mastra.getStorage();
|
|
45
|
+
const logger = mastra.getLogger();
|
|
46
46
|
if (!storage) {
|
|
47
47
|
throw new HTTPException(400, { message: "Storage is not initialized" });
|
|
48
48
|
}
|
|
49
49
|
const now = /* @__PURE__ */ new Date();
|
|
50
50
|
const items = body?.resourceSpans?.[0]?.scopeSpans;
|
|
51
|
+
logger.debug("[Telemetry Handler] Received spans:", {
|
|
52
|
+
totalSpans: items?.reduce((acc, scope) => acc + scope.spans.length, 0) || 0,
|
|
53
|
+
timestamp: now.toISOString()
|
|
54
|
+
});
|
|
55
|
+
if (!items?.length) {
|
|
56
|
+
return {
|
|
57
|
+
status: "success",
|
|
58
|
+
message: "No spans to process",
|
|
59
|
+
traceCount: 0
|
|
60
|
+
};
|
|
61
|
+
}
|
|
51
62
|
const allSpans = items.reduce((acc, scopedSpans) => {
|
|
52
63
|
const { scope, spans } = scopedSpans;
|
|
53
64
|
for (const span of spans) {
|
|
@@ -94,8 +105,7 @@ async function storeTelemetryHandler({ mastra, body }) {
|
|
|
94
105
|
}
|
|
95
106
|
return acc;
|
|
96
107
|
}, []);
|
|
97
|
-
return storage.
|
|
98
|
-
tableName: TABLE_TRACES,
|
|
108
|
+
return storage.__batchTraceInsert({
|
|
99
109
|
records: allSpans
|
|
100
110
|
}).then(() => {
|
|
101
111
|
return {
|
|
@@ -72,7 +72,7 @@ async function getAgentByIdHandler({ mastra, agentId }) {
|
|
|
72
72
|
async function getEvalsByAgentIdHandler({ mastra, agentId }) {
|
|
73
73
|
try {
|
|
74
74
|
const agent = mastra.getAgent(agentId);
|
|
75
|
-
const evals = await mastra.getStorage()?.
|
|
75
|
+
const evals = await mastra.getStorage()?.__getEvalsByAgentName?.(agent.name, "test") || [];
|
|
76
76
|
return {
|
|
77
77
|
id: agentId,
|
|
78
78
|
name: agent.name,
|
|
@@ -86,7 +86,7 @@ async function getEvalsByAgentIdHandler({ mastra, agentId }) {
|
|
|
86
86
|
async function getLiveEvalsByAgentIdHandler({ mastra, agentId }) {
|
|
87
87
|
try {
|
|
88
88
|
const agent = mastra.getAgent(agentId);
|
|
89
|
-
const evals = await mastra.getStorage()?.
|
|
89
|
+
const evals = await mastra.getStorage()?.__getEvalsByAgentName?.(agent.name, "live") || [];
|
|
90
90
|
return {
|
|
91
91
|
id: agentId,
|
|
92
92
|
name: agent.name,
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkGV52BII2_cjs = require('../../chunk-GV52BII2.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "generateHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkGV52BII2_cjs.generateHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "getAgentByIdHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkGV52BII2_cjs.getAgentByIdHandler; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getAgentsHandler", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkGV52BII2_cjs.getAgentsHandler; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getEvalsByAgentIdHandler", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkGV52BII2_cjs.getEvalsByAgentIdHandler; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "getLiveEvalsByAgentIdHandler", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkGV52BII2_cjs.getLiveEvalsByAgentIdHandler; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "streamGenerateHandler", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkGV52BII2_cjs.streamGenerateHandler; }
|
|
30
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { generateHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, streamGenerateHandler } from '../../chunk-
|
|
1
|
+
export { generateHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, streamGenerateHandler } from '../../chunk-BMA2ORRT.js';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCWSDZEZG_cjs = require('../../chunk-CWSDZEZG.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "getTelemetryHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkCWSDZEZG_cjs.getTelemetryHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "storeTelemetryHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkCWSDZEZG_cjs.storeTelemetryHandler; }
|
|
14
14
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getTelemetryHandler, storeTelemetryHandler } from '../../chunk-
|
|
1
|
+
export { getTelemetryHandler, storeTelemetryHandler } from '../../chunk-DVPP5S6I.js';
|
package/dist/server/handlers.cjs
CHANGED
|
@@ -4,11 +4,11 @@ var chunk4C3EPMMF_cjs = require('../chunk-4C3EPMMF.cjs');
|
|
|
4
4
|
var chunkM56ECCHK_cjs = require('../chunk-M56ECCHK.cjs');
|
|
5
5
|
var chunkA7DF4ETD_cjs = require('../chunk-A7DF4ETD.cjs');
|
|
6
6
|
var chunkX37I6GZT_cjs = require('../chunk-X37I6GZT.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunkGV52BII2_cjs = require('../chunk-GV52BII2.cjs');
|
|
8
8
|
var chunkVB7KH62D_cjs = require('../chunk-VB7KH62D.cjs');
|
|
9
9
|
var chunk2FJURXCL_cjs = require('../chunk-2FJURXCL.cjs');
|
|
10
10
|
var chunk5JOF627H_cjs = require('../chunk-5JOF627H.cjs');
|
|
11
|
-
var
|
|
11
|
+
var chunkCWSDZEZG_cjs = require('../chunk-CWSDZEZG.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -30,7 +30,7 @@ Object.defineProperty(exports, "workflows", {
|
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "agents", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkGV52BII2_cjs.agents_exports; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "logs", {
|
|
36
36
|
enumerable: true,
|
|
@@ -46,5 +46,5 @@ Object.defineProperty(exports, "network", {
|
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "telemetry", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkCWSDZEZG_cjs.telemetry_exports; }
|
|
50
50
|
});
|
package/dist/server/handlers.js
CHANGED
|
@@ -2,8 +2,8 @@ export { tools_exports as tools } from '../chunk-YNSGUC2O.js';
|
|
|
2
2
|
export { vector_exports as vector } from '../chunk-4JINXASC.js';
|
|
3
3
|
export { voice_exports as voice } from '../chunk-3RVHWGWO.js';
|
|
4
4
|
export { workflows_exports as workflows } from '../chunk-ILW7XYNJ.js';
|
|
5
|
-
export { agents_exports as agents } from '../chunk-
|
|
5
|
+
export { agents_exports as agents } from '../chunk-BMA2ORRT.js';
|
|
6
6
|
export { logs_exports as logs } from '../chunk-2JQC6JWP.js';
|
|
7
7
|
export { memory_exports as memory } from '../chunk-RBQASTUP.js';
|
|
8
8
|
export { network_exports as network } from '../chunk-2YONKUWB.js';
|
|
9
|
-
export { telemetry_exports as telemetry } from '../chunk-
|
|
9
|
+
export { telemetry_exports as telemetry } from '../chunk-DVPP5S6I.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/server",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"license": "ISC",
|
|
47
47
|
"dependencies": {},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@mastra/core": "^0.8.0-alpha.
|
|
49
|
+
"@mastra/core": "^0.8.0-alpha.7"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@ai-sdk/openai": "^1.3.2",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"typescript": "^5.8.2",
|
|
59
59
|
"vitest": "^2.1.9",
|
|
60
60
|
"zod-to-json-schema": "^3.24.3",
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
61
|
+
"@mastra/core": "0.8.0-alpha.7",
|
|
62
|
+
"@internal/lint": "0.0.1"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"build": "tsup src/index.ts src/server/handlers.ts src/server/handlers/*.ts !src/server/handlers/*.test.ts --format esm,cjs --clean --experimental-dts --treeshake=smallest --splitting",
|