@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.
- package/LICENSE +202 -0
- package/index.ts +17 -2
- package/package.json +15 -10
- package/src/react/chat-approvals.ts +92 -0
- package/src/react/chat-composer.tsx +419 -0
- package/src/react/chat-feedback.ts +60 -0
- package/src/react/chat-history.ts +141 -0
- package/src/react/chat-sessions.ts +76 -0
- package/src/react/chat-stream-reducer.ts +241 -0
- package/src/react/chat-stream.ts +117 -0
- package/src/react/chat-thread-layout.tsx +214 -0
- package/src/react/chat-transcript.tsx +309 -0
- package/src/react/chat-view.tsx +69 -964
- package/src/react/mastra-chat.tsx +48 -587
- package/src/support/mastra-stream.ts +4 -8
|
@@ -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
|
-
|
|
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
|
|
46
|
-
|
|
41
|
+
const chunk = MastraStreamChunkSchema.parse(json.parse(data));
|
|
42
|
+
await options.onChunk(chunk);
|
|
47
43
|
}
|
|
48
44
|
}
|
|
49
45
|
} finally {
|