@mastra/react 0.0.0-monorepo-binary-20251013210052 → 0.0.0-new-button-export-20251219130424

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/dist/react.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! tailwindcss v4.1.14 | MIT License | https://tailwindcss.com */
1
+ /*! tailwindcss v4.1.17 | 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 {
@@ -2,18 +2,21 @@ import { ModelSettings } from './types';
2
2
  import { UIMessage } from '@ai-sdk/react';
3
3
  import { MastraUIMessage } from '../lib/ai-sdk';
4
4
  import { CoreUserMessage } from '@mastra/core/llm';
5
- import { RuntimeContext } from '@mastra/core/runtime-context';
5
+ import { RequestContext } from '@mastra/core/request-context';
6
6
  import { ChunkType, NetworkChunkType } from '@mastra/core/stream';
7
+ import { TracingOptions } from '@mastra/core/observability';
7
8
  export interface MastraChatProps {
8
9
  agentId: string;
10
+ resourceId?: string;
9
11
  initializeMessages?: () => MastraUIMessage[];
10
12
  }
11
13
  interface SharedArgs {
12
14
  coreUserMessages: CoreUserMessage[];
13
- runtimeContext?: RuntimeContext;
15
+ requestContext?: RequestContext;
14
16
  threadId?: string;
15
17
  modelSettings?: ModelSettings;
16
18
  signal?: AbortSignal;
19
+ tracingOptions?: TracingOptions;
17
20
  }
18
21
  export type SendMessageArgs = {
19
22
  message: string;
@@ -36,11 +39,18 @@ export type StreamArgs = SharedArgs & {
36
39
  export type NetworkArgs = SharedArgs & {
37
40
  onNetworkChunk?: (chunk: NetworkChunkType) => Promise<void>;
38
41
  };
39
- export declare const useChat: ({ agentId, initializeMessages }: MastraChatProps) => {
42
+ export declare const useChat: ({ agentId, resourceId, initializeMessages }: MastraChatProps) => {
40
43
  setMessages: import('react').Dispatch<import('react').SetStateAction<MastraUIMessage[]>>;
41
44
  sendMessage: ({ mode, ...args }: SendMessageArgs) => Promise<void>;
42
45
  isRunning: boolean;
43
46
  messages: MastraUIMessage[];
47
+ approveToolCall: (toolCallId: string) => Promise<void>;
48
+ declineToolCall: (toolCallId: string) => Promise<void>;
44
49
  cancelRun: () => void;
50
+ toolCallApprovals: {
51
+ [toolCallId: string]: {
52
+ status: "approved" | "declined";
53
+ };
54
+ };
45
55
  };
46
56
  export {};
@@ -12,4 +12,5 @@ export interface ModelSettings {
12
12
  chatWithGenerate?: boolean;
13
13
  chatWithStream?: boolean;
14
14
  chatWithNetwork?: boolean;
15
+ requireToolApproval?: boolean;
15
16
  }
@@ -1,3 +1,4 @@
1
1
  export * from './types';
2
2
  export * from './utils/toUIMessage';
3
3
  export * from './utils/toAssistantUIMessage';
4
+ export { resolveToChildMessages } from './memory/resolveInitialMessages';
@@ -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 {};
@@ -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;
@@ -1,10 +1,39 @@
1
1
  import { UIMessage } from '@ai-sdk/react';
2
+ import { CompleteAttachment } from '@assistant-ui/react';
3
+ /**
4
+ * Tripwire metadata included when a processor triggers a tripwire
5
+ */
6
+ export type TripwireMetadata = {
7
+ /** Whether the agent should retry with feedback */
8
+ retry?: boolean;
9
+ /** Custom metadata from the processor */
10
+ tripwirePayload?: unknown;
11
+ /** ID of the processor that triggered the tripwire */
12
+ processorId?: string;
13
+ };
2
14
  export type MastraUIMessageMetadata = {
3
- status?: 'warning' | 'error';
15
+ status?: 'warning' | 'error' | 'tripwire';
16
+ /** Tripwire-specific metadata when status is 'tripwire' */
17
+ tripwire?: TripwireMetadata;
4
18
  } & ({
5
19
  mode: 'generate';
6
20
  } | {
7
21
  mode: 'stream';
22
+ requireApprovalMetadata?: {
23
+ [toolName: string]: {
24
+ toolCallId: string;
25
+ toolName: string;
26
+ args: Record<string, any>;
27
+ };
28
+ };
29
+ suspendedTools?: {
30
+ [toolName: string]: {
31
+ toolCallId: string;
32
+ toolName: string;
33
+ args: Record<string, any>;
34
+ suspendPayload: any;
35
+ };
36
+ };
8
37
  } | {
9
38
  mode: 'network';
10
39
  from?: 'AGENT' | 'WORKFLOW';
@@ -12,3 +41,12 @@ export type MastraUIMessageMetadata = {
12
41
  agentInput?: string | object | Array<object>;
13
42
  });
14
43
  export type MastraUIMessage = UIMessage<MastraUIMessageMetadata, any, any>;
44
+ /**
45
+ * Extended type for MastraUIMessage that may include additional properties
46
+ * from different sources (generate, toUIMessage, toNetworkUIMessage)
47
+ */
48
+ export type ExtendedMastraUIMessage = MastraUIMessage & {
49
+ createdAt?: Date;
50
+ metadata?: Record<string, unknown>;
51
+ experimental_attachments?: readonly CompleteAttachment[];
52
+ };
@@ -0,0 +1,10 @@
1
+ import { CoreUserMessage } from '@mastra/core/llm';
2
+ import { MastraUIMessage } from '../types';
3
+ /**
4
+ * Converts a CoreUserMessage to a MastraUIMessage (UIMessage format).
5
+ *
6
+ * Handles all CoreUserMessage content types:
7
+ * - String content → single text part
8
+ * - Array content with text/image/file parts → corresponding UIMessage parts
9
+ */
10
+ export declare const fromCoreUserMessageToUIMessage: (coreUserMessage: CoreUserMessage) => MastraUIMessage;
@@ -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-monorepo-binary-20251013210052",
3
+ "version": "0.0.0-new-button-export-20251219130424",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/mastra-ai/mastra.git",
@@ -33,40 +33,49 @@
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-monorepo-binary-20251013210052"
42
+ "@mastra/client-js": "0.0.0-new-button-export-20251219130424"
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",
47
- "@assistant-ui/react": "^0.10.45",
48
- "@storybook/react-vite": "^9.1.10",
49
- "@tailwindcss/vite": "^4.1.13",
50
+ "@assistant-ui/react": "^0.11.47",
51
+ "@storybook/react-vite": "^9.1.16",
52
+ "@tailwindcss/vite": "^4.1.17",
50
53
  "@types/react": "^19.1.13",
51
54
  "@types/react-dom": "^19.1.9",
52
- "@vitejs/plugin-react": "^5.0.3",
53
- "@vitest/ui": "^3.2.4",
54
- "eslint": "^9.36.0",
55
- "eslint-plugin-storybook": "^9.1.10",
55
+ "@vitejs/plugin-react": "^5.0.4",
56
+ "@vitest/coverage-v8": "4.0.12",
57
+ "@vitest/ui": "4.0.12",
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.7",
66
+ "vite": "^7.1.9",
61
67
  "vite-plugin-dts": "^4.5.4",
62
- "vitest": "^3.2.4",
63
- "@mastra/core": "0.0.0-monorepo-binary-20251013210052"
68
+ "vitest": "4.0.12",
69
+ "@mastra/core": "0.0.0-new-button-export-20251219130424"
64
70
  },
65
71
  "eslintConfig": {
66
72
  "extends": [
67
73
  "plugin:storybook/recommended"
68
74
  ]
69
75
  },
76
+ "engines": {
77
+ "node": ">=22.13.0"
78
+ },
70
79
  "scripts": {
71
80
  "build": "vite build",
72
81
  "dev": "vite build --watch",