@agentxjs/ui 1.0.2 → 1.1.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.
- package/dist/api/index.d.ts +1 -0
- package/dist/components/container/Chat.d.ts +3 -9
- package/dist/components/container/ChatHeader.d.ts +2 -1
- package/dist/components/element/Badge.d.ts +1 -1
- package/dist/components/element/MessageAvatar.d.ts +1 -1
- package/dist/components/entry/AssistantEntry.d.ts +86 -0
- package/dist/components/entry/AssistantToolbar.d.ts +53 -0
- package/dist/components/entry/ErrorEntry.d.ts +35 -0
- package/dist/components/entry/UserEntry.d.ts +35 -0
- package/dist/components/entry/blocks/TextBlock.d.ts +21 -0
- package/dist/components/entry/blocks/ToolBlock.d.ts +20 -0
- package/dist/components/entry/blocks/index.d.ts +8 -0
- package/dist/components/entry/index.d.ts +15 -0
- package/dist/components/entry/types.d.ts +152 -0
- package/dist/components/message/AssistantMessage.d.ts +35 -0
- package/dist/components/message/ErrorMessage.d.ts +24 -0
- package/dist/components/message/MessageAvatar.d.ts +21 -0
- package/dist/components/message/MessageContent.d.ts +25 -0
- package/dist/components/message/ToolMessage.d.ts +41 -0
- package/dist/components/message/UserMessage.d.ts +30 -0
- package/dist/components/message/index.d.ts +39 -0
- package/dist/components/mobile/MobileAgentList.d.ts +51 -0
- package/dist/components/mobile/MobileChat.d.ts +47 -0
- package/dist/components/mobile/MobileDrawer.d.ts +32 -0
- package/dist/components/mobile/MobileHeader.d.ts +41 -0
- package/dist/components/mobile/MobileInputPane.d.ts +41 -0
- package/dist/components/mobile/MobileMessagePane.d.ts +33 -0
- package/dist/components/mobile/index.d.ts +6 -0
- package/dist/components/pane/MessagePane.d.ts +31 -83
- package/dist/components/pane/index.d.ts +1 -1
- package/dist/components/studio/MobileStudio.d.ts +31 -0
- package/dist/components/studio/ResponsiveStudio.d.ts +46 -0
- package/dist/components/studio/index.d.ts +4 -0
- package/dist/globals.css +1 -1
- package/dist/hooks/index.d.ts +31 -13
- package/dist/hooks/useAgent/conversationReducer.d.ts +9 -0
- package/dist/hooks/useAgent/index.d.ts +7 -0
- package/dist/hooks/useAgent/types.d.ts +134 -0
- package/dist/hooks/useIsMobile.d.ts +22 -0
- package/dist/index-Bye0TcnJ.js +271 -0
- package/dist/index-Bye0TcnJ.js.map +1 -0
- package/dist/index-CHvoau9l.js +26216 -0
- package/dist/index-CHvoau9l.js.map +1 -0
- package/dist/index.js +61 -21968
- package/dist/index.js.map +1 -1
- package/package.json +19 -18
- package/LICENSE +0 -21
- package/dist/components/container/message/MessageList.d.ts +0 -16
- package/dist/components/container/message/index.d.ts +0 -3
- package/dist/components/container/message/items/AssistantMessage.d.ts +0 -33
- package/dist/components/container/message/items/ErrorAlert.d.ts +0 -33
- package/dist/components/container/message/items/ToolCallMessage.d.ts +0 -31
- package/dist/components/container/message/items/ToolResultMessage.d.ts +0 -33
- package/dist/components/container/message/items/ToolUseMessage.d.ts +0 -30
- package/dist/components/container/message/items/UserMessage.d.ts +0 -27
- package/dist/components/container/message/items/index.d.ts +0 -6
- package/dist/components/container/message/parts/FileContent.d.ts +0 -24
- package/dist/components/container/message/parts/ImageContent.d.ts +0 -32
- package/dist/components/container/message/parts/TextContent.d.ts +0 -20
- package/dist/components/container/message/parts/ThinkingContent.d.ts +0 -28
- package/dist/components/container/message/parts/ToolCallContent.d.ts +0 -31
- package/dist/components/container/message/parts/ToolResultContent.d.ts +0 -32
- package/dist/components/container/message/parts/index.d.ts +0 -6
- package/dist/hooks/useAgent.d.ts +0 -102
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentxjs/ui",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "AgentX UI Components - React component library for building AI agent interfaces",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,9 +28,22 @@
|
|
|
28
28
|
"dist",
|
|
29
29
|
"README.md"
|
|
30
30
|
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"dev": "vite",
|
|
33
|
+
"dev:server": "tsx --watch dev-tools/server/dev-server.ts",
|
|
34
|
+
"dev:full": "concurrently \"pnpm dev:server\" \"storybook dev -p 6007\"",
|
|
35
|
+
"build": "tsc && vite build",
|
|
36
|
+
"lint": "eslint .",
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"preview": "vite preview",
|
|
39
|
+
"storybook": "storybook dev -p 6006",
|
|
40
|
+
"build-storybook": "storybook build"
|
|
41
|
+
},
|
|
31
42
|
"dependencies": {
|
|
43
|
+
"@agentxjs/common": "workspace:*",
|
|
32
44
|
"@emoji-mart/data": "^1.2.1",
|
|
33
45
|
"@emoji-mart/react": "^1.1.1",
|
|
46
|
+
"agentxjs": "workspace:*",
|
|
34
47
|
"allotment": "^1.20.4",
|
|
35
48
|
"class-variance-authority": "^0.7.1",
|
|
36
49
|
"clsx": "^2.1.1",
|
|
@@ -42,10 +55,11 @@
|
|
|
42
55
|
"react-markdown": "^10.1.0",
|
|
43
56
|
"remark-gfm": "^4.0.1",
|
|
44
57
|
"tailwind-merge": "^2.5.5",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
58
|
+
"vaul": "^1.1.2",
|
|
59
|
+
"zustand": "^5.0.2"
|
|
47
60
|
},
|
|
48
61
|
"devDependencies": {
|
|
62
|
+
"@agentxjs/runtime": "workspace:*",
|
|
49
63
|
"@storybook/addon-a11y": "^8.4.7",
|
|
50
64
|
"@storybook/addon-essentials": "^8.4.7",
|
|
51
65
|
"@storybook/addon-interactions": "^8.4.7",
|
|
@@ -69,9 +83,7 @@
|
|
|
69
83
|
"typescript": "^5.9.3",
|
|
70
84
|
"vite": "^6.0.5",
|
|
71
85
|
"vite-plugin-dts": "^4.3.0",
|
|
72
|
-
"ws": "^8.18.0"
|
|
73
|
-
"@agentxjs/runtime": "1.0.2",
|
|
74
|
-
"@agentxjs/common": "0.1.1"
|
|
86
|
+
"ws": "^8.18.0"
|
|
75
87
|
},
|
|
76
88
|
"peerDependencies": {
|
|
77
89
|
"react": "^18.0.0",
|
|
@@ -79,16 +91,5 @@
|
|
|
79
91
|
},
|
|
80
92
|
"publishConfig": {
|
|
81
93
|
"access": "public"
|
|
82
|
-
},
|
|
83
|
-
"scripts": {
|
|
84
|
-
"dev": "vite",
|
|
85
|
-
"dev:server": "tsx --watch dev-tools/server/dev-server.ts",
|
|
86
|
-
"dev:full": "concurrently \"pnpm dev:server\" \"storybook dev -p 6007\"",
|
|
87
|
-
"build": "tsc && vite build",
|
|
88
|
-
"lint": "eslint .",
|
|
89
|
-
"typecheck": "tsc --noEmit",
|
|
90
|
-
"preview": "vite preview",
|
|
91
|
-
"storybook": "storybook dev -p 6006",
|
|
92
|
-
"build-storybook": "storybook build"
|
|
93
94
|
}
|
|
94
|
-
}
|
|
95
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Deepractice
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Message } from 'agentxjs';
|
|
2
|
-
export interface MessageListProps {
|
|
3
|
-
/**
|
|
4
|
-
* Array of messages to display
|
|
5
|
-
*/
|
|
6
|
-
messages: Message[];
|
|
7
|
-
/**
|
|
8
|
-
* Current streaming text (if any)
|
|
9
|
-
*/
|
|
10
|
-
streamingText?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Custom className
|
|
13
|
-
*/
|
|
14
|
-
className?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare function MessageList({ messages, streamingText, className }: MessageListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { AssistantMessage as AssistantMessageType } from 'agentxjs';
|
|
2
|
-
export interface AssistantMessageProps {
|
|
3
|
-
/**
|
|
4
|
-
* Assistant message data
|
|
5
|
-
*/
|
|
6
|
-
message: AssistantMessageType;
|
|
7
|
-
/**
|
|
8
|
-
* Whether this message is currently streaming
|
|
9
|
-
*/
|
|
10
|
-
isStreaming?: boolean;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* AssistantMessage - Display an AI assistant message
|
|
14
|
-
*
|
|
15
|
-
* Features:
|
|
16
|
-
* - AI avatar (blue color)
|
|
17
|
-
* - Text content rendering
|
|
18
|
-
* - Thinking process (collapsible)
|
|
19
|
-
* - Tool calls display
|
|
20
|
-
* - File attachments
|
|
21
|
-
* - Streaming support
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```tsx
|
|
25
|
-
* <AssistantMessage message={{
|
|
26
|
-
* id: '2',
|
|
27
|
-
* role: 'assistant',
|
|
28
|
-
* content: 'Here is the answer...',
|
|
29
|
-
* timestamp: Date.now()
|
|
30
|
-
* }} />
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export declare function AssistantMessage({ message, isStreaming }: AssistantMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { AgentError } from 'agentxjs';
|
|
2
|
-
export interface ErrorAlertProps {
|
|
3
|
-
/**
|
|
4
|
-
* The AgentError to display
|
|
5
|
-
*/
|
|
6
|
-
error: AgentError;
|
|
7
|
-
/**
|
|
8
|
-
* Whether to show detailed error information
|
|
9
|
-
* @default false
|
|
10
|
-
*/
|
|
11
|
-
showDetails?: boolean;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* ErrorAlert - Display an agent error
|
|
15
|
-
*
|
|
16
|
-
* Features:
|
|
17
|
-
* - Error severity visualization (fatal/error/warning)
|
|
18
|
-
* - Error category badge (driver/llm/network/validation/system)
|
|
19
|
-
* - Error code and message
|
|
20
|
-
* - Optional details expansion
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```tsx
|
|
24
|
-
* <ErrorAlert error={{
|
|
25
|
-
* category: 'llm',
|
|
26
|
-
* code: 'RATE_LIMITED',
|
|
27
|
-
* message: 'Rate limit exceeded',
|
|
28
|
-
* severity: 'error',
|
|
29
|
-
* recoverable: true,
|
|
30
|
-
* }} />
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export declare function ErrorAlert({ error, showDetails }: ErrorAlertProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ToolCallMessage as ToolCallMessageType } from 'agentxjs';
|
|
2
|
-
export interface ToolCallMessageProps {
|
|
3
|
-
/**
|
|
4
|
-
* Tool call message data
|
|
5
|
-
*/
|
|
6
|
-
message: ToolCallMessageType;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* ToolCallMessage - Display AI's request to call a tool
|
|
10
|
-
*
|
|
11
|
-
* Features:
|
|
12
|
-
* - Tool avatar (info blue)
|
|
13
|
-
* - Tool call display (collapsible)
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```tsx
|
|
17
|
-
* <ToolCallMessage message={{
|
|
18
|
-
* id: '3',
|
|
19
|
-
* role: 'assistant',
|
|
20
|
-
* subtype: 'tool-call',
|
|
21
|
-
* toolCall: {
|
|
22
|
-
* type: 'tool-call',
|
|
23
|
-
* id: 'call_123',
|
|
24
|
-
* name: 'get_weather',
|
|
25
|
-
* input: { location: 'San Francisco' }
|
|
26
|
-
* },
|
|
27
|
-
* timestamp: Date.now()
|
|
28
|
-
* }} />
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export declare function ToolCallMessage({ message }: ToolCallMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ToolResultMessage as ToolResultMessageType } from 'agentxjs';
|
|
2
|
-
export interface ToolResultMessageProps {
|
|
3
|
-
/**
|
|
4
|
-
* Tool result message data
|
|
5
|
-
*/
|
|
6
|
-
message: ToolResultMessageType;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* ToolResultMessage - Display tool execution result
|
|
10
|
-
*
|
|
11
|
-
* Features:
|
|
12
|
-
* - Tool result avatar (success green)
|
|
13
|
-
* - Tool result display (collapsible)
|
|
14
|
-
* - Rich output formatting
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```tsx
|
|
18
|
-
* <ToolResultMessage message={{
|
|
19
|
-
* id: '4',
|
|
20
|
-
* role: 'tool',
|
|
21
|
-
* subtype: 'tool-result',
|
|
22
|
-
* toolResult: {
|
|
23
|
-
* type: 'tool-result',
|
|
24
|
-
* id: 'call_123',
|
|
25
|
-
* name: 'get_weather',
|
|
26
|
-
* output: { type: 'text', value: 'Temperature: 72°F' }
|
|
27
|
-
* },
|
|
28
|
-
* toolCallId: 'call_123',
|
|
29
|
-
* timestamp: Date.now()
|
|
30
|
-
* }} />
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export declare function ToolResultMessage({ message }: ToolResultMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ToolCallMessage, ToolResultMessage } from 'agentxjs';
|
|
2
|
-
export interface ToolUseMessageProps {
|
|
3
|
-
/**
|
|
4
|
-
* Tool call message
|
|
5
|
-
*/
|
|
6
|
-
toolCall: ToolCallMessage;
|
|
7
|
-
/**
|
|
8
|
-
* Tool result message (optional - may not have arrived yet)
|
|
9
|
-
*/
|
|
10
|
-
toolResult?: ToolResultMessage;
|
|
11
|
-
/**
|
|
12
|
-
* Whether to show expanded by default
|
|
13
|
-
*/
|
|
14
|
-
defaultExpanded?: boolean;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* ToolUseMessage - Unified display of tool call + result
|
|
18
|
-
*
|
|
19
|
-
* Combines ToolCallMessage and ToolResultMessage into a single visual unit.
|
|
20
|
-
* Supports streaming: shows "executing" state when result hasn't arrived yet.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```tsx
|
|
24
|
-
* <ToolUseMessage
|
|
25
|
-
* toolCall={toolCallMsg}
|
|
26
|
-
* toolResult={toolResultMsg}
|
|
27
|
-
* />
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare function ToolUseMessage({ toolCall, toolResult, defaultExpanded, }: ToolUseMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { UserMessage as UserMessageType } from 'agentxjs';
|
|
2
|
-
export interface UserMessageProps {
|
|
3
|
-
/**
|
|
4
|
-
* User message data
|
|
5
|
-
*/
|
|
6
|
-
message: UserMessageType;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* UserMessage - Display a user message
|
|
10
|
-
*
|
|
11
|
-
* Features:
|
|
12
|
-
* - User avatar (amber color)
|
|
13
|
-
* - Text content rendering
|
|
14
|
-
* - Image parts support
|
|
15
|
-
* - File parts support
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```tsx
|
|
19
|
-
* <UserMessage message={{
|
|
20
|
-
* id: '1',
|
|
21
|
-
* role: 'user',
|
|
22
|
-
* content: 'Hello, how are you?',
|
|
23
|
-
* timestamp: Date.now()
|
|
24
|
-
* }} />
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare function UserMessage({ message }: UserMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { UserMessage, type UserMessageProps } from './UserMessage';
|
|
2
|
-
export { AssistantMessage, type AssistantMessageProps } from './AssistantMessage';
|
|
3
|
-
export { ToolCallMessage } from './ToolCallMessage';
|
|
4
|
-
export { ToolResultMessage } from './ToolResultMessage';
|
|
5
|
-
export { ToolUseMessage, type ToolUseMessageProps } from './ToolUseMessage';
|
|
6
|
-
export { ErrorAlert, type ErrorAlertProps } from './ErrorAlert';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export interface FileContentProps {
|
|
2
|
-
/**
|
|
3
|
-
* File data (base64-encoded string or URL)
|
|
4
|
-
*/
|
|
5
|
-
data: string;
|
|
6
|
-
/**
|
|
7
|
-
* File MIME type (IANA media type)
|
|
8
|
-
*/
|
|
9
|
-
mediaType: string;
|
|
10
|
-
/**
|
|
11
|
-
* Optional filename
|
|
12
|
-
*/
|
|
13
|
-
filename?: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* FileContent - Render file attachment with download
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```tsx
|
|
20
|
-
* <FileContent data="data:application/pdf;base64,..." mediaType="application/pdf" filename="document.pdf" />
|
|
21
|
-
* <FileContent data="https://example.com/file.xlsx" mediaType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" filename="data.xlsx" />
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export declare function FileContent({ data, mediaType, filename }: FileContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export interface ImageContentProps {
|
|
2
|
-
/**
|
|
3
|
-
* Image data (base64-encoded string or URL)
|
|
4
|
-
*/
|
|
5
|
-
data: string;
|
|
6
|
-
/**
|
|
7
|
-
* Image MIME type
|
|
8
|
-
*/
|
|
9
|
-
mediaType: "image/png" | "image/jpeg" | "image/gif" | "image/webp";
|
|
10
|
-
/**
|
|
11
|
-
* Optional image name/filename
|
|
12
|
-
*/
|
|
13
|
-
name?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Optional max width (CSS value)
|
|
16
|
-
*/
|
|
17
|
-
maxWidth?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Optional max height (CSS value)
|
|
20
|
-
*/
|
|
21
|
-
maxHeight?: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* ImageContent - Render image with preview and modal
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```tsx
|
|
28
|
-
* <ImageContent data="data:image/png;base64,..." mediaType="image/png" />
|
|
29
|
-
* <ImageContent data="https://example.com/image.jpg" mediaType="image/jpeg" name="screenshot.jpg" />
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function ImageContent({ data, mediaType: _mediaType, name, maxWidth, maxHeight, }: ImageContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export interface TextContentProps {
|
|
2
|
-
/**
|
|
3
|
-
* Text content (supports Markdown)
|
|
4
|
-
*/
|
|
5
|
-
text: string;
|
|
6
|
-
/**
|
|
7
|
-
* Whether this text is currently streaming
|
|
8
|
-
*/
|
|
9
|
-
isStreaming?: boolean;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* TextContent - Render text with Markdown support
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* <TextContent text="Hello **world**" />
|
|
17
|
-
* <TextContent text="Streaming..." isStreaming />
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export declare function TextContent({ text, isStreaming }: TextContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export interface ThinkingContentProps {
|
|
2
|
-
/**
|
|
3
|
-
* AI reasoning text
|
|
4
|
-
*/
|
|
5
|
-
reasoning: string;
|
|
6
|
-
/**
|
|
7
|
-
* Token count for thinking (optional)
|
|
8
|
-
*/
|
|
9
|
-
tokenCount?: number;
|
|
10
|
-
/**
|
|
11
|
-
* Whether this thinking is currently streaming
|
|
12
|
-
*/
|
|
13
|
-
isStreaming?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Whether to show collapsed by default
|
|
16
|
-
*/
|
|
17
|
-
defaultCollapsed?: boolean;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* ThinkingContent - Render AI's extended thinking/reasoning process
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```tsx
|
|
24
|
-
* <ThinkingContent reasoning="Let me analyze this..." tokenCount={150} />
|
|
25
|
-
* <ThinkingContent reasoning="Thinking..." isStreaming />
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare function ThinkingContent({ reasoning, tokenCount, isStreaming, defaultCollapsed, }: ThinkingContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export interface ToolCallContentProps {
|
|
2
|
-
/**
|
|
3
|
-
* Unique identifier for this tool call
|
|
4
|
-
*/
|
|
5
|
-
id: string;
|
|
6
|
-
/**
|
|
7
|
-
* Tool name
|
|
8
|
-
*/
|
|
9
|
-
name: string;
|
|
10
|
-
/**
|
|
11
|
-
* Tool input parameters
|
|
12
|
-
*/
|
|
13
|
-
input: Record<string, unknown>;
|
|
14
|
-
/**
|
|
15
|
-
* Whether to show collapsed by default
|
|
16
|
-
*/
|
|
17
|
-
defaultCollapsed?: boolean;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* ToolCallContent - Render AI's tool invocation request
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```tsx
|
|
24
|
-
* <ToolCallContent
|
|
25
|
-
* id="call_123"
|
|
26
|
-
* name="get_weather"
|
|
27
|
-
* input={{ location: "San Francisco", unit: "celsius" }}
|
|
28
|
-
* />
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export declare function ToolCallContent({ id, name, input, defaultCollapsed, }: ToolCallContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ToolResultOutput } from 'agentxjs';
|
|
2
|
-
export interface ToolResultContentProps {
|
|
3
|
-
/**
|
|
4
|
-
* Tool call ID this result corresponds to
|
|
5
|
-
*/
|
|
6
|
-
id: string;
|
|
7
|
-
/**
|
|
8
|
-
* Tool name
|
|
9
|
-
*/
|
|
10
|
-
name: string;
|
|
11
|
-
/**
|
|
12
|
-
* Tool execution output
|
|
13
|
-
*/
|
|
14
|
-
output: ToolResultOutput;
|
|
15
|
-
/**
|
|
16
|
-
* Whether to show collapsed by default
|
|
17
|
-
*/
|
|
18
|
-
defaultCollapsed?: boolean;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* ToolResultContent - Render tool execution result
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```tsx
|
|
25
|
-
* <ToolResultContent
|
|
26
|
-
* id="call_123"
|
|
27
|
-
* name="get_weather"
|
|
28
|
-
* output={{ type: "text", value: "Temperature: 72°F" }}
|
|
29
|
-
* />
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function ToolResultContent({ id, name, output, defaultCollapsed, }: ToolResultContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { TextContent, type TextContentProps } from './TextContent';
|
|
2
|
-
export { ImageContent, type ImageContentProps } from './ImageContent';
|
|
3
|
-
export { FileContent, type FileContentProps } from './FileContent';
|
|
4
|
-
export { ThinkingContent, type ThinkingContentProps } from './ThinkingContent';
|
|
5
|
-
export { ToolCallContent, type ToolCallContentProps } from './ToolCallContent';
|
|
6
|
-
export { ToolResultContent, type ToolResultContentProps } from './ToolResultContent';
|
package/dist/hooks/useAgent.d.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { AgentX } from 'agentxjs';
|
|
2
|
-
/**
|
|
3
|
-
* Agent state for UI
|
|
4
|
-
*/
|
|
5
|
-
export type AgentStatus = "idle" | "queued" | "thinking" | "responding" | "tool_executing" | "error";
|
|
6
|
-
/**
|
|
7
|
-
* Message for UI display
|
|
8
|
-
*/
|
|
9
|
-
export interface UIMessage {
|
|
10
|
-
id: string;
|
|
11
|
-
role: "user" | "assistant" | "tool_call" | "tool_result" | "error";
|
|
12
|
-
content: string | unknown;
|
|
13
|
-
timestamp: number;
|
|
14
|
-
/** Optional metadata (e.g., errorCode for error messages) */
|
|
15
|
-
metadata?: Record<string, unknown>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Error info for UI
|
|
19
|
-
*/
|
|
20
|
-
export interface UIError {
|
|
21
|
-
code: string;
|
|
22
|
-
message: string;
|
|
23
|
-
recoverable: boolean;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Return type of useAgent hook
|
|
27
|
-
*/
|
|
28
|
-
export interface UseAgentResult {
|
|
29
|
-
/**
|
|
30
|
-
* All messages in the conversation
|
|
31
|
-
*/
|
|
32
|
-
messages: UIMessage[];
|
|
33
|
-
/**
|
|
34
|
-
* Current streaming text (accumulates during response)
|
|
35
|
-
*/
|
|
36
|
-
streaming: string;
|
|
37
|
-
/**
|
|
38
|
-
* Current agent status
|
|
39
|
-
*/
|
|
40
|
-
status: AgentStatus;
|
|
41
|
-
/**
|
|
42
|
-
* Errors received
|
|
43
|
-
*/
|
|
44
|
-
errors: UIError[];
|
|
45
|
-
/**
|
|
46
|
-
* Send a message to the agent
|
|
47
|
-
*/
|
|
48
|
-
send: (text: string) => void;
|
|
49
|
-
/**
|
|
50
|
-
* Interrupt the current response
|
|
51
|
-
*/
|
|
52
|
-
interrupt: () => void;
|
|
53
|
-
/**
|
|
54
|
-
* Whether the agent is currently processing
|
|
55
|
-
*/
|
|
56
|
-
isLoading: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Clear all messages
|
|
59
|
-
*/
|
|
60
|
-
clearMessages: () => void;
|
|
61
|
-
/**
|
|
62
|
-
* Clear all errors
|
|
63
|
-
*/
|
|
64
|
-
clearErrors: () => void;
|
|
65
|
-
/**
|
|
66
|
-
* Current agent ID (if running)
|
|
67
|
-
*/
|
|
68
|
-
agentId: string | null;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Options for useAgent hook
|
|
72
|
-
*/
|
|
73
|
-
export interface UseAgentOptions {
|
|
74
|
-
/**
|
|
75
|
-
* Initial messages to display
|
|
76
|
-
*/
|
|
77
|
-
initialMessages?: UIMessage[];
|
|
78
|
-
/**
|
|
79
|
-
* Callback when a message is sent
|
|
80
|
-
*/
|
|
81
|
-
onSend?: (text: string) => void;
|
|
82
|
-
/**
|
|
83
|
-
* Callback when an error occurs
|
|
84
|
-
*/
|
|
85
|
-
onError?: (error: UIError) => void;
|
|
86
|
-
/**
|
|
87
|
-
* Callback when status changes
|
|
88
|
-
*/
|
|
89
|
-
onStatusChange?: (status: AgentStatus) => void;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* React hook for binding to Agent events via AgentX
|
|
93
|
-
*
|
|
94
|
-
* @param agentx - The AgentX instance
|
|
95
|
-
* @param imageId - The image ID for the conversation
|
|
96
|
-
* @param options - Optional configuration
|
|
97
|
-
* @returns Reactive state and control functions
|
|
98
|
-
*/
|
|
99
|
-
export declare function useAgent(agentx: AgentX | null, imageId: string | null, options?: UseAgentOptions): UseAgentResult;
|
|
100
|
-
export type AgentIdentifier = {
|
|
101
|
-
imageId?: string;
|
|
102
|
-
};
|