@mastra/react 0.2.36-alpha.9 → 0.3.0-alpha.16
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 +66 -0
- package/dist/agent/hooks.d.ts +6 -1
- package/dist/agent/hooks.d.ts.map +1 -1
- package/dist/index.cjs +381 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +381 -68
- package/dist/index.js.map +1 -1
- package/dist/lib/ai-sdk/utils/toUIMessage.d.ts +2 -0
- package/dist/lib/ai-sdk/utils/toUIMessage.d.ts.map +1 -1
- package/dist/react.css +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
1
|
# @mastra/react
|
|
2
2
|
|
|
3
|
+
## 0.3.0-alpha.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`105e454`](https://github.com/mastra-ai/mastra/commit/105e454c95af06a7c741c15969d8f9b0f02463a7)]:
|
|
8
|
+
- @mastra/core@1.33.0-alpha.15
|
|
9
|
+
- @mastra/client-js@1.18.0-alpha.16
|
|
10
|
+
|
|
11
|
+
## 0.3.0-alpha.15
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- Added client, React, and Studio support for Agent signals in threaded chat. Threaded user messages now send through Agent signals, stream output is consumed from the thread subscription, echoed user messages are deduped by signal ID, file and image message contents are preserved, Studio can send follow-ups while a response is streaming, Studio subscribes to open threads so additional tabs can observe active streams, and the Studio stop button aborts the active thread subscription. React chat also falls back to legacy threaded streaming when it connects to a server or core version that does not support signal routes yet. ([#16338](https://github.com/mastra-ai/mastra/pull/16338))
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
const { sendMessage } = useChat({ agentId, resourceId, threadId });
|
|
19
|
+
await sendMessage({ message: 'Follow up while streaming', threadId });
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Fixed streaming chat messages so sending while an agent is running does not duplicate assistant output or leave the previous response marked as streaming. ([#16338](https://github.com/mastra-ai/mastra/pull/16338))
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [[`05dab92`](https://github.com/mastra-ai/mastra/commit/05dab92b3373306a4791c3a035a3100dd9a76b7f)]:
|
|
27
|
+
- @mastra/client-js@1.18.0-alpha.15
|
|
28
|
+
- @mastra/core@1.33.0-alpha.14
|
|
29
|
+
|
|
30
|
+
## 0.2.36-alpha.14
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [[`f984b4d`](https://github.com/mastra-ai/mastra/commit/f984b4d6c60bf2ae2a9b156f0e8c35a66fe96c91), [`ce01024`](https://github.com/mastra-ai/mastra/commit/ce010242eee9bdfc09e4c26725b9d37998679a8d), [`f984b4d`](https://github.com/mastra-ai/mastra/commit/f984b4d6c60bf2ae2a9b156f0e8c35a66fe96c91), [`8373ff4`](https://github.com/mastra-ai/mastra/commit/8373ff46745d77af79f183c4470f80fa2727a6b2), [`11c1528`](https://github.com/mastra-ai/mastra/commit/11c152848c5d0ef227184853b5040f5b41ee7b1e)]:
|
|
35
|
+
- @mastra/core@1.33.0-alpha.13
|
|
36
|
+
- @mastra/client-js@1.18.0-alpha.14
|
|
37
|
+
|
|
38
|
+
## 0.2.36-alpha.13
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [[`b59316f`](https://github.com/mastra-ai/mastra/commit/b59316ffa0f7688165b0f9c81ccdf85da461e5b2), [`55f1e2d`](https://github.com/mastra-ai/mastra/commit/55f1e2d65425b95a49ae788053b266f256e38c96), [`19a2b5e`](https://github.com/mastra-ai/mastra/commit/19a2b5eda9d93f6e1026e0c84f3c1f1c85700a9f), [`d48a705`](https://github.com/mastra-ai/mastra/commit/d48a705ff3dfbdc7a996e07ecd8293b5effd9a2a)]:
|
|
43
|
+
- @mastra/core@1.33.0-alpha.12
|
|
44
|
+
- @mastra/client-js@1.18.0-alpha.13
|
|
45
|
+
|
|
46
|
+
## 0.2.36-alpha.12
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- Updated dependencies [[`37c0dc5`](https://github.com/mastra-ai/mastra/commit/37c0dc5697d343db98628bf867bf71ce6deec6d7), [`ef6b584`](https://github.com/mastra-ai/mastra/commit/ef6b5847ac33c0a7e80af3a86e8801e2933dd3ee), [`4dd900d`](https://github.com/mastra-ai/mastra/commit/4dd900d75dfe9be89f8c15188b368a8622aa1e18), [`4ff5bdf`](https://github.com/mastra-ai/mastra/commit/4ff5bdfe170cba6dfb5260c6af0f4ba668430772), [`bbcd93c`](https://github.com/mastra-ai/mastra/commit/bbcd93cf7d8aa1007d6d84bfd033b8015c912087), [`308bd07`](https://github.com/mastra-ai/mastra/commit/308bd074f35cef0c75d82fc1eb19382fe04ecf6f)]:
|
|
51
|
+
- @mastra/core@1.33.0-alpha.11
|
|
52
|
+
- @mastra/client-js@1.18.0-alpha.12
|
|
53
|
+
|
|
54
|
+
## 0.2.36-alpha.11
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [[`7ad5585`](https://github.com/mastra-ai/mastra/commit/7ad55856406f1de398dc713f6a9eaa78b2784bb6), [`210ea7a`](https://github.com/mastra-ai/mastra/commit/210ea7af559791b73a44fc9c12179908aaa3183f), [`83218c8`](https://github.com/mastra-ai/mastra/commit/83218c88b37773c9424fbe733b37be556e55e94d), [`265ec9f`](https://github.com/mastra-ai/mastra/commit/265ec9f887b5c81255c873a76ff7796f16e4f99b), [`6ce80bf`](https://github.com/mastra-ai/mastra/commit/6ce80bf4872a891e0bddf8b80561a80584efb14b), [`9268531`](https://github.com/mastra-ai/mastra/commit/9268531e7ec4be98beeba3b3ae8be0a7ea380662), [`13ead79`](https://github.com/mastra-ai/mastra/commit/13ead79149486b88144db7e11e6ff551caef5be1), [`bd36d8e`](https://github.com/mastra-ai/mastra/commit/bd36d8eb6de8c9a0310352649dbd4b06703c2299), [`8ac9141`](https://github.com/mastra-ai/mastra/commit/8ac9141439caa8fdd674944c4d84f29b3c730296)]:
|
|
59
|
+
- @mastra/core@1.33.0-alpha.10
|
|
60
|
+
- @mastra/client-js@1.18.0-alpha.11
|
|
61
|
+
|
|
62
|
+
## 0.2.36-alpha.10
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Updated dependencies [[`e281ae5`](https://github.com/mastra-ai/mastra/commit/e281ae50e6087affc242de13f471112835bc60b4)]:
|
|
67
|
+
- @mastra/client-js@1.18.0-alpha.10
|
|
68
|
+
|
|
3
69
|
## 0.2.36-alpha.9
|
|
4
70
|
|
|
5
71
|
### Patch Changes
|
package/dist/agent/hooks.d.ts
CHANGED
|
@@ -8,9 +8,13 @@ import type { ModelSettings } from './types.js';
|
|
|
8
8
|
export interface MastraChatProps {
|
|
9
9
|
agentId: string;
|
|
10
10
|
resourceId?: string;
|
|
11
|
+
threadId?: string;
|
|
11
12
|
initialMessages?: MastraUIMessage[];
|
|
12
13
|
/** Persistent request context used for tool approval/decline calls (e.g. agentVersionId). */
|
|
13
14
|
requestContext?: RequestContext;
|
|
15
|
+
onSignalSent?: (signalId: string, preview: string) => void;
|
|
16
|
+
onSignalEcho?: (signalId: string) => void;
|
|
17
|
+
onThreadSignalsUnsupported?: () => void;
|
|
14
18
|
}
|
|
15
19
|
interface SharedArgs {
|
|
16
20
|
coreUserMessages: CoreUserMessage[];
|
|
@@ -37,11 +41,12 @@ export type GenerateArgs = SharedArgs & {
|
|
|
37
41
|
};
|
|
38
42
|
export type StreamArgs = SharedArgs & {
|
|
39
43
|
onChunk?: (chunk: ChunkType) => Promise<void>;
|
|
44
|
+
signalId?: string;
|
|
40
45
|
};
|
|
41
46
|
export type NetworkArgs = SharedArgs & {
|
|
42
47
|
onNetworkChunk?: (chunk: NetworkChunkType) => Promise<void>;
|
|
43
48
|
};
|
|
44
|
-
export declare const useChat: ({ agentId, resourceId, initialMessages, requestContext: propsRequestContext, }: MastraChatProps) => {
|
|
49
|
+
export declare const useChat: ({ agentId, resourceId, threadId, initialMessages, requestContext: propsRequestContext, onSignalSent, onSignalEcho, onThreadSignalsUnsupported, }: MastraChatProps) => {
|
|
45
50
|
setMessages: import("react").Dispatch<import("react").SetStateAction<MastraUIMessage[]>>;
|
|
46
51
|
sendMessage: ({ mode, ...args }: SendMessageArgs) => Promise<void>;
|
|
47
52
|
isRunning: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/agent/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/agent/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAO7C,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,eAAe,EAAE,CAAC;IACpC,6FAA6F;IAC7F,cAAc,CAAC,EAAE,cAAc,CAAC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