@@ -8,76 +8,76 @@ async function testChatOperations() {
8
8
9
9
await codebolt . waitForConnection ( ) ;
10
10
11
- console . log ( '\n1. Testing get chat history...' ) ;
12
- const chatHistory = await codebolt . chat . getChatHistory ( ) ;
13
- console . log ( '✅ Chat history retrieved:' , {
14
- type : typeof chatHistory ,
15
- isArray : Array . isArray ( chatHistory ) ,
16
- data : chatHistory ,
17
- length : Array . isArray ( chatHistory ) ? chatHistory . length : 'N/A' ,
18
- sample : Array . isArray ( chatHistory ) ? chatHistory . slice ( 0 , 2 ) : 'Not an array'
19
- } ) ;
20
-
21
- console . log ( '\n2. Testing notification events...' ) ;
22
- const notificationTypes = [ 'debug' , 'git' , 'planner' , 'browser' , 'editor' , 'terminal' , 'preview' ] ;
23
-
24
- for ( const type of notificationTypes ) {
25
- codebolt . chat . sendNotificationEvent ( `Test ${ type } notification from CodeboltJS` , type ) ;
26
- console . log ( `✅ Sent ${ type } notification` ) ;
27
- }
28
-
29
- console . log ( '\n3. Testing send message...' ) ;
30
- codebolt . chat . sendMessage ( 'Test message from CodeboltJS' , {
31
- timestamp : new Date ( ) . toISOString ( ) ,
32
- source : 'codeboltjs-test'
33
- } ) ;
34
- console . log ( '✅ Message sent' ) ;
35
-
36
- console . log ( '\n4. Testing process lifecycle...' ) ;
37
- const processControl = codebolt . chat . processStarted ( ) ;
38
- console . log ( '✅ Process started' ) ;
39
-
40
- // Test event listener for stop process clicked
41
- processControl . event . on ( 'stopProcessClicked' , ( data ) => {
42
- console . log ( '🛑 Stop process clicked event received:' , data ) ;
43
- } ) ;
44
- console . log ( '✅ Stop process event listener set up' ) ;
45
-
46
- // Simulate some work
47
- await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ;
48
-
49
- processControl . stopProcess ( ) ;
50
- console . log ( '✅ Process stopped via processControl' ) ;
51
-
52
- // Test standalone stopProcess function
53
- codebolt . chat . stopProcess ( ) ;
54
- console . log ( '✅ Process stopped via standalone function' ) ;
55
-
56
- codebolt . chat . processFinished ( ) ;
57
- console . log ( '✅ Process finished' ) ;
58
-
59
- console . log ( '\n5. Testing action message listener...' ) ;
60
- const actionEmitter = codebolt . chat . onActionMessage ( ) ;
61
-
62
- actionEmitter . on ( 'userMessage' , ( data , callback ) => {
63
- console . log ( '📨 Received user message:' , data ) ;
64
- if ( callback && typeof callback === 'function' ) {
65
- callback ( 'Message processed by CodeboltJS test' ) ;
66
- }
67
- } ) ;
68
-
69
- console . log ( '✅ Action message listener set up' ) ;
70
-
71
- console . log ( '\n6. Testing request handler...' ) ;
72
- codebolt . chat . setRequestHandler ( ( request , response ) => {
73
- console . log ( '📥 Received request:' , request ) ;
74
- response ( {
75
- status : 'success' ,
76
- message : 'Request handled by CodeboltJS test' ,
77
- timestamp : new Date ( ) . toISOString ( )
78
- } ) ;
79
- } ) ;
80
- console . log ( '✅ Request handler set up' ) ;
11
+ // console.log('\n1. Testing get chat history...');
12
+ // const chatHistory = await codebolt.chat.getChatHistory();
13
+ // console.log('✅ Chat history retrieved:', {
14
+ // type: typeof chatHistory,
15
+ // isArray: Array.isArray(chatHistory),
16
+ // data: chatHistory,
17
+ // length: Array.isArray(chatHistory) ? chatHistory.length : 'N/A',
18
+ // sample: Array.isArray(chatHistory) ? chatHistory.slice(0, 2) : 'Not an array'
19
+ // });
20
+
21
+ // console.log('\n2. Testing notification events...');
22
+ // const notificationTypes = ['debug', 'git', 'planner', 'browser', 'editor', 'terminal', 'preview'];
23
+
24
+ // for (const type of notificationTypes) {
25
+ // codebolt.chat.sendNotificationEvent(`Test ${type} notification from CodeboltJS`, type);
26
+ // console.log(`✅ Sent ${type} notification`);
27
+ // }
28
+
29
+ // console.log('\n3. Testing send message...');
30
+ // codebolt.chat.sendMessage('Test message from CodeboltJS', {
31
+ // timestamp: new Date().toISOString(),
32
+ // source: 'codeboltjs-test'
33
+ // });
34
+ // console.log('✅ Message sent');
35
+
36
+ // console.log('\n4. Testing process lifecycle...');
37
+ // const processControl = codebolt.chat.processStarted();
38
+ // console.log('✅ Process started');
39
+
40
+ // // Test event listener for stop process clicked
41
+ // processControl.event.on('stopProcessClicked', (data) => {
42
+ // console.log('🛑 Stop process clicked event received:', data);
43
+ // });
44
+ // console.log('✅ Stop process event listener set up');
45
+
46
+ // // Simulate some work
47
+ // await new Promise(resolve => setTimeout(resolve, 1000));
48
+
49
+ // processControl.stopProcess();
50
+ // console.log('✅ Process stopped via processControl');
51
+
52
+ // // Test standalone stopProcess function
53
+ // codebolt.chat.stopProcess();
54
+ // console.log('✅ Process stopped via standalone function');
55
+
56
+ // codebolt.chat.processFinished();
57
+ // console.log('✅ Process finished');
58
+
59
+ // console.log('\n5. Testing action message listener...');
60
+ // const actionEmitter = codebolt.chat.onActionMessage();
61
+
62
+ // actionEmitter.on('userMessage', (data, callback) => {
63
+ // console.log('📨 Received user message:', data);
64
+ // if (callback && typeof callback === 'function') {
65
+ // callback('Message processed by CodeboltJS test');
66
+ // }
67
+ // });
68
+
69
+ // console.log('✅ Action message listener set up');
70
+
71
+ // console.log('\n6. Testing request handler...');
72
+ // codebolt.chat.setRequestHandler((request, response) => {
73
+ // console.log('📥 Received request:', request);
74
+ // response({
75
+ // status: 'success',
76
+ // message: 'Request handled by CodeboltJS test',
77
+ // timestamp: new Date().toISOString()
78
+ // });
79
+ // });
80
+ // console.log('✅ Request handler set up');
81
81
82
82
console . log ( '\n7. Testing waitforReply (non-interactive)...' ) ;
83
83
// Note: This would normally wait for a user reply, but we'll just test the function call
0 commit comments