@mastra/playground-ui 6.6.2 → 6.7.0-alpha.0

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,6 +1,7 @@
1
1
  import { MastraUIMessage } from '@mastra/react';
2
2
  import { AgentMessage } from './agent-badge';
3
- interface AgentBadgeWrapperProps {
3
+ import { ToolApprovalButtonsProps } from './tool-approval-buttons';
4
+ interface AgentBadgeWrapperProps extends Omit<ToolApprovalButtonsProps, 'toolCalled'> {
4
5
  agentId: string;
5
6
  result: {
6
7
  childMessages: AgentMessage[];
@@ -9,5 +10,5 @@ interface AgentBadgeWrapperProps {
9
10
  };
10
11
  metadata?: MastraUIMessage['metadata'];
11
12
  }
12
- export declare const AgentBadgeWrapper: ({ agentId, result, metadata }: AgentBadgeWrapperProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const AgentBadgeWrapper: ({ agentId, result, metadata, toolCallId, toolApprovalMetadata, }: AgentBadgeWrapperProps) => import("react/jsx-runtime").JSX.Element;
13
14
  export {};
@@ -1,4 +1,5 @@
1
1
  import { MastraUIMessage } from '@mastra/react';
2
+ import { ToolApprovalButtonsProps } from './tool-approval-buttons';
2
3
  type TextMessage = {
3
4
  type: 'text';
4
5
  content: string;
@@ -12,10 +13,10 @@ type ToolMessage = {
12
13
  result?: any;
13
14
  };
14
15
  export type AgentMessage = TextMessage | ToolMessage;
15
- export interface AgentBadgeProps {
16
+ export interface AgentBadgeProps extends Omit<ToolApprovalButtonsProps, 'toolCalled'> {
16
17
  agentId: string;
17
18
  messages: AgentMessage[];
18
19
  metadata?: MastraUIMessage['metadata'];
19
20
  }
20
- export declare const AgentBadge: ({ agentId, messages, metadata }: AgentBadgeProps) => import("react/jsx-runtime").JSX.Element;
21
+ export declare const AgentBadge: ({ agentId, messages, metadata, toolCallId, toolApprovalMetadata }: AgentBadgeProps) => import("react/jsx-runtime").JSX.Element;
21
22
  export {};
@@ -0,0 +1,10 @@
1
+ export interface ToolApprovalButtonsProps {
2
+ toolCallId: string;
3
+ toolCalled: boolean;
4
+ toolApprovalMetadata: {
5
+ toolCallId: string;
6
+ toolName: string;
7
+ args: Record<string, any>;
8
+ } | undefined;
9
+ }
10
+ export declare const ToolApprovalButtons: ({ toolCalled, toolCallId, toolApprovalMetadata }: ToolApprovalButtonsProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,5 +1,6 @@
1
1
  import { MastraUIMessage } from '@mastra/react';
2
- export interface ToolBadgeProps {
2
+ import { ToolApprovalButtonsProps } from './tool-approval-buttons';
3
+ export interface ToolBadgeProps extends Omit<ToolApprovalButtonsProps, 'toolCalled'> {
3
4
  toolName: string;
4
5
  args: Record<string, unknown> | string;
5
6
  result: any;
@@ -8,4 +9,4 @@ export interface ToolBadgeProps {
8
9
  toolId: string;
9
10
  }>;
10
11
  }
11
- export declare const ToolBadge: ({ toolName, args, result, metadata, toolOutput }: ToolBadgeProps) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const ToolBadge: ({ toolName, args, result, metadata, toolOutput, toolCallId, toolApprovalMetadata, }: ToolBadgeProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,11 @@
1
1
  import { WorkflowRunStreamResult } from '../../../../domains/workflows/context/workflow-run-context';
2
2
  import { MastraUIMessage } from '@mastra/react';
3
- export interface WorkflowBadgeProps {
3
+ import { ToolApprovalButtonsProps } from './tool-approval-buttons';
4
+ export interface WorkflowBadgeProps extends Omit<ToolApprovalButtonsProps, 'toolCalled'> {
4
5
  workflowId: string;
5
- runId?: string;
6
+ result?: any;
6
7
  isStreaming?: boolean;
7
8
  metadata?: MastraUIMessage['metadata'];
8
9
  }
9
- export declare const WorkflowBadge: ({ runId, workflowId, isStreaming, metadata }: WorkflowBadgeProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const WorkflowBadge: ({ result, workflowId, isStreaming, metadata, toolCallId, toolApprovalMetadata, }: WorkflowBadgeProps) => import("react/jsx-runtime").JSX.Element;
10
11
  export declare const useWorkflowStream: (workflowFullState?: WorkflowRunStreamResult) => void;
@@ -0,0 +1,8 @@
1
+ export interface ToolApprovalProps {
2
+ toolCallId: string;
3
+ toolName: string;
4
+ args: any;
5
+ onApprove: () => void;
6
+ onDecline: () => void;
7
+ }
8
+ export declare const ToolApproval: ({ toolName, args, onApprove, onDecline }: ToolApprovalProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from '../../node_modules/@types/react';
2
+ interface ToolCallContextValue {
3
+ approveToolcall: (toolCallId: string) => void;
4
+ declineToolcall: (toolCallId: string) => void;
5
+ isRunning: boolean;
6
+ toolCallApprovals: {
7
+ [toolCallId: string]: {
8
+ status: 'approved' | 'declined';
9
+ };
10
+ };
11
+ }
12
+ interface ToolCallProviderProps {
13
+ children: ReactNode;
14
+ approveToolcall: (toolCallId: string) => void;
15
+ declineToolcall: (toolCallId: string) => void;
16
+ isRunning: boolean;
17
+ toolCallApprovals: {
18
+ [toolCallId: string]: {
19
+ status: 'approved' | 'declined';
20
+ };
21
+ };
22
+ }
23
+ export declare function ToolCallProvider({ children, approveToolcall, declineToolcall, isRunning, toolCallApprovals, }: ToolCallProviderProps): import("react/jsx-runtime").JSX.Element;
24
+ export declare function useToolCall(): ToolCallContextValue;
25
+ export {};
@@ -39,6 +39,7 @@ export interface ModelSettings {
39
39
  chatWithGenerateLegacy?: boolean;
40
40
  chatWithGenerate?: boolean;
41
41
  chatWithNetwork?: boolean;
42
+ requireToolApproval?: boolean;
42
43
  }
43
44
  export interface AgentSettingsType {
44
45
  modelSettings: ModelSettings;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mastra/playground-ui",
3
3
  "type": "module",
4
- "version": "6.6.2",
4
+ "version": "6.7.0-alpha.0",
5
5
  "description": "Mastra Playground components",
6
6
  "main": "dist/index.umd.js",
7
7
  "module": "dist/index.es.js",
@@ -101,14 +101,14 @@
101
101
  "zustand": "^5.0.8"
102
102
  },
103
103
  "peerDependencies": {
104
- "@mastra/core": ">=0.21.2-0 <0.23.0-0",
104
+ "@mastra/core": ">=0.22.1-0 <0.24.0-0",
105
105
  "lucide-react": "^0.474.0",
106
106
  "react": ">=19.0.0",
107
107
  "react-dom": ">=19.0.0",
108
108
  "tailwindcss": "^3.0.0",
109
109
  "@tanstack/react-query": "^5.81.5",
110
- "@mastra/react": "0.0.10",
111
- "@mastra/client-js": "^0.16.4"
110
+ "@mastra/client-js": "^0.16.5-alpha.0",
111
+ "@mastra/react": "0.0.11-alpha.0"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@storybook/addon-docs": "^9.1.10",
@@ -131,9 +131,9 @@
131
131
  "vite-plugin-lib-inject-css": "^2.2.2",
132
132
  "vitest": "^3.2.4",
133
133
  "@tanstack/react-query": "^5.81.5",
134
- "@mastra/client-js": "^0.16.4",
135
- "@mastra/core": "0.22.2",
136
- "@mastra/react": "0.0.10"
134
+ "@mastra/client-js": "^0.16.5-alpha.0",
135
+ "@mastra/core": "0.23.0-alpha.0",
136
+ "@mastra/react": "0.0.11-alpha.0"
137
137
  },
138
138
  "homepage": "https://mastra.ai",
139
139
  "repository": {
@@ -144,6 +144,13 @@
144
144
  "bugs": {
145
145
  "url": "https://github.com/mastra-ai/mastra/issues"
146
146
  },
147
+ "publishConfig": {
148
+ "access": "public",
149
+ "publish-branch": [
150
+ "main",
151
+ "0.x"
152
+ ]
153
+ },
147
154
  "scripts": {
148
155
  "build": "tsc && vite build",
149
156
  "dev": "vite build --watch",