agentgui 1.0.27 → 1.0.28
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/package.json +1 -1
- package/static/app.js +62 -31
package/package.json
CHANGED
package/static/app.js
CHANGED
|
@@ -90,7 +90,13 @@ class GMGUIApp {
|
|
|
90
90
|
this.settings = { autoScroll: true, connectTimeout: 30000 };
|
|
91
91
|
this.pendingMessages = new Map();
|
|
92
92
|
this.idempotencyKeys = new Map();
|
|
93
|
-
|
|
93
|
+
|
|
94
|
+
// Start async initialization and handle errors
|
|
95
|
+
this.initPromise = this.init().catch(err => {
|
|
96
|
+
console.error('[CRITICAL] GMGUIApp.init() failed:', err);
|
|
97
|
+
console.error('[CRITICAL] Stack:', err.stack);
|
|
98
|
+
throw err;
|
|
99
|
+
});
|
|
94
100
|
}
|
|
95
101
|
|
|
96
102
|
async init() {
|
|
@@ -1336,37 +1342,62 @@ function confirmFolderSelection() {
|
|
|
1336
1342
|
|
|
1337
1343
|
// Wait for DOM to be fully ready before initializing
|
|
1338
1344
|
function initializeApp() {
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
window.app.
|
|
1364
|
-
|
|
1365
|
-
return
|
|
1345
|
+
try {
|
|
1346
|
+
console.log('[DEBUG] initializeApp: Checking if DOM is ready');
|
|
1347
|
+
const chatList = document.getElementById('chatList');
|
|
1348
|
+
if (!chatList) {
|
|
1349
|
+
console.warn('[DEBUG] initializeApp: chatList not found, waiting 100ms');
|
|
1350
|
+
setTimeout(initializeApp, 100);
|
|
1351
|
+
return;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
console.log('[DEBUG] initializeApp: DOM is ready, creating GMGUIApp');
|
|
1355
|
+
try {
|
|
1356
|
+
window.app = new GMGUIApp();
|
|
1357
|
+
window._app = window.app;
|
|
1358
|
+
console.log('[DEBUG] initializeApp: GMGUIApp constructor completed');
|
|
1359
|
+
} catch (constructorError) {
|
|
1360
|
+
console.error('[ERROR] GMGUIApp constructor failed:', constructorError.message);
|
|
1361
|
+
console.error('[ERROR] Stack:', constructorError.stack);
|
|
1362
|
+
throw constructorError;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
// Debug: Log app state to window for inspection
|
|
1366
|
+
window._debug = {
|
|
1367
|
+
get conversations() { return Array.from(window.app.conversations.values()).map(c => ({ id: c.id, title: c.title })); },
|
|
1368
|
+
get conversationCount() { return window.app.conversations.size; },
|
|
1369
|
+
get selectedAgent() { return window.app.selectedAgent; },
|
|
1370
|
+
get currentConversation() { return window.app.currentConversation; },
|
|
1371
|
+
checkChatListElement() { return document.getElementById('chatList'); },
|
|
1372
|
+
checkChatListChildCount() { return document.getElementById('chatList')?.children?.length || 0; },
|
|
1373
|
+
async forceRefetch() {
|
|
1374
|
+
console.log('[FORCE] Forcing fetchConversations...');
|
|
1375
|
+
await window.app.fetchConversations();
|
|
1376
|
+
console.log('[FORCE] Conversations loaded:', window.app.conversations.size);
|
|
1377
|
+
window.app.renderChatHistory();
|
|
1378
|
+
console.log('[FORCE] renderChatHistory called');
|
|
1379
|
+
return window.app.conversations.size;
|
|
1380
|
+
}
|
|
1381
|
+
};
|
|
1382
|
+
|
|
1383
|
+
console.log('[DEBUG] initializeApp: GMGUIApp created successfully with', window.app.conversations.size, 'conversations');
|
|
1384
|
+
} catch (error) {
|
|
1385
|
+
console.error('[CRITICAL ERROR] initializeApp failed:', error.message);
|
|
1386
|
+
console.error('[CRITICAL ERROR] Stack trace:', error.stack);
|
|
1387
|
+
|
|
1388
|
+
// Show error on page
|
|
1389
|
+
const chatList = document.getElementById('chatList');
|
|
1390
|
+
if (chatList) {
|
|
1391
|
+
chatList.innerHTML = `
|
|
1392
|
+
<div style="color: red; padding: 1rem; font-family: monospace; font-size: 0.75rem;">
|
|
1393
|
+
<strong>INITIALIZATION ERROR</strong><br>
|
|
1394
|
+
${error.message}<br>
|
|
1395
|
+
<br>
|
|
1396
|
+
Check browser console (F12) for details.
|
|
1397
|
+
</div>
|
|
1398
|
+
`;
|
|
1366
1399
|
}
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
console.log('[DEBUG] initializeApp: GMGUIApp created successfully');
|
|
1400
|
+
}
|
|
1370
1401
|
}
|
|
1371
1402
|
|
|
1372
1403
|
if (document.readyState === 'loading') {
|