@mastra/react 0.0.0-monorepo-binary-20251013210052 → 0.0.0-partial-response-backport-20251204204441
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 +347 -2
- package/dist/index.cjs +439 -122
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +440 -124
- package/dist/index.js.map +1 -1
- package/dist/react.css +1 -1
- package/dist/src/agent/hooks.d.ts +9 -1
- package/dist/src/agent/types.d.ts +1 -0
- package/dist/src/lib/ai-sdk/index.d.ts +1 -0
- package/dist/src/lib/ai-sdk/memory/resolveInitialMessages.d.ts +10 -0
- package/dist/src/lib/ai-sdk/memory/resolveInitialMessages.test.d.ts +1 -0
- package/dist/src/lib/ai-sdk/transformers/AISdkNetworkTransformer.d.ts +1 -0
- package/dist/src/lib/ai-sdk/transformers/AISdkNetworkTransformer.test.d.ts +1 -0
- package/dist/src/lib/ai-sdk/types.d.ts +17 -0
- package/dist/src/lib/ai-sdk/utils/toUIMessage.test.d.ts +1 -0
- package/package.json +22 -9
package/dist/react.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! tailwindcss v4.1.
|
|
1
|
+
/*! tailwindcss v4.1.15 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties {
|
|
3
3
|
@supports (((-webkit-hyphens: none)) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color: rgb(from red r g b)))) {
|
|
4
4
|
*, :before, :after, ::backdrop {
|
|
@@ -6,6 +6,7 @@ import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
|
6
6
|
import { ChunkType, NetworkChunkType } from '@mastra/core/stream';
|
|
7
7
|
export interface MastraChatProps {
|
|
8
8
|
agentId: string;
|
|
9
|
+
resourceId?: string;
|
|
9
10
|
initializeMessages?: () => MastraUIMessage[];
|
|
10
11
|
}
|
|
11
12
|
interface SharedArgs {
|
|
@@ -36,11 +37,18 @@ export type StreamArgs = SharedArgs & {
|
|
|
36
37
|
export type NetworkArgs = SharedArgs & {
|
|
37
38
|
onNetworkChunk?: (chunk: NetworkChunkType) => Promise<void>;
|
|
38
39
|
};
|
|
39
|
-
export declare const useChat: ({ agentId, initializeMessages }: MastraChatProps) => {
|
|
40
|
+
export declare const useChat: ({ agentId, resourceId, initializeMessages }: MastraChatProps) => {
|
|
40
41
|
setMessages: import('react').Dispatch<import('react').SetStateAction<MastraUIMessage[]>>;
|
|
41
42
|
sendMessage: ({ mode, ...args }: SendMessageArgs) => Promise<void>;
|
|
42
43
|
isRunning: boolean;
|
|
43
44
|
messages: MastraUIMessage[];
|
|
45
|
+
approveToolCall: (toolCallId: string) => Promise<void>;
|
|
46
|
+
declineToolCall: (toolCallId: string) => Promise<void>;
|
|
44
47
|
cancelRun: () => void;
|
|
48
|
+
toolCallApprovals: {
|
|
49
|
+
[toolCallId: string]: {
|
|
50
|
+
status: "approved" | "declined";
|
|
51
|
+
};
|
|
52
|
+
};
|
|
45
53
|
};
|
|
46
54
|
export {};
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import { MastraUIMessage } from '../types';
|
|
2
|
+
interface ChildMessage {
|
|
3
|
+
type: 'tool' | 'text';
|
|
4
|
+
toolCallId?: string;
|
|
5
|
+
toolName?: string;
|
|
6
|
+
args?: Record<string, unknown>;
|
|
7
|
+
toolOutput?: Record<string, unknown>;
|
|
8
|
+
content?: string;
|
|
9
|
+
}
|
|
2
10
|
export declare const resolveInitialMessages: (messages: MastraUIMessage[]) => MastraUIMessage[];
|
|
11
|
+
export declare const resolveToChildMessages: (messages: MastraUIMessage[]) => ChildMessage[];
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,6 +3,7 @@ import { Transformer, TransformerArgs } from './types';
|
|
|
3
3
|
import { MastraUIMessage } from '../types';
|
|
4
4
|
export declare class AISdkNetworkTransformer implements Transformer<NetworkChunkType> {
|
|
5
5
|
transform({ chunk, conversation, metadata }: TransformerArgs<NetworkChunkType>): MastraUIMessage[];
|
|
6
|
+
private handleRoutingAgentConversation;
|
|
6
7
|
private handleAgentConversation;
|
|
7
8
|
private handleWorkflowConversation;
|
|
8
9
|
private handleToolConversation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { UIMessage } from '@ai-sdk/react';
|
|
2
|
+
import { CompleteAttachment } from '@assistant-ui/react';
|
|
2
3
|
export type MastraUIMessageMetadata = {
|
|
3
4
|
status?: 'warning' | 'error';
|
|
4
5
|
} & ({
|
|
5
6
|
mode: 'generate';
|
|
6
7
|
} | {
|
|
7
8
|
mode: 'stream';
|
|
9
|
+
requireApprovalMetadata?: {
|
|
10
|
+
[toolCallId: string]: {
|
|
11
|
+
toolCallId: string;
|
|
12
|
+
toolName: string;
|
|
13
|
+
args: Record<string, any>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
8
16
|
} | {
|
|
9
17
|
mode: 'network';
|
|
10
18
|
from?: 'AGENT' | 'WORKFLOW';
|
|
@@ -12,3 +20,12 @@ export type MastraUIMessageMetadata = {
|
|
|
12
20
|
agentInput?: string | object | Array<object>;
|
|
13
21
|
});
|
|
14
22
|
export type MastraUIMessage = UIMessage<MastraUIMessageMetadata, any, any>;
|
|
23
|
+
/**
|
|
24
|
+
* Extended type for MastraUIMessage that may include additional properties
|
|
25
|
+
* from different sources (generate, toUIMessage, toNetworkUIMessage)
|
|
26
|
+
*/
|
|
27
|
+
export type ExtendedMastraUIMessage = MastraUIMessage & {
|
|
28
|
+
createdAt?: Date;
|
|
29
|
+
metadata?: Record<string, unknown>;
|
|
30
|
+
experimental_attachments?: readonly CompleteAttachment[];
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/react",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-partial-response-backport-20251204204441",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/mastra-ai/mastra.git",
|
|
@@ -33,14 +33,17 @@
|
|
|
33
33
|
"CHANGELOG.md"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
+
"@lukeed/uuid": "^2.0.1",
|
|
36
37
|
"@radix-ui/react-tooltip": "^1.2.7",
|
|
37
38
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
38
39
|
"lucide-react": "^0.522.0",
|
|
39
|
-
"react": "^19.1.1",
|
|
40
|
-
"react-dom": "^19.1.1",
|
|
41
40
|
"shiki": "^1.29.2",
|
|
42
41
|
"tailwind-merge": "^3.3.1",
|
|
43
|
-
"@mastra/client-js": "0.0.0-
|
|
42
|
+
"@mastra/client-js": "0.0.0-partial-response-backport-20251204204441"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"react": ">=19.0.0",
|
|
46
|
+
"react-dom": ">=19.0.0"
|
|
44
47
|
},
|
|
45
48
|
"devDependencies": {
|
|
46
49
|
"@ai-sdk/react": "^2.0.57",
|
|
@@ -49,24 +52,34 @@
|
|
|
49
52
|
"@tailwindcss/vite": "^4.1.13",
|
|
50
53
|
"@types/react": "^19.1.13",
|
|
51
54
|
"@types/react-dom": "^19.1.9",
|
|
52
|
-
"@vitejs/plugin-react": "^5.0.
|
|
55
|
+
"@vitejs/plugin-react": "^5.0.4",
|
|
56
|
+
"@vitest/coverage-v8": "3.2.3",
|
|
53
57
|
"@vitest/ui": "^3.2.4",
|
|
54
|
-
"eslint": "^9.
|
|
55
|
-
"eslint-plugin-storybook": "^9.1.
|
|
58
|
+
"eslint": "^9.37.0",
|
|
59
|
+
"eslint-plugin-storybook": "^9.1.12",
|
|
60
|
+
"react": ">=19.0.0",
|
|
61
|
+
"react-dom": ">=19.0.0",
|
|
56
62
|
"rollup-plugin-node-externals": "^8.0.1",
|
|
57
63
|
"storybook": "^9.1.10",
|
|
58
64
|
"tailwindcss": "^4",
|
|
59
65
|
"typescript": "^5.8.3",
|
|
60
|
-
"vite": "^7.1.
|
|
66
|
+
"vite": "^7.1.9",
|
|
61
67
|
"vite-plugin-dts": "^4.5.4",
|
|
62
68
|
"vitest": "^3.2.4",
|
|
63
|
-
"@mastra/core": "0.0.0-
|
|
69
|
+
"@mastra/core": "0.0.0-partial-response-backport-20251204204441"
|
|
64
70
|
},
|
|
65
71
|
"eslintConfig": {
|
|
66
72
|
"extends": [
|
|
67
73
|
"plugin:storybook/recommended"
|
|
68
74
|
]
|
|
69
75
|
},
|
|
76
|
+
"publishConfig": {
|
|
77
|
+
"access": "public",
|
|
78
|
+
"publish-branch": [
|
|
79
|
+
"main",
|
|
80
|
+
"0.x"
|
|
81
|
+
]
|
|
82
|
+
},
|
|
70
83
|
"scripts": {
|
|
71
84
|
"build": "vite build",
|
|
72
85
|
"dev": "vite build --watch",
|