@mastra/react 0.1.0-beta.13 → 0.1.0-beta.15

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,81 @@
1
1
  # @mastra/react-hooks
2
2
 
3
+ ## 0.1.0-beta.15
4
+
5
+ ### Minor Changes
6
+
7
+ - Unified observability schema with entity-based span identification ([#11132](https://github.com/mastra-ai/mastra/pull/11132))
8
+
9
+ ## What changed
10
+
11
+ Spans now use a unified identification model with `entityId`, `entityType`, and `entityName` instead of separate `agentId`, `toolId`, `workflowId` fields.
12
+
13
+ **Before:**
14
+
15
+ ```typescript
16
+ // Old span structure
17
+ span.agentId; // 'my-agent'
18
+ span.toolId; // undefined
19
+ span.workflowId; // undefined
20
+ ```
21
+
22
+ **After:**
23
+
24
+ ```typescript
25
+ // New span structure
26
+ span.entityType; // EntityType.AGENT
27
+ span.entityId; // 'my-agent'
28
+ span.entityName; // 'My Agent'
29
+ ```
30
+
31
+ ## New `listTraces()` API
32
+
33
+ Query traces with filtering, pagination, and sorting:
34
+
35
+ ```typescript
36
+ const { spans, pagination } = await storage.listTraces({
37
+ filters: {
38
+ entityType: EntityType.AGENT,
39
+ entityId: 'my-agent',
40
+ userId: 'user-123',
41
+ environment: 'production',
42
+ status: TraceStatus.SUCCESS,
43
+ startedAt: { start: new Date('2024-01-01'), end: new Date('2024-01-31') },
44
+ },
45
+ pagination: { page: 0, perPage: 50 },
46
+ orderBy: { field: 'startedAt', direction: 'DESC' },
47
+ });
48
+ ```
49
+
50
+ **Available filters:** date ranges (`startedAt`, `endedAt`), entity (`entityType`, `entityId`, `entityName`), identity (`userId`, `organizationId`), correlation IDs (`runId`, `sessionId`, `threadId`), deployment (`environment`, `source`, `serviceName`), `tags`, `metadata`, and `status`.
51
+
52
+ ## New retrieval methods
53
+ - `getSpan({ traceId, spanId })` - Get a single span
54
+ - `getRootSpan({ traceId })` - Get the root span of a trace
55
+ - `getTrace({ traceId })` - Get all spans for a trace
56
+
57
+ ## Backward compatibility
58
+
59
+ The legacy `getTraces()` method continues to work. When you pass `name: "agent run: my-agent"`, it automatically transforms to `entityId: "my-agent", entityType: AGENT`.
60
+
61
+ ## Migration
62
+
63
+ **Automatic:** SQL-based stores (PostgreSQL, LibSQL, MSSQL) automatically add new columns to existing `spans` tables on initialization. Existing data is preserved with new columns set to `NULL`.
64
+
65
+ **No action required:** Your existing code continues to work. Adopt the new fields and `listTraces()` API at your convenience.
66
+
67
+ ### Patch Changes
68
+
69
+ - Updated dependencies [[`d90ea65`](https://github.com/mastra-ai/mastra/commit/d90ea6536f7aa51c6545a4e9215b55858e98e16d), [`d171e55`](https://github.com/mastra-ai/mastra/commit/d171e559ead9f52ec728d424844c8f7b164c4510), [`632fdb8`](https://github.com/mastra-ai/mastra/commit/632fdb8b3cd9ff6f90399256d526db439fc1758b), [`184f01d`](https://github.com/mastra-ai/mastra/commit/184f01d1f534ec0be9703d3996f2e088b4a560eb)]:
70
+ - @mastra/client-js@1.0.0-beta.15
71
+
72
+ ## 0.1.0-beta.14
73
+
74
+ ### Patch Changes
75
+
76
+ - Updated dependencies [[`66741d1`](https://github.com/mastra-ai/mastra/commit/66741d1a99c4f42cf23a16109939e8348ac6852e), [`a7ce182`](https://github.com/mastra-ai/mastra/commit/a7ce1822a8785ce45d62dd5c911af465e144f7d7)]:
77
+ - @mastra/client-js@1.0.0-beta.14
78
+
3
79
  ## 0.1.0-beta.13
4
80
 
5
81
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -156,7 +156,7 @@ const toUIMessage = ({ chunk, conversation, metadata }) => {
156
156
  }
157
157
  case "start": {
158
158
  const newMessage = {
159
- id: `start-${chunk.runId + Date.now()}`,
159
+ id: typeof chunk.payload.messageId === "string" ? chunk.payload.messageId : `start-${chunk.runId + Date.now()}`,
160
160
  role: "assistant",
161
161
  parts: [],
162
162
  metadata