agentgui 1.0.21 → 1.0.22

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.
@@ -0,0 +1,125 @@
1
+ # Conversation Display Issue
2
+
3
+ ## Problem
4
+ Imported Claude Code conversations are not visible in the UI when opening the application, even though they exist in the database (83 conversations found).
5
+
6
+ ## Root Cause Analysis
7
+
8
+ Possible issues:
9
+ 1. **Conversations not loading on page load** - fetchConversations() may fail silently
10
+ 2. **Rendering issue** - chatList element may not be rendering properly
11
+ 3. **CSS hiding** - Conversations may be present but hidden (display:none, opacity:0)
12
+ 4. **Empty state** - renderChatHistory() shows "No chats yet" because this.conversations is empty
13
+ 5. **Filter/agent selection** - Conversations filtered by agent selection not matching
14
+
15
+ ## Investigation Steps
16
+
17
+ ### Check 1: Network Request
18
+ - Open browser DevTools (F12)
19
+ - Network tab: Look for `/api/conversations` request
20
+ - Should return 83 conversations with agent IDs
21
+
22
+ ### Check 2: Console Errors
23
+ - Console tab: Look for any JavaScript errors
24
+ - Look for "fetchConversations:" logs
25
+
26
+ ### Check 3: DOM Elements
27
+ - Elements tab: Inspect #chatList
28
+ - Check if it has children
29
+ - Check CSS display property (should be visible)
30
+
31
+ ### Check 4: Data Binding
32
+ - Console: `app.conversations.size` - should show 83
33
+ - Console: `app.conversations` - should contain conversation objects
34
+
35
+ ## Solution Areas
36
+
37
+ ### Frontend (static/app.js)
38
+
39
+ 1. **Add logging to fetchConversations()**
40
+ - Log when fetch starts/completes
41
+ - Log number of conversations received
42
+ - Log any errors
43
+
44
+ 2. **Add logging to renderChatHistory()**
45
+ - Log conversations.size
46
+ - Log if condition triggers "No chats yet"
47
+
48
+ 3. **Force initial render**
49
+ - Ensure renderChatHistory() is called after fetchConversations()
50
+ - Add retry logic if conversations empty on first load
51
+
52
+ ### Server (server.js)
53
+
54
+ 1. **Verify /api/conversations endpoint**
55
+ - Check it returns all conversations
56
+ - Verify no filtering happening
57
+ - Check response format
58
+
59
+ 2. **Verify import endpoint**
60
+ - Check /api/import/claude-code works
61
+ - Ensure conversations are created with proper agentId
62
+
63
+ ## Implementation
64
+
65
+ Add debug logging to identify where conversations are lost:
66
+
67
+ ```javascript
68
+ async fetchConversations() {
69
+ try {
70
+ const res = await fetch(BASE_URL + '/api/conversations');
71
+ const data = await res.json();
72
+ console.log('fetchConversations response:', data);
73
+ console.log('Conversations count:', data.conversations?.length);
74
+
75
+ if (data.conversations) {
76
+ this.conversations.clear();
77
+ data.conversations.forEach(c => {
78
+ console.log('Adding conversation:', c.id, c.title);
79
+ this.conversations.set(c.id, c);
80
+ });
81
+ console.log('Final conversations.size:', this.conversations.size);
82
+ }
83
+ } catch (e) {
84
+ console.error('fetchConversations error:', e);
85
+ }
86
+ }
87
+
88
+ renderChatHistory() {
89
+ const list = document.getElementById('chatList');
90
+ if (!list) {
91
+ console.error('chatList element not found!');
92
+ return;
93
+ }
94
+
95
+ console.log('renderChatHistory - conversations.size:', this.conversations.size);
96
+
97
+ if (this.conversations.size === 0) {
98
+ console.warn('No conversations to display');
99
+ list.innerHTML = '<p>No chats yet</p>';
100
+ return;
101
+ }
102
+
103
+ // ... rest of rendering
104
+ }
105
+ ```
106
+
107
+ ## Expected Behavior
108
+
109
+ 1. Page loads
110
+ 2. fetchConversations() retrieves 83 conversations from API
111
+ 3. conversations Map populated with all 83 items
112
+ 4. renderChatHistory() iterates over conversations
113
+ 5. Chat list displays 83 conversation items
114
+ 6. User can click to view any conversation
115
+
116
+ ## Testing
117
+
118
+ ```bash
119
+ # Verify conversations in database
120
+ curl http://localhost:9897/gm/api/conversations | python3 -m json.tool | grep -c '"id"'
121
+
122
+ # Verify a conversation has messages (pick one)
123
+ curl http://localhost:9897/gm/api/conversations/CONV_ID/messages
124
+ ```
125
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/static/app.js CHANGED
@@ -95,6 +95,7 @@ class GMGUIApp {
95
95
 
96
96
  async init() {
97
97
  console.log('[DEBUG] Init: Starting initialization');
98
+ console.log('[DEBUG] Init: BASE_URL =', BASE_URL);
98
99
  this.loadSettings();
99
100
  this.setupEventListeners();
100
101
  await this.fetchHome();
@@ -105,12 +106,14 @@ class GMGUIApp {
105
106
  console.log('[DEBUG] Init: Auto-imported Claude Code conversations');
106
107
  await this.fetchConversations();
107
108
  console.log('[DEBUG] Init: Fetched conversations, count:', this.conversations.size);
109
+ console.log('[DEBUG] Init: Conversation details:', Array.from(this.conversations.values()).slice(0, 3));
108
110
  this.connectSyncWebSocket();
109
111
  this.setupCrossTabSync();
110
112
  this.startPeriodicSync();
111
113
  console.log('[DEBUG] Init: About to renderAll with', this.conversations.size, 'conversations');
112
114
  this.renderAll();
113
115
  console.log('[DEBUG] Init: renderAll completed');
116
+ console.log('[DEBUG] Init: chatList innerHTML length:', document.getElementById('chatList')?.innerHTML?.length || 0);
114
117
  }
115
118
 
116
119
  startPeriodicSync() {
@@ -411,6 +414,10 @@ class GMGUIApp {
411
414
  }
412
415
  list.innerHTML = '';
413
416
  console.log('[DEBUG] renderChatHistory - conversations.size:', this.conversations.size);
417
+
418
+ // Debug: Update page title with conversation count
419
+ document.title = `GMGUI (${this.conversations.size} chats)`;
420
+
414
421
  if (this.conversations.size === 0) {
415
422
  console.warn('[DEBUG] No conversations to display - showing empty state');
416
423
  console.warn('[DEBUG] conversations map contents:', this.conversations);
@@ -421,6 +428,7 @@ class GMGUIApp {
421
428
  (a, b) => (b.updated_at || 0) - (a.updated_at || 0)
422
429
  );
423
430
  console.log('[DEBUG] renderChatHistory - sorted conversations count:', sorted.length);
431
+ console.log('[DEBUG] renderChatHistory - rendering', sorted.length, 'conversations');
424
432
  sorted.forEach(conv => {
425
433
  const item = document.createElement('button');
426
434
  item.className = `chat-item ${this.currentConversation === conv.id ? 'active' : ''}`;
@@ -1274,3 +1282,13 @@ function confirmFolderSelection() {
1274
1282
 
1275
1283
  const app = new GMGUIApp();
1276
1284
  window._app = app;
1285
+
1286
+ // Debug: Log app state to window for inspection
1287
+ window._debug = {
1288
+ get conversations() { return Array.from(app.conversations.values()).map(c => ({ id: c.id, title: c.title })); },
1289
+ get conversationCount() { return app.conversations.size; },
1290
+ get selectedAgent() { return app.selectedAgent; },
1291
+ get currentConversation() { return app.currentConversation; },
1292
+ checkChatListElement() { return document.getElementById('chatList'); },
1293
+ checkChatListChildCount() { return document.getElementById('chatList')?.children?.length || 0; }
1294
+ };