@agentxjs/ui 0.0.1
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/LICENSE +21 -0
- package/README.md +78 -0
- package/dist/api/index.d.ts +9 -0
- package/dist/components/container/AgentPane.d.ts +56 -0
- package/dist/components/container/ContainerView.d.ts +119 -0
- package/dist/components/container/DefinitionPane.d.ts +27 -0
- package/dist/components/container/InputPane.d.ts +44 -0
- package/dist/components/container/InputToolBar.d.ts +22 -0
- package/dist/components/container/MessagePane.d.ts +32 -0
- package/dist/components/container/SessionPane.d.ts +35 -0
- package/dist/components/container/index.d.ts +22 -0
- package/dist/components/container/types.d.ts +67 -0
- package/dist/components/element/ActionBar.d.ts +43 -0
- package/dist/components/element/AgentLogo.d.ts +21 -0
- package/dist/components/element/AppHeader.d.ts +84 -0
- package/dist/components/element/Badge.d.ts +9 -0
- package/dist/components/element/Button.d.ts +11 -0
- package/dist/components/element/EmptyState.d.ts +56 -0
- package/dist/components/element/ImageAttachment.d.ts +50 -0
- package/dist/components/element/Input.d.ts +5 -0
- package/dist/components/element/ListItem.d.ts +106 -0
- package/dist/components/element/LoadingState.d.ts +51 -0
- package/dist/components/element/MessageAvatar.d.ts +61 -0
- package/dist/components/element/PageHeader.d.ts +90 -0
- package/dist/components/element/Popover.d.ts +20 -0
- package/dist/components/element/ScrollArea.d.ts +6 -0
- package/dist/components/element/SearchInput.d.ts +75 -0
- package/dist/components/element/TabNavigation.d.ts +91 -0
- package/dist/components/element/TimeAgo.d.ts +46 -0
- package/dist/components/element/TokenUsagePie.d.ts +33 -0
- package/dist/components/element/index.d.ts +18 -0
- package/dist/components/input/InputBox.d.ts +43 -0
- package/dist/components/input/index.d.ts +1 -0
- package/dist/components/layout/ActivityBar.d.ts +62 -0
- package/dist/components/layout/Header.d.ts +36 -0
- package/dist/components/layout/MainContent.d.ts +21 -0
- package/dist/components/layout/Panel.d.ts +44 -0
- package/dist/components/layout/RightSidebar.d.ts +43 -0
- package/dist/components/layout/Sidebar.d.ts +34 -0
- package/dist/components/layout/StatusBar.d.ts +66 -0
- package/dist/components/layout/index.d.ts +7 -0
- package/dist/components/message/MessageList.d.ts +16 -0
- package/dist/components/message/StatusIndicator.d.ts +28 -0
- package/dist/components/message/index.d.ts +4 -0
- package/dist/components/message/items/AssistantMessage.d.ts +33 -0
- package/dist/components/message/items/ErrorAlert.d.ts +33 -0
- package/dist/components/message/items/SystemMessage.d.ts +25 -0
- package/dist/components/message/items/ToolCallMessage.d.ts +31 -0
- package/dist/components/message/items/ToolResultMessage.d.ts +33 -0
- package/dist/components/message/items/ToolUseMessage.d.ts +30 -0
- package/dist/components/message/items/UserMessage.d.ts +27 -0
- package/dist/components/message/items/index.d.ts +7 -0
- package/dist/components/message/parts/FileContent.d.ts +24 -0
- package/dist/components/message/parts/ImageContent.d.ts +32 -0
- package/dist/components/message/parts/TextContent.d.ts +20 -0
- package/dist/components/message/parts/ThinkingContent.d.ts +28 -0
- package/dist/components/message/parts/ToolCallContent.d.ts +31 -0
- package/dist/components/message/parts/ToolResultContent.d.ts +32 -0
- package/dist/components/message/parts/index.d.ts +6 -0
- package/dist/components/studio/Studio.d.ts +47 -0
- package/dist/components/studio/index.d.ts +9 -0
- package/dist/components/typography/DiffViewer.d.ts +41 -0
- package/dist/components/typography/JSONRenderer.d.ts +23 -0
- package/dist/components/typography/MarkdownText.d.ts +25 -0
- package/dist/components/typography/index.d.ts +3 -0
- package/dist/globals.css +201 -0
- package/dist/hooks/index.d.ts +28 -0
- package/dist/hooks/useAgent.d.ts +71 -0
- package/dist/hooks/useAgentX.d.ts +10 -0
- package/dist/hooks/useSession.d.ts +79 -0
- package/dist/index-CB5mSMCj.js +3041 -0
- package/dist/index-CB5mSMCj.js.map +1 -0
- package/dist/index-CyXGvO5F.js +27676 -0
- package/dist/index-CyXGvO5F.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +64 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/eventBus.d.ts +93 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/timeUtils.d.ts +14 -0
- package/dist/utils/utils.d.ts +13 -0
- package/package.json +87 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# @agentxjs/ui
|
|
2
|
+
|
|
3
|
+
React component library for building AI agent interfaces.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- React components optimized for AI agent UIs
|
|
8
|
+
- TypeScript support with full type definitions
|
|
9
|
+
- Tailwind CSS for styling with custom design tokens
|
|
10
|
+
- Storybook for component development and documentation
|
|
11
|
+
- Tree-shakeable ESM exports
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @agentxjs/ui
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { Button } from "@agentxjs/ui";
|
|
23
|
+
import "@agentxjs/ui/styles.css";
|
|
24
|
+
|
|
25
|
+
function App() {
|
|
26
|
+
return <Button>Click me</Button>;
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Development
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Install dependencies
|
|
34
|
+
pnpm install
|
|
35
|
+
|
|
36
|
+
# Run Storybook
|
|
37
|
+
pnpm storybook
|
|
38
|
+
|
|
39
|
+
# Build the library
|
|
40
|
+
pnpm build
|
|
41
|
+
|
|
42
|
+
# Type checking
|
|
43
|
+
pnpm typecheck
|
|
44
|
+
|
|
45
|
+
# Linting
|
|
46
|
+
pnpm lint
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Architecture
|
|
50
|
+
|
|
51
|
+
This package follows a layered architecture:
|
|
52
|
+
|
|
53
|
+
- `src/api/` - Public API (skin layer)
|
|
54
|
+
- `src/types/` - Public type definitions
|
|
55
|
+
- `src/components/` - React components
|
|
56
|
+
- `src/styles/` - Global styles and design tokens
|
|
57
|
+
- `src/utils/` - Utility functions
|
|
58
|
+
|
|
59
|
+
## Design System
|
|
60
|
+
|
|
61
|
+
The component library uses a semantic token system based on Tailwind CSS:
|
|
62
|
+
|
|
63
|
+
- **Primary**: Computational intelligence (Blue)
|
|
64
|
+
- **Secondary**: Generative creativity (Amber)
|
|
65
|
+
- **Accent**: Interactive highlights (Orange)
|
|
66
|
+
- **Success/Warning/Error**: Feedback states
|
|
67
|
+
|
|
68
|
+
Dark mode is supported via CSS custom properties.
|
|
69
|
+
|
|
70
|
+
## Related Packages
|
|
71
|
+
|
|
72
|
+
- **[agentxjs](../agentx)** - Platform API (createAgentX, defineAgent)
|
|
73
|
+
- **[@agentxjs/types](../agentx-types)** - Message and event type definitions
|
|
74
|
+
- **[@agentxjs/agent](../agentx-agent)** - Agent runtime
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
MIT
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from '../hooks';
|
|
2
|
+
export * from '../components/container';
|
|
3
|
+
export * from '../components/studio';
|
|
4
|
+
export * from '../components/message';
|
|
5
|
+
export * from '../components/input';
|
|
6
|
+
export * from '../components/layout';
|
|
7
|
+
export * from '../components/element';
|
|
8
|
+
export * from '../components/typography';
|
|
9
|
+
export * from '../utils';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { AgentError, AgentState, Message } from '@agentxjs/types';
|
|
2
|
+
import { AgentDefinitionItem, SessionItem } from './types';
|
|
3
|
+
export interface AgentPaneProps {
|
|
4
|
+
/**
|
|
5
|
+
* Current agent definition (for display)
|
|
6
|
+
*/
|
|
7
|
+
definition: AgentDefinitionItem | null;
|
|
8
|
+
/**
|
|
9
|
+
* Current session (for display)
|
|
10
|
+
*/
|
|
11
|
+
session: SessionItem | null;
|
|
12
|
+
/**
|
|
13
|
+
* Current agent ID (for display)
|
|
14
|
+
*/
|
|
15
|
+
agentId?: string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Messages to display
|
|
18
|
+
*/
|
|
19
|
+
messages?: Message[];
|
|
20
|
+
/**
|
|
21
|
+
* Streaming message content
|
|
22
|
+
*/
|
|
23
|
+
streaming?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Error messages
|
|
26
|
+
*/
|
|
27
|
+
errors?: AgentError[];
|
|
28
|
+
/**
|
|
29
|
+
* Agent status
|
|
30
|
+
*/
|
|
31
|
+
status?: AgentState;
|
|
32
|
+
/**
|
|
33
|
+
* Loading state
|
|
34
|
+
*/
|
|
35
|
+
isLoading?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Callback to abort current request
|
|
38
|
+
*/
|
|
39
|
+
onAbort?: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* Callback to create a new session
|
|
42
|
+
*/
|
|
43
|
+
onCreateSession?: () => void;
|
|
44
|
+
/**
|
|
45
|
+
* Custom className
|
|
46
|
+
*/
|
|
47
|
+
className?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* AgentPane - Agent message display area (pure presentation)
|
|
51
|
+
*
|
|
52
|
+
* States:
|
|
53
|
+
* 1. isLoading + no messages → Connecting/Loading
|
|
54
|
+
* 2. Ready → Show MessagePane (may be empty)
|
|
55
|
+
*/
|
|
56
|
+
export declare function AgentPane({ definition, session, agentId, messages, streaming, errors, status, isLoading, onAbort, className, }: AgentPaneProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Message, AgentError } from '@agentxjs/types';
|
|
3
|
+
import { AgentDefinitionItem } from './types';
|
|
4
|
+
import { SessionItem } from '../../hooks/useSession';
|
|
5
|
+
/**
|
|
6
|
+
* Props for ContainerView component
|
|
7
|
+
*
|
|
8
|
+
* All data is passed in, no internal state management.
|
|
9
|
+
*/
|
|
10
|
+
export interface ContainerViewProps {
|
|
11
|
+
/**
|
|
12
|
+
* Available agent definitions
|
|
13
|
+
*/
|
|
14
|
+
definitions: AgentDefinitionItem[];
|
|
15
|
+
/**
|
|
16
|
+
* User's sessions
|
|
17
|
+
*/
|
|
18
|
+
sessions: SessionItem[];
|
|
19
|
+
/**
|
|
20
|
+
* Currently selected definition
|
|
21
|
+
*/
|
|
22
|
+
currentDefinition: AgentDefinitionItem | null;
|
|
23
|
+
/**
|
|
24
|
+
* Currently selected session
|
|
25
|
+
*/
|
|
26
|
+
currentSession: SessionItem | null;
|
|
27
|
+
/**
|
|
28
|
+
* Messages in current conversation
|
|
29
|
+
*/
|
|
30
|
+
messages: Message[];
|
|
31
|
+
/**
|
|
32
|
+
* Current streaming text (assistant response in progress)
|
|
33
|
+
*/
|
|
34
|
+
streaming?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Errors from agent
|
|
37
|
+
*/
|
|
38
|
+
errors?: AgentError[];
|
|
39
|
+
/**
|
|
40
|
+
* Whether agent is processing
|
|
41
|
+
*/
|
|
42
|
+
isLoading: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Called when user selects a definition
|
|
45
|
+
*/
|
|
46
|
+
onSelectDefinition: (definition: AgentDefinitionItem) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Called when user selects a session
|
|
49
|
+
*/
|
|
50
|
+
onSelectSession: (session: SessionItem) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Called when user wants to create a new session
|
|
53
|
+
*/
|
|
54
|
+
onCreateSession: () => void;
|
|
55
|
+
/**
|
|
56
|
+
* Called when user sends a message
|
|
57
|
+
*/
|
|
58
|
+
onSend: (text: string) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Called when user wants to abort current response
|
|
61
|
+
*/
|
|
62
|
+
onAbort?: () => void;
|
|
63
|
+
/**
|
|
64
|
+
* Called when user wants to add a definition
|
|
65
|
+
*/
|
|
66
|
+
onAddDefinition?: () => void;
|
|
67
|
+
/**
|
|
68
|
+
* Called when user wants to delete a session
|
|
69
|
+
*/
|
|
70
|
+
onDeleteSession?: (sessionId: string) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Custom render for the entire layout
|
|
73
|
+
* If provided, takes full control of rendering
|
|
74
|
+
*/
|
|
75
|
+
children?: (props: ContainerViewRenderProps) => ReactNode;
|
|
76
|
+
/**
|
|
77
|
+
* Custom className for container
|
|
78
|
+
*/
|
|
79
|
+
className?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Props passed to custom render function
|
|
83
|
+
*/
|
|
84
|
+
export interface ContainerViewRenderProps {
|
|
85
|
+
definitions: AgentDefinitionItem[];
|
|
86
|
+
sessions: SessionItem[];
|
|
87
|
+
currentDefinition: AgentDefinitionItem | null;
|
|
88
|
+
currentSession: SessionItem | null;
|
|
89
|
+
messages: Message[];
|
|
90
|
+
streaming?: string;
|
|
91
|
+
errors?: AgentError[];
|
|
92
|
+
isLoading: boolean;
|
|
93
|
+
onSelectDefinition: (definition: AgentDefinitionItem) => void;
|
|
94
|
+
onSelectSession: (session: SessionItem) => void;
|
|
95
|
+
onCreateSession: () => void;
|
|
96
|
+
onSend: (text: string) => void;
|
|
97
|
+
onAbort?: () => void;
|
|
98
|
+
onAddDefinition?: () => void;
|
|
99
|
+
onDeleteSession?: (sessionId: string) => void;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* ContainerView - Pure UI layout component
|
|
103
|
+
*
|
|
104
|
+
* Default layout (3-column):
|
|
105
|
+
* ```
|
|
106
|
+
* ┌──────────┬────────────┬──────────────────────────┐
|
|
107
|
+
* │ │ │ │
|
|
108
|
+
* │ Def.Pane │ Sess.Pane │ AgentPane │
|
|
109
|
+
* │ (60px) │ (240px) │ │
|
|
110
|
+
* │ │ ├──────────────────────────┤
|
|
111
|
+
* │ │ │ InputPane │
|
|
112
|
+
* └──────────┴────────────┴──────────────────────────┘
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* When `children` is provided, it acts as a render props container.
|
|
116
|
+
*/
|
|
117
|
+
export declare function ContainerView({ definitions, sessions, currentDefinition, currentSession, messages, streaming, errors, isLoading, onSelectDefinition, onSelectSession, onCreateSession, onSend, onAbort, onAddDefinition, onDeleteSession, children, className, }: ContainerViewProps): import("react/jsx-runtime").JSX.Element;
|
|
118
|
+
export type { AgentDefinitionItem } from './types';
|
|
119
|
+
export type { SessionItem } from '../../hooks/useSession';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AgentDefinitionItem } from './types';
|
|
2
|
+
export interface DefinitionPaneProps {
|
|
3
|
+
/**
|
|
4
|
+
* Available agent definitions
|
|
5
|
+
*/
|
|
6
|
+
definitions: AgentDefinitionItem[];
|
|
7
|
+
/**
|
|
8
|
+
* Currently selected definition
|
|
9
|
+
*/
|
|
10
|
+
current: AgentDefinitionItem | null;
|
|
11
|
+
/**
|
|
12
|
+
* Callback when an agent is selected
|
|
13
|
+
*/
|
|
14
|
+
onSelect: (definition: AgentDefinitionItem) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Callback when settings button is clicked
|
|
17
|
+
*/
|
|
18
|
+
onSettings?: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Custom className
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* DefinitionPane - Agent selection for ActivityBar
|
|
26
|
+
*/
|
|
27
|
+
export declare function DefinitionPane({ definitions, current, onSelect, onSettings, className, }: DefinitionPaneProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InputPane - Business container for user input
|
|
3
|
+
*
|
|
4
|
+
* Expanded input area with toolbar and full-width input box.
|
|
5
|
+
* Designed to be used inside a resizable Panel.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <Allotment.Pane minSize={120} maxSize={600}>
|
|
10
|
+
* <InputPane
|
|
11
|
+
* onSend={send}
|
|
12
|
+
* onFileAttach={handleFiles}
|
|
13
|
+
* disabled={isLoading}
|
|
14
|
+
* />
|
|
15
|
+
* </Allotment.Pane>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export interface InputPaneProps {
|
|
19
|
+
/**
|
|
20
|
+
* Callback when user sends a message
|
|
21
|
+
*/
|
|
22
|
+
onSend: (text: string) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Whether input is disabled
|
|
25
|
+
*/
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Placeholder text
|
|
29
|
+
*/
|
|
30
|
+
placeholder?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Callback when user uploads files via toolbar
|
|
33
|
+
*/
|
|
34
|
+
onFileAttach?: (files: File[]) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Show toolbar
|
|
37
|
+
*/
|
|
38
|
+
showToolbar?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Custom className
|
|
41
|
+
*/
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
44
|
+
export declare function InputPane({ onSend, disabled, placeholder, onFileAttach, showToolbar, className, }: InputPaneProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InputToolBar - Toolbar for input area with file upload and other tools
|
|
3
|
+
*
|
|
4
|
+
* Provides utility buttons for the input pane:
|
|
5
|
+
* - File upload (read files)
|
|
6
|
+
* - Future: Model selector, settings, etc.
|
|
7
|
+
*/
|
|
8
|
+
export interface InputToolBarProps {
|
|
9
|
+
/**
|
|
10
|
+
* Callback when user uploads files
|
|
11
|
+
*/
|
|
12
|
+
onFileAttach?: (files: File[]) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the toolbar is disabled
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Custom className
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function InputToolBar({ onFileAttach, disabled, className, }: InputToolBarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Message, AgentError, AgentState } from '@agentxjs/types';
|
|
2
|
+
export interface MessagePaneProps {
|
|
3
|
+
/**
|
|
4
|
+
* Messages to display
|
|
5
|
+
*/
|
|
6
|
+
messages: Message[];
|
|
7
|
+
/**
|
|
8
|
+
* Current streaming text
|
|
9
|
+
*/
|
|
10
|
+
streaming?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Errors to display
|
|
13
|
+
*/
|
|
14
|
+
errors?: AgentError[];
|
|
15
|
+
/**
|
|
16
|
+
* Current agent state
|
|
17
|
+
*/
|
|
18
|
+
status?: AgentState;
|
|
19
|
+
/**
|
|
20
|
+
* Whether agent is loading
|
|
21
|
+
*/
|
|
22
|
+
isLoading?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Callback to abort current operation
|
|
25
|
+
*/
|
|
26
|
+
onAbort?: () => void;
|
|
27
|
+
/**
|
|
28
|
+
* Custom className
|
|
29
|
+
*/
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function MessagePane({ messages, streaming, errors, status, isLoading, onAbort, className, }: MessagePaneProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SessionItem } from './types';
|
|
2
|
+
export interface SessionPaneProps {
|
|
3
|
+
/**
|
|
4
|
+
* Sessions to display
|
|
5
|
+
*/
|
|
6
|
+
sessions: SessionItem[];
|
|
7
|
+
/**
|
|
8
|
+
* Currently selected session
|
|
9
|
+
*/
|
|
10
|
+
current: SessionItem | null;
|
|
11
|
+
/**
|
|
12
|
+
* Agent name for header display
|
|
13
|
+
*/
|
|
14
|
+
agentName?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Callback when a session is selected
|
|
17
|
+
*/
|
|
18
|
+
onSelect: (session: SessionItem) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Callback when create button is clicked
|
|
21
|
+
*/
|
|
22
|
+
onCreate?: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Callback when delete is requested
|
|
25
|
+
*/
|
|
26
|
+
onDelete?: (sessionId: string) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Custom className
|
|
29
|
+
*/
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* SessionPane - Session list for Sidebar
|
|
34
|
+
*/
|
|
35
|
+
export declare function SessionPane({ sessions, current, agentName: _agentName, onSelect, onCreate, onDelete, className, }: SessionPaneProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Container Components - Pure UI Panes
|
|
3
|
+
*
|
|
4
|
+
* Part of UI-Backend API Consistency design (see index.ts ADR #5):
|
|
5
|
+
* - These are pure UI components (presentational)
|
|
6
|
+
* - For integration, use Studio from ~/components/studio
|
|
7
|
+
*/
|
|
8
|
+
export { ContainerView } from './ContainerView';
|
|
9
|
+
export type { ContainerViewProps, ContainerViewRenderProps } from './ContainerView';
|
|
10
|
+
export { DefinitionPane } from './DefinitionPane';
|
|
11
|
+
export type { DefinitionPaneProps } from './DefinitionPane';
|
|
12
|
+
export { SessionPane } from './SessionPane';
|
|
13
|
+
export type { SessionPaneProps } from './SessionPane';
|
|
14
|
+
export { AgentPane } from './AgentPane';
|
|
15
|
+
export type { AgentPaneProps } from './AgentPane';
|
|
16
|
+
export { MessagePane } from './MessagePane';
|
|
17
|
+
export type { MessagePaneProps } from './MessagePane';
|
|
18
|
+
export { InputPane } from './InputPane';
|
|
19
|
+
export type { InputPaneProps } from './InputPane';
|
|
20
|
+
export { InputToolBar } from './InputToolBar';
|
|
21
|
+
export type { InputToolBarProps } from './InputToolBar';
|
|
22
|
+
export type { SessionItem, AgentDefinitionItem } from './types';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { AgentDefinition } from '@agentxjs/types';
|
|
2
|
+
/**
|
|
3
|
+
* Session item for UI display (pure data, no methods)
|
|
4
|
+
*
|
|
5
|
+
* Core fields come from Session interface (Docker-style architecture).
|
|
6
|
+
* Additional fields (preview, unreadCount) are computed/derived by UI.
|
|
7
|
+
*
|
|
8
|
+
* Part of Docker-style layered architecture:
|
|
9
|
+
* Definition → build → Image → run → Agent
|
|
10
|
+
* ↓
|
|
11
|
+
* Session (userId + imageId)
|
|
12
|
+
*/
|
|
13
|
+
export interface SessionItem {
|
|
14
|
+
/**
|
|
15
|
+
* Unique session identifier
|
|
16
|
+
*/
|
|
17
|
+
sessionId: string;
|
|
18
|
+
/**
|
|
19
|
+
* Owner user ID
|
|
20
|
+
*/
|
|
21
|
+
userId: string;
|
|
22
|
+
/**
|
|
23
|
+
* Associated image ID (frozen runtime snapshot)
|
|
24
|
+
*/
|
|
25
|
+
imageId: string;
|
|
26
|
+
/**
|
|
27
|
+
* Display title (can be AI-generated summary)
|
|
28
|
+
*/
|
|
29
|
+
title: string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Session creation timestamp (Unix ms)
|
|
32
|
+
*/
|
|
33
|
+
createdAt: number;
|
|
34
|
+
/**
|
|
35
|
+
* Last update timestamp (Unix ms)
|
|
36
|
+
*/
|
|
37
|
+
updatedAt: number;
|
|
38
|
+
/**
|
|
39
|
+
* Preview text (last message snippet) - computed from messages
|
|
40
|
+
*/
|
|
41
|
+
preview?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Unread message count - computed by UI
|
|
44
|
+
*/
|
|
45
|
+
unreadCount?: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Extended AgentDefinition with UI metadata
|
|
49
|
+
*/
|
|
50
|
+
export interface AgentDefinitionItem extends AgentDefinition {
|
|
51
|
+
/**
|
|
52
|
+
* Icon identifier or emoji
|
|
53
|
+
*/
|
|
54
|
+
icon?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Badge color for visual distinction
|
|
57
|
+
*/
|
|
58
|
+
color?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Whether this agent is online/available
|
|
61
|
+
*/
|
|
62
|
+
isOnline?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Number of active sessions
|
|
65
|
+
*/
|
|
66
|
+
activeSessionCount?: number;
|
|
67
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { buttonVariants } from './Button';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export interface ActionBarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Children (ActionBar.Primary, ActionBar.Icon, ActionBar.Group)
|
|
7
|
+
*/
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export interface ActionBarPrimaryProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
11
|
+
/**
|
|
12
|
+
* Button content
|
|
13
|
+
*/
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Show loading state
|
|
17
|
+
*/
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ActionBarIconProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
21
|
+
/**
|
|
22
|
+
* Icon element
|
|
23
|
+
*/
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Show loading state
|
|
27
|
+
*/
|
|
28
|
+
loading?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface ActionBarGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
31
|
+
/**
|
|
32
|
+
* Group children
|
|
33
|
+
*/
|
|
34
|
+
children: React.ReactNode;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Compound component export
|
|
38
|
+
*/
|
|
39
|
+
export declare const ActionBar: React.ForwardRefExoticComponent<ActionBarProps & React.RefAttributes<HTMLDivElement>> & {
|
|
40
|
+
Primary: React.ForwardRefExoticComponent<ActionBarPrimaryProps & React.RefAttributes<HTMLButtonElement>>;
|
|
41
|
+
Icon: React.ForwardRefExoticComponent<ActionBarIconProps & React.RefAttributes<HTMLButtonElement>>;
|
|
42
|
+
Group: React.ForwardRefExoticComponent<ActionBarGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
43
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface AgentLogoProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Custom icon source URL. Defaults to "/icons/agent-ai-icon.svg"
|
|
5
|
+
*/
|
|
6
|
+
src?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* AgentLogo - Display the Agent AI logo
|
|
10
|
+
*
|
|
11
|
+
* Single Responsibility: Display a logo image with consistent sizing
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <AgentLogo />
|
|
16
|
+
* <AgentLogo className="w-8 h-8" />
|
|
17
|
+
* <AgentLogo src="/custom-logo.svg" />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare const AgentLogo: React.ForwardRefExoticComponent<AgentLogoProps & React.RefAttributes<HTMLImageElement>>;
|
|
21
|
+
export { AgentLogo };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface AppHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Logo element (icon or image)
|
|
5
|
+
*/
|
|
6
|
+
logo?: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Application title
|
|
9
|
+
*/
|
|
10
|
+
title: string;
|
|
11
|
+
/**
|
|
12
|
+
* Subtitle or description (optional)
|
|
13
|
+
*/
|
|
14
|
+
subtitle?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Additional actions on the right side
|
|
17
|
+
*/
|
|
18
|
+
actions?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to show border at bottom
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
showBorder?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether in mobile mode (compact layout)
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
isMobile?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether running as PWA (adds safe area padding)
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
isPWA?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* AppHeader - Application header with logo, title, and actions
|
|
37
|
+
*
|
|
38
|
+
* A flexible header component for application layouts. Supports logos,
|
|
39
|
+
* titles, subtitles, and action buttons. Automatically adapts to mobile
|
|
40
|
+
* and PWA environments.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* // Basic usage
|
|
45
|
+
* <AppHeader
|
|
46
|
+
* logo={<MessageSquare className="w-4 h-4" />}
|
|
47
|
+
* title="Deepractice Agent"
|
|
48
|
+
* />
|
|
49
|
+
*
|
|
50
|
+
* // With subtitle
|
|
51
|
+
* <AppHeader
|
|
52
|
+
* logo={<Bot className="w-4 h-4" />}
|
|
53
|
+
* title="AI Assistant"
|
|
54
|
+
* subtitle="Powered by Claude"
|
|
55
|
+
* />
|
|
56
|
+
*
|
|
57
|
+
* // With actions
|
|
58
|
+
* <AppHeader
|
|
59
|
+
* logo={<Logo />}
|
|
60
|
+
* title="My App"
|
|
61
|
+
* actions={
|
|
62
|
+
* <Button variant="ghost" size="sm">
|
|
63
|
+
* <Settings className="w-4 h-4" />
|
|
64
|
+
* </Button>
|
|
65
|
+
* }
|
|
66
|
+
* />
|
|
67
|
+
*
|
|
68
|
+
* // Mobile mode
|
|
69
|
+
* <AppHeader
|
|
70
|
+
* logo={<MessageSquare />}
|
|
71
|
+
* title="Agent"
|
|
72
|
+
* isMobile
|
|
73
|
+
* />
|
|
74
|
+
*
|
|
75
|
+
* // PWA with safe area
|
|
76
|
+
* <AppHeader
|
|
77
|
+
* logo={<Logo />}
|
|
78
|
+
* title="App"
|
|
79
|
+
* isPWA
|
|
80
|
+
* isMobile
|
|
81
|
+
* />
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare const AppHeader: React.ForwardRefExoticComponent<AppHeaderProps & React.RefAttributes<HTMLDivElement>>;
|