@mastra/react 0.0.0-error-handler-fix-20251020202607 → 0.0.0-esbuild-bundle-worker-20260807182016
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 +4402 -3
- package/LICENSE.md +15 -0
- package/dist/agent/extract-tasks.d.ts +10 -0
- package/dist/agent/extract-tasks.d.ts.map +1 -0
- package/dist/agent/extractRunIdFromMessages.d.ts +10 -0
- package/dist/agent/extractRunIdFromMessages.d.ts.map +1 -0
- package/dist/agent/hooks.d.ts +98 -0
- package/dist/agent/hooks.d.ts.map +1 -0
- package/dist/agent/signal-data.d.ts +5 -0
- package/dist/agent/signal-data.d.ts.map +1 -0
- package/dist/{src/agent → agent}/types.d.ts +7 -1
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/index.cjs +3314 -1506
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3243 -1444
- package/dist/index.js.map +1 -1
- package/dist/lib/mastra-db/accumulator.d.ts +48 -0
- package/dist/lib/mastra-db/accumulator.d.ts.map +1 -0
- package/dist/lib/mastra-db/formatCompletionFeedback.d.ts +19 -0
- package/dist/lib/mastra-db/formatCompletionFeedback.d.ts.map +1 -0
- package/dist/lib/mastra-db/fromCoreUserMessage.d.ts +14 -0
- package/dist/lib/mastra-db/fromCoreUserMessage.d.ts.map +1 -0
- package/dist/lib/mastra-db/index.d.ts +6 -0
- package/dist/lib/mastra-db/index.d.ts.map +1 -0
- package/dist/lib/mastra-db/types.d.ts +171 -0
- package/dist/lib/mastra-db/types.d.ts.map +1 -0
- package/dist/lib/use-mutation.d.ts +28 -0
- package/dist/lib/use-mutation.d.ts.map +1 -0
- package/dist/mastra-client-context.d.ts +26 -0
- package/dist/mastra-client-context.d.ts.map +1 -0
- package/dist/mastra-react-provider.d.ts +5 -0
- package/dist/mastra-react-provider.d.ts.map +1 -0
- package/dist/react.css +74 -267
- package/dist/{src/ui → ui}/Code/Code.d.ts +5 -3
- package/dist/ui/Code/Code.d.ts.map +1 -0
- package/dist/ui/Code/highlight.d.ts +4 -0
- package/dist/ui/Code/highlight.d.ts.map +1 -0
- package/dist/ui/Code/index.d.ts +2 -0
- package/dist/ui/Code/index.d.ts.map +1 -0
- package/dist/{src/ui → ui}/Entity/Entity.d.ts +6 -5
- package/dist/ui/Entity/Entity.d.ts.map +1 -0
- package/dist/{src/ui → ui}/Entity/Entry.d.ts +4 -3
- package/dist/ui/Entity/Entry.d.ts.map +1 -0
- package/dist/{src/ui → ui}/Entity/ToolApproval.d.ts +6 -5
- package/dist/ui/Entity/ToolApproval.d.ts.map +1 -0
- package/dist/{src/ui → ui}/Entity/context.d.ts +4 -3
- package/dist/ui/Entity/context.d.ts.map +1 -0
- package/dist/ui/Entity/index.d.ts +5 -0
- package/dist/ui/Entity/index.d.ts.map +1 -0
- package/dist/{src/ui → ui}/Entity/types.d.ts +1 -0
- package/dist/ui/Entity/types.d.ts.map +1 -0
- package/dist/{src/ui → ui}/Icon/Icon.d.ts +3 -2
- package/dist/ui/Icon/Icon.d.ts.map +1 -0
- package/dist/ui/Icon/index.d.ts +2 -0
- package/dist/ui/Icon/index.d.ts.map +1 -0
- package/dist/{src/ui → ui}/IconButton/IconButton.d.ts +3 -2
- package/dist/ui/IconButton/IconButton.d.ts.map +1 -0
- package/dist/ui/IconButton/index.d.ts +2 -0
- package/dist/ui/IconButton/index.d.ts.map +1 -0
- package/dist/ui/Icons/AgentIcon.d.ts +3 -0
- package/dist/ui/Icons/AgentIcon.d.ts.map +1 -0
- package/dist/ui/Icons/ToolsIcon.d.ts +3 -0
- package/dist/ui/Icons/ToolsIcon.d.ts.map +1 -0
- package/dist/ui/Icons/WorkflowIcon.d.ts +3 -0
- package/dist/ui/Icons/WorkflowIcon.d.ts.map +1 -0
- package/dist/ui/Icons/index.d.ts +4 -0
- package/dist/ui/Icons/index.d.ts.map +1 -0
- package/dist/{src/ui → ui}/Message/Message.d.ts +11 -10
- package/dist/ui/Message/Message.d.ts.map +1 -0
- package/dist/ui/Message/index.d.ts +2 -0
- package/dist/ui/Message/index.d.ts.map +1 -0
- package/dist/ui/MessageFactory/MessageFactory.d.ts +22 -0
- package/dist/ui/MessageFactory/MessageFactory.d.ts.map +1 -0
- package/dist/ui/MessageFactory/index.d.ts +3 -0
- package/dist/ui/MessageFactory/index.d.ts.map +1 -0
- package/dist/ui/MessageFactory/types.d.ts +181 -0
- package/dist/ui/MessageFactory/types.d.ts.map +1 -0
- package/dist/{src/ui → ui}/Tooltip/Tooltip.d.ts +5 -4
- package/dist/ui/Tooltip/Tooltip.d.ts.map +1 -0
- package/dist/ui/Tooltip/index.d.ts +2 -0
- package/dist/ui/Tooltip/index.d.ts.map +1 -0
- package/dist/ui/index.cjs +57 -0
- package/dist/ui/index.d.ts +9 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +2 -0
- package/dist/ui-Bd2cu1B9.js +497 -0
- package/dist/ui-Bd2cu1B9.js.map +1 -0
- package/dist/ui-DL8WaLmH.cjs +849 -0
- package/dist/ui-DL8WaLmH.cjs.map +1 -0
- package/dist/voice/index.d.ts +5 -0
- package/dist/voice/index.d.ts.map +1 -0
- package/dist/voice/play-stream-with-web-audio.d.ts +2 -0
- package/dist/voice/play-stream-with-web-audio.d.ts.map +1 -0
- package/dist/voice/record-mic-to-file.d.ts +2 -0
- package/dist/voice/record-mic-to-file.d.ts.map +1 -0
- package/dist/voice/use-speech-recognition.d.ts +20 -0
- package/dist/voice/use-speech-recognition.d.ts.map +1 -0
- package/dist/workflows/WorkflowStepFactory/WorkflowStepFactory.d.ts +8 -0
- package/dist/workflows/WorkflowStepFactory/WorkflowStepFactory.d.ts.map +1 -0
- package/dist/workflows/WorkflowStepFactory/index.d.ts +3 -0
- package/dist/workflows/WorkflowStepFactory/index.d.ts.map +1 -0
- package/dist/workflows/WorkflowStepFactory/types.d.ts +90 -0
- package/dist/workflows/WorkflowStepFactory/types.d.ts.map +1 -0
- package/dist/workflows/hooks.d.ts +34 -0
- package/dist/workflows/hooks.d.ts.map +1 -0
- package/dist/workflows/index.d.ts +4 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/types.d.ts +122 -0
- package/dist/workflows/types.d.ts.map +1 -0
- package/dist/workflows/use-stream-workflow.d.ts +39 -0
- package/dist/workflows/use-stream-workflow.d.ts.map +1 -0
- package/package.json +52 -30
- package/dist/src/agent/hooks.d.ts +0 -46
- package/dist/src/index.d.ts +0 -6
- package/dist/src/lib/ai-sdk/index.d.ts +0 -3
- package/dist/src/lib/ai-sdk/memory/resolveInitialMessages.d.ts +0 -2
- package/dist/src/lib/ai-sdk/transformers/AISdkNetworkTransformer.d.ts +0 -10
- package/dist/src/lib/ai-sdk/transformers/types.d.ts +0 -10
- package/dist/src/lib/ai-sdk/types.d.ts +0 -14
- package/dist/src/lib/ai-sdk/utils/toAssistantUIMessage.d.ts +0 -14
- package/dist/src/lib/ai-sdk/utils/toAssistantUIMessage.test.d.ts +0 -1
- package/dist/src/lib/ai-sdk/utils/toUIMessage.d.ts +0 -17
- package/dist/src/mastra-client-context.d.ts +0 -10
- package/dist/src/mastra-react-provider.d.ts +0 -4
- package/dist/src/ui/Code/highlight.d.ts +0 -3
- package/dist/src/ui/Code/index.d.ts +0 -1
- package/dist/src/ui/Entity/Entity.stories.d.ts +0 -22
- package/dist/src/ui/Entity/index.d.ts +0 -4
- package/dist/src/ui/Icon/index.d.ts +0 -1
- package/dist/src/ui/IconButton/IconButton.stories.d.ts +0 -12
- package/dist/src/ui/IconButton/index.d.ts +0 -1
- package/dist/src/ui/Icons/AgentIcon.d.ts +0 -2
- package/dist/src/ui/Icons/ToolsIcon.d.ts +0 -2
- package/dist/src/ui/Icons/WorkflowIcon.d.ts +0 -2
- package/dist/src/ui/Icons/index.d.ts +0 -3
- package/dist/src/ui/Message/Message.stories.d.ts +0 -13
- package/dist/src/ui/Message/index.d.ts +0 -1
- package/dist/src/ui/Tooltip/Tooltip.stories.d.ts +0 -12
- package/dist/src/ui/Tooltip/index.d.ts +0 -1
- package/dist/src/ui/index.d.ts +0 -7
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { ModelSettings } from './types';
|
|
2
|
-
import { UIMessage } from '@ai-sdk/react';
|
|
3
|
-
import { MastraUIMessage } from '../lib/ai-sdk';
|
|
4
|
-
import { CoreUserMessage } from '@mastra/core/llm';
|
|
5
|
-
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
6
|
-
import { ChunkType, NetworkChunkType } from '@mastra/core/stream';
|
|
7
|
-
export interface MastraChatProps {
|
|
8
|
-
agentId: string;
|
|
9
|
-
initializeMessages?: () => MastraUIMessage[];
|
|
10
|
-
}
|
|
11
|
-
interface SharedArgs {
|
|
12
|
-
coreUserMessages: CoreUserMessage[];
|
|
13
|
-
runtimeContext?: RuntimeContext;
|
|
14
|
-
threadId?: string;
|
|
15
|
-
modelSettings?: ModelSettings;
|
|
16
|
-
signal?: AbortSignal;
|
|
17
|
-
}
|
|
18
|
-
export type SendMessageArgs = {
|
|
19
|
-
message: string;
|
|
20
|
-
coreUserMessages?: CoreUserMessage[];
|
|
21
|
-
} & (({
|
|
22
|
-
mode: 'generate';
|
|
23
|
-
} & Omit<GenerateArgs, 'coreUserMessages'>) | ({
|
|
24
|
-
mode: 'stream';
|
|
25
|
-
} & Omit<StreamArgs, 'coreUserMessages'>) | ({
|
|
26
|
-
mode: 'network';
|
|
27
|
-
} & Omit<NetworkArgs, 'coreUserMessages'>) | ({
|
|
28
|
-
mode?: undefined;
|
|
29
|
-
} & Omit<StreamArgs, 'coreUserMessages'>));
|
|
30
|
-
export type GenerateArgs = SharedArgs & {
|
|
31
|
-
onFinish?: (messages: UIMessage[]) => Promise<void>;
|
|
32
|
-
};
|
|
33
|
-
export type StreamArgs = SharedArgs & {
|
|
34
|
-
onChunk?: (chunk: ChunkType) => Promise<void>;
|
|
35
|
-
};
|
|
36
|
-
export type NetworkArgs = SharedArgs & {
|
|
37
|
-
onNetworkChunk?: (chunk: NetworkChunkType) => Promise<void>;
|
|
38
|
-
};
|
|
39
|
-
export declare const useChat: ({ agentId, initializeMessages }: MastraChatProps) => {
|
|
40
|
-
setMessages: import('react').Dispatch<import('react').SetStateAction<MastraUIMessage[]>>;
|
|
41
|
-
sendMessage: ({ mode, ...args }: SendMessageArgs) => Promise<void>;
|
|
42
|
-
isRunning: boolean;
|
|
43
|
-
messages: MastraUIMessage[];
|
|
44
|
-
cancelRun: () => void;
|
|
45
|
-
};
|
|
46
|
-
export {};
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { NetworkChunkType } from '@mastra/core/stream';
|
|
2
|
-
import { Transformer, TransformerArgs } from './types';
|
|
3
|
-
import { MastraUIMessage } from '../types';
|
|
4
|
-
export declare class AISdkNetworkTransformer implements Transformer<NetworkChunkType> {
|
|
5
|
-
transform({ chunk, conversation, metadata }: TransformerArgs<NetworkChunkType>): MastraUIMessage[];
|
|
6
|
-
private handleRoutingAgentConversation;
|
|
7
|
-
private handleAgentConversation;
|
|
8
|
-
private handleWorkflowConversation;
|
|
9
|
-
private handleToolConversation;
|
|
10
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { NetworkChunkType } from '@mastra/core/stream';
|
|
2
|
-
import { MastraUIMessage, MastraUIMessageMetadata } from '../types';
|
|
3
|
-
export interface TransformerArgs<T> {
|
|
4
|
-
chunk: NetworkChunkType;
|
|
5
|
-
conversation: MastraUIMessage[];
|
|
6
|
-
metadata: MastraUIMessageMetadata;
|
|
7
|
-
}
|
|
8
|
-
export interface Transformer<T> {
|
|
9
|
-
transform: (args: TransformerArgs<T>) => MastraUIMessage[];
|
|
10
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { UIMessage } from '@ai-sdk/react';
|
|
2
|
-
export type MastraUIMessageMetadata = {
|
|
3
|
-
status?: 'warning' | 'error';
|
|
4
|
-
} & ({
|
|
5
|
-
mode: 'generate';
|
|
6
|
-
} | {
|
|
7
|
-
mode: 'stream';
|
|
8
|
-
} | {
|
|
9
|
-
mode: 'network';
|
|
10
|
-
from?: 'AGENT' | 'WORKFLOW';
|
|
11
|
-
selectionReason?: string;
|
|
12
|
-
agentInput?: string | object | Array<object>;
|
|
13
|
-
});
|
|
14
|
-
export type MastraUIMessage = UIMessage<MastraUIMessageMetadata, any, any>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ThreadMessageLike } from '@assistant-ui/react';
|
|
2
|
-
import { MastraUIMessage } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Converts a Mastra UIMessage (from AI SDK) to a ThreadMessageLike format compatible with @assistant-ui/react.
|
|
5
|
-
*
|
|
6
|
-
* This function handles UIMessages from three sources:
|
|
7
|
-
* - agent.generate: Full output with all message parts
|
|
8
|
-
* - toUIMessage: Streaming chunks accumulated into UIMessages
|
|
9
|
-
* - toNetworkUIMessage: Network execution events accumulated into UIMessages
|
|
10
|
-
*
|
|
11
|
-
* @param message - The MastraUIMessage to convert
|
|
12
|
-
* @returns A ThreadMessageLike compatible with @assistant-ui/react
|
|
13
|
-
*/
|
|
14
|
-
export declare const toAssistantUIMessage: (message: MastraUIMessage) => ThreadMessageLike;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ChunkType } from '@mastra/core/stream';
|
|
2
|
-
import { MastraUIMessage, MastraUIMessageMetadata } from '../types';
|
|
3
|
-
import { WorkflowStreamResult } from '@mastra/core/workflows';
|
|
4
|
-
type StreamChunk = {
|
|
5
|
-
type: string;
|
|
6
|
-
payload: any;
|
|
7
|
-
runId: string;
|
|
8
|
-
from: 'AGENT' | 'WORKFLOW';
|
|
9
|
-
};
|
|
10
|
-
export declare const mapWorkflowStreamChunkToWatchResult: (prev: WorkflowStreamResult<any, any, any, any>, chunk: StreamChunk) => WorkflowStreamResult<any, any, any, any>;
|
|
11
|
-
export interface ToUIMessageArgs {
|
|
12
|
-
chunk: ChunkType;
|
|
13
|
-
conversation: MastraUIMessage[];
|
|
14
|
-
metadata: MastraUIMessageMetadata;
|
|
15
|
-
}
|
|
16
|
-
export declare const toUIMessage: ({ chunk, conversation, metadata }: ToUIMessageArgs) => MastraUIMessage[];
|
|
17
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { MastraClient } from '@mastra/client-js';
|
|
3
|
-
export type MastraClientContextType = MastraClient;
|
|
4
|
-
export interface MastraClientProviderProps {
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
baseUrl?: string;
|
|
7
|
-
headers?: Record<string, string>;
|
|
8
|
-
}
|
|
9
|
-
export declare const MastraClientProvider: ({ children, baseUrl, headers }: MastraClientProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export declare const useMastraClient: () => MastraClient;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { MastraClientProviderProps } from './mastra-client-context';
|
|
2
|
-
type MastraReactProviderProps = MastraClientProviderProps;
|
|
3
|
-
export declare const MastraReactProvider: ({ children, baseUrl, headers }: MastraReactProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Code';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { EntityVariant } from './types';
|
|
3
|
-
interface ComponentProps {
|
|
4
|
-
className?: string;
|
|
5
|
-
additionalClass?: string;
|
|
6
|
-
variant?: EntityVariant;
|
|
7
|
-
requireApproval?: boolean;
|
|
8
|
-
}
|
|
9
|
-
declare const meta: {
|
|
10
|
-
title: string;
|
|
11
|
-
component: ({ className, additionalClass, variant, requireApproval }: ComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
parameters: {};
|
|
13
|
-
tags: string[];
|
|
14
|
-
argTypes: {};
|
|
15
|
-
args: {};
|
|
16
|
-
};
|
|
17
|
-
export default meta;
|
|
18
|
-
type Story = StoryObj<typeof meta>;
|
|
19
|
-
export declare const Default: Story;
|
|
20
|
-
export declare const OverrideByCustomClass: Story;
|
|
21
|
-
export declare const ExtandedByAdditionalClass: Story;
|
|
22
|
-
export declare const Disabled: Story;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Icon';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
-
declare const meta: {
|
|
3
|
-
title: string;
|
|
4
|
-
component: () => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
parameters: {};
|
|
6
|
-
tags: string[];
|
|
7
|
-
argTypes: {};
|
|
8
|
-
args: {};
|
|
9
|
-
};
|
|
10
|
-
export default meta;
|
|
11
|
-
type Story = StoryObj<typeof meta>;
|
|
12
|
-
export declare const Default: Story;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './IconButton';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
-
declare const meta: {
|
|
3
|
-
title: string;
|
|
4
|
-
component: () => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
parameters: {};
|
|
6
|
-
tags: string[];
|
|
7
|
-
argTypes: {};
|
|
8
|
-
args: {};
|
|
9
|
-
};
|
|
10
|
-
export default meta;
|
|
11
|
-
type Story = StoryObj<typeof meta>;
|
|
12
|
-
export declare const Default: Story;
|
|
13
|
-
export declare const Streaming: Story;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Message';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
-
declare const meta: {
|
|
3
|
-
title: string;
|
|
4
|
-
component: () => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
parameters: {};
|
|
6
|
-
tags: string[];
|
|
7
|
-
argTypes: {};
|
|
8
|
-
args: {};
|
|
9
|
-
};
|
|
10
|
-
export default meta;
|
|
11
|
-
type Story = StoryObj<typeof meta>;
|
|
12
|
-
export declare const Default: Story;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Tooltip';
|