@mastra/deployer 0.1.0-alpha.52 → 0.1.0-alpha.54

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 CHANGED
@@ -1,5 +1,27 @@
1
1
  # @mastra/deployer
2
2
 
3
+ ## 0.1.0-alpha.54
4
+
5
+ ### Patch Changes
6
+
7
+ - 5fdc87c: Update evals storage in attachListeners
8
+ - b97ca96: Tracing into default storage
9
+ - 6780223: fix workflow runId not unique per execution in dev
10
+ - 72d1990: Updated evals table schema
11
+ - Updated dependencies [5fdc87c]
12
+ - Updated dependencies [b97ca96]
13
+ - Updated dependencies [72d1990]
14
+ - Updated dependencies [cf6d825]
15
+ - Updated dependencies [10870bc]
16
+ - @mastra/core@0.2.0-alpha.104
17
+
18
+ ## 0.1.0-alpha.53
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [4534e77]
23
+ - @mastra/core@0.2.0-alpha.103
24
+
3
25
  ## 0.1.0-alpha.52
4
26
 
5
27
  ### Patch Changes
@@ -243,6 +243,8 @@ export declare function getMemoryStatusHandler(c: Context): Promise<Response>;
243
243
 
244
244
  export declare function getMessagesHandler(c: Context): Promise<Response>;
245
245
 
246
+ export declare function getTelemetryHandler(c: Context): Promise<Response>;
247
+
246
248
  export declare function getThreadByIdHandler(c: Context): Promise<Response>;
247
249
 
248
250
  export declare function getThreadsHandler(c: Context): Promise<Response>;
