@dbx-tools/ui-mastra 0.6.210 → 0.6.212

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.
@@ -1,11 +1,7 @@
1
1
  import { json } from "@dbx-tools/shared-core";
2
+ import { MastraStreamChunkSchema, type MastraStreamChunk } from "@dbx-tools/shared-mastra";
2
3
 
3
- /** One chunk from a Mastra agent SSE stream (`data: { type, payload, ... }`). */
4
- export interface MastraStreamChunk {
5
- type: string;
6
- payload?: unknown;
7
- runId?: string;
8
- }
4
+ export type { MastraStreamChunk } from "@dbx-tools/shared-mastra";
9
5
 
10
6
  /** Response from agent streaming endpoints with {@link processMastraStream}. */
11
7
  export type MastraStreamResponse = Response & {
@@ -42,8 +38,8 @@ export async function processMastraStream(options: {
42
38
  if (!line.startsWith("data: ")) continue;
43
39
  const data = line.slice(6);
44
40
  if (data === "[DONE]") return;
45
- const chunk = json.parse<MastraStreamChunk>(data);
46
- if (chunk) await options.onChunk(chunk);
41
+ const chunk = MastraStreamChunkSchema.parse(json.parse(data));
42
+ await options.onChunk(chunk);
47
43
  }
48
44
  }
49
45
  } finally {