1- import { useState , useEffect } from 'react'
21import './App.css'
32
4- // Import the OpenHands SDK
5- import {
6- RemoteConversation ,
7- RemoteWorkspace ,
8- HttpClient ,
9- AgentExecutionStatus ,
10- EventSortOrder
11- } from '@openhands/agent-server-typescript-client'
12-
133// Import settings components
144import { SettingsModal } from './components/SettingsModal'
5+ import { ConversationManager } from './components/ConversationManager'
156import { useSettings } from './contexts/SettingsContext'
167
178function App ( ) {
18- const [ sdkStatus , setSdkStatus ] = useState < string > ( 'Loading...' )
19- const [ sdkInfo , setSdkInfo ] = useState < any > ( null )
20-
219 // Use settings context
2210 const { settings, updateSettings, isModalOpen, openModal, closeModal, isFirstVisit } = useSettings ( )
2311
24- useEffect ( ( ) => {
25- // Test that the SDK imports work correctly
26- try {
27- // Check that all main classes are available
28- const classes = {
29- RemoteConversation : typeof RemoteConversation ,
30- RemoteWorkspace : typeof RemoteWorkspace ,
31- HttpClient : typeof HttpClient ,
32- AgentExecutionStatus : typeof AgentExecutionStatus ,
33- EventSortOrder : typeof EventSortOrder ,
34- }
35-
36- // Check that enums have expected values
37- const enumValues = {
38- AgentExecutionStatus : Object . keys ( AgentExecutionStatus ) ,
39- EventSortOrder : Object . keys ( EventSortOrder ) ,
40- }
41-
42- setSdkInfo ( {
43- classes,
44- enumValues,
45- importTime : new Date ( ) . toISOString ( ) ,
46- } )
47-
48- setSdkStatus ( '✅ SDK imported successfully!' )
49- } catch ( error ) {
50- setSdkStatus ( `❌ SDK import failed: ${ error } ` )
51- console . error ( 'SDK import error:' , error )
52- }
53- } , [ ] )
54-
5512 return (
5613 < div className = "App" >
5714 < div >
5815 < div className = "app-header" >
59- < h1 > OpenHands SDK Example </ h1 >
16+ < h1 > OpenHands Conversation Manager </ h1 >
6017 < button className = "settings-button" onClick = { openModal } >
6118 ⚙️ Settings
6219 </ button >
@@ -68,59 +25,7 @@ function App() {
6825 </ div >
6926 ) }
7027
71- < div className = "card" >
72- < h2 > SDK Import Status</ h2 >
73- < p className = "status" > { sdkStatus } </ p >
74-
75- { sdkInfo && (
76- < div className = "sdk-info" >
77- < h3 > Available Classes:</ h3 >
78- < ul >
79- { Object . entries ( sdkInfo . classes ) . map ( ( [ name , type ] ) => (
80- < li key = { name } >
81- < strong > { name } </ strong > : { type as string }
82- </ li >
83- ) ) }
84- </ ul >
85-
86- < h3 > Enum Values:</ h3 >
87- < div className = "enums" >
88- < div >
89- < strong > AgentExecutionStatus:</ strong >
90- < ul >
91- { sdkInfo . enumValues . AgentExecutionStatus . map ( ( value : string ) => (
92- < li key = { value } > { value } </ li >
93- ) ) }
94- </ ul >
95- </ div >
96- < div >
97- < strong > EventSortOrder:</ strong >
98- < ul >
99- { sdkInfo . enumValues . EventSortOrder . map ( ( value : string ) => (
100- < li key = { value } > { value } </ li >
101- ) ) }
102- </ ul >
103- </ div >
104- </ div >
105-
106- < p className = "import-time" >
107- < small > Imported at: { sdkInfo . importTime } </ small >
108- </ p >
109- </ div >
110- ) }
111- </ div >
112-
113- < div className = "card" >
114- < h2 > Hello World from React + TypeScript + OpenHands SDK!</ h2 >
115- < p >
116- This is a basic React application that successfully imports and uses the
117- OpenHands Agent Server TypeScript Client SDK.
118- </ p >
119- < p >
120- The SDK is built locally and linked as a file dependency, demonstrating
121- that the build process works correctly.
122- </ p >
123- </ div >
28+ < ConversationManager />
12429
12530 < SettingsModal
12631 isOpen = { isModalOpen }
0 commit comments