@@ -3162,6 +3162,36 @@ async function getMessagesHandler(c2) {
3162
3162
  async function rootHandler(c2) {
3163
3163
  return c2.text("Hello to the Mastra API!");
3164
3164
  }
3165
+ async function getTelemetryHandler(c2) {
3166
+ try {
3167
+ const mastra = c2.get("mastra");
3168
+ const telemetry = mastra.telemetry;
3169
+ const storage = mastra.storage;
3170
+ const { name, scope, page, perPage, attribute } = c2.req.query();
3171
+ if (!telemetry) {
3172
+ throw new HTTPException(400, { message: "Telemetry is not initialized" });
3173
+ }
3174
+ if (!storage) {
3175
+ throw new HTTPException(400, { message: "Storage is not initialized" });
3176
+ }
3177
+ const attributes = attribute ? Object.fromEntries(
3178
+ (Array.isArray(attribute) ? attribute : [attribute]).map((attr) => {
3179
+ const [key, value] = attr.split(":");
3180
+ return [key, value];
3181
+ })
3182
+ ) : void 0;
3183
+ const traces = await storage.getTraces({
3184
+ name,
3185
+ scope,
3186
+ page: Number(page ?? 0),
3187
+ perPage: Number(perPage ?? 100),
3188
+ attributes
3189
+ });
3190
+ return c2.json({ traces });
3191
+ } catch (error) {
3192
+ return handleError(error, "Error saving messages");
3193
+ }
3194
+ }
3165
3195
  async function getToolsHandler(c2) {
3166
3196
  try {
3167
3197
  const tools = c2.get("tools");
@@ -3386,7 +3416,8 @@ async function executeWorkflowHandler(c2) {
3386
3416
  const workflowId = c2.req.param("workflowId");
3387
3417
  const workflow = mastra.getWorkflow(workflowId);
3388
3418
  const body = await c2.req.json();
3389
- const result = await workflow.execute({
3419
+ const { start } = workflow.createRun();
3420
+ const result = await start({
3390
3421
  triggerData: body
3391
3422
  });
3392
3423
  return c2.json(result);
@@ -4064,6 +4095,19 @@ async function createHonoServer(mastra, options = {}) {
4064
4095
  }),
4065
4096
  saveMessagesHandler
4066
4097
  );
4098
+ app.get(
4099
+ "/api/telemetry",
4100
+ n({
4101
+ description: "Get all traces",
4102
+ tags: ["telemetry"],
4103
+ responses: {
4104
+ 200: {
4105
+ description: "List of all traces (paged)"
4106
+ }
4107
+ }
4108
+ }),
4109
+ getTelemetryHandler
4110
+ );
4067
4111
  app.get(
4068
4112
  "/api/workflows",
4069
4113
  n({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer",
3
- "version": "0.1.0-alpha.52",
3
+ "version": "0.1.0-alpha.54",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -52,7 +52,7 @@
52
52
  "rollup-plugin-esbuild": "^6.1.1",
53
53
  "rollup-plugin-node-externals": "^8.0.0",
54
54
  "zod": "^3.24.1",
55
- "@mastra/core": "^0.2.0-alpha.102"
55
+ "@mastra/core": "^0.2.0-alpha.104"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@hono/node-server": "^1.13.7",
@@ -4,7 +4,6 @@ import type { Context } from 'hono';
4
4
  import { stringify } from 'superjson';
5
5
  import zodToJsonSchema from 'zod-to-json-schema';
6
6
 
7
- import { readFile } from 'fs/promises';
8
7
  import { HTTPException } from 'hono/http-exception';
9
8
 
10
9
  import { handleError } from './error';
@@ -77,7 +76,7 @@ export async function getAgentByIdHandler(c: Context) {
77
76
 
78
77
  export async function getEvalsByAgentIdHandler(c: Context) {
79
78
  try {
80
- const mastra = c.get('mastra');
79
+ const mastra: Mastra = c.get('mastra');
81
80
  const agentId = c.req.param('agentId');
82
81
  const agent = mastra.getAgent(agentId);
83
82
  const evals: EvalRow[] = (await mastra.storage?.getEvalsByAgentName?.(agent.name, 'test')) || [];
@@ -94,7 +93,7 @@ export async function getEvalsByAgentIdHandler(c: Context) {
94
93
 
95
94
  export async function getLiveEvalsByAgentIdHandler(c: Context) {
96
95
  try {
97
- const mastra = c.get('mastra');
96
+ const mastra: Mastra = c.get('mastra');
98
97
  const agentId = c.req.param('agentId');
99
98
  const agent = mastra.getAgent(agentId);
100
99
  const evals: EvalRow[] = (await mastra.storage?.getEvalsByAgentName?.(agent.name, 'live')) || [];
@@ -0,0 +1,47 @@
1
+ import type { MastraStorage } from '@mastra/core/storage';
2
+ import type { Telemetry } from '@mastra/core/telemetry';
3
+ import type { Context } from 'hono';
4
+
5
+ import { HTTPException } from 'hono/http-exception';
6
+
7
+ import { handleError } from './error';
8
+
9
+ export async function getTelemetryHandler(c: Context) {
10
+ try {
11
+ const mastra = c.get('mastra');
12
+ const telemetry: Telemetry = mastra.telemetry;
13
+ const storage: MastraStorage = mastra.storage;
14
+
15
+ const { name, scope, page, perPage, attribute } = c.req.query();
16
+
17
+ if (!telemetry) {
18
+ throw new HTTPException(400, { message: 'Telemetry is not initialized' });
19
+ }
20
+
21
+ if (!storage) {
22
+ throw new HTTPException(400, { message: 'Storage is not initialized' });
23
+ }
24
+
25
+ // Parse attribute query parameter if present
26
+ const attributes = attribute
27
+ ? Object.fromEntries(
28
+ (Array.isArray(attribute) ? attribute : [attribute]).map(attr => {
29
+ const [key, value] = attr.split(':');
30
+ return [key, value];
31
+ }),
32
+ )
33
+ : undefined;
34
+
35
+ const traces = await storage.getTraces({
36
+ name,
37
+ scope,
38
+ page: Number(page ?? 0),
39
+ perPage: Number(perPage ?? 100),
40
+ attributes,
41
+ });
42
+
43
+ return c.json({ traces });
44
+ } catch (error) {
45
+ return handleError(error, 'Error saving messages');
46
+ }
47
+ }
@@ -53,7 +53,9 @@ export async function executeWorkflowHandler(c: Context) {
53
53
  const workflow = mastra.getWorkflow(workflowId);
54
54
  const body = await c.req.json();
55
55
 
56
- const result = await workflow.execute({
56
+ const { start } = workflow.createRun();
57
+
58
+ const result = await start({
57
59
  triggerData: body,
58
60
  });
59
61
  return c.json(result);
@@ -34,6 +34,7 @@ import {
34
34
  updateThreadHandler,
35
35
  } from './handlers/memory.js';
36
36
  import { rootHandler } from './handlers/root.js';
37
+ import { getTelemetryHandler } from './handlers/telemetry.js';
37
38
  import { executeAgentToolHandler, executeToolHandler, getToolByIdHandler, getToolsHandler } from './handlers/tools.js';
38
39
  import {
39
40
  upsertVectors,
@@ -653,6 +654,21 @@ export async function createHonoServer(
653
654
  saveMessagesHandler,
654
655
  );
655
656
 
657
+ // Telemetry routes
658
+ app.get(
659
+ '/api/telemetry',
660
+ describeRoute({
661
+ description: 'Get all traces',
662
+ tags: ['telemetry'],
663
+ responses: {
664
+ 200: {
665
+ description: 'List of all traces (paged)',
666
+ },
667
+ },
668
+ }),
669
+ getTelemetryHandler,
670
+ );
671
+
656
672
  // Workflow routes
657
673
  app.get(
658
674
  '/api/workflows',