agentgui 1.0.660 → 1.0.662
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/lib/claude-runner.js +4 -1
- package/package.json +1 -1
- package/static/index.html +1 -1
- package/static/js/client.js +25 -0
- package/static/js/conversations.js +20 -4
package/lib/claude-runner.js
CHANGED
|
@@ -114,6 +114,7 @@ class AgentRunner {
|
|
|
114
114
|
let retryAfterSec = 60;
|
|
115
115
|
let authError = false;
|
|
116
116
|
let authErrorMessage = '';
|
|
117
|
+
let stderrBuffer = '';
|
|
117
118
|
|
|
118
119
|
const timeoutHandle = setTimeout(() => {
|
|
119
120
|
timedOut = true;
|
|
@@ -158,6 +159,7 @@ class AgentRunner {
|
|
|
158
159
|
|
|
159
160
|
if (proc.stderr) proc.stderr.on('data', (chunk) => {
|
|
160
161
|
const errorText = chunk.toString();
|
|
162
|
+
stderrBuffer += errorText;
|
|
161
163
|
console.error(`[${this.id}] stderr:`, errorText);
|
|
162
164
|
|
|
163
165
|
const authMatch = errorText.match(/401|unauthorized|invalid.*auth|invalid.*token|auth.*failed|permission denied|access denied/i);
|
|
@@ -242,7 +244,8 @@ class AgentRunner {
|
|
|
242
244
|
if (code === 0 || outputs.length > 0) {
|
|
243
245
|
resolve({ outputs, sessionId });
|
|
244
246
|
} else {
|
|
245
|
-
|
|
247
|
+
const stderrHint = stderrBuffer.trim() ? `: ${stderrBuffer.trim().slice(0, 200)}` : '';
|
|
248
|
+
reject(new Error(`${this.name} exited with code ${code}${stderrHint}`));
|
|
246
249
|
}
|
|
247
250
|
});
|
|
248
251
|
|
package/package.json
CHANGED
package/static/index.html
CHANGED
|
@@ -3047,7 +3047,7 @@
|
|
|
3047
3047
|
<button class="clone-cancel-btn" id="cloneCancelBtn" title="Cancel">×</button>
|
|
3048
3048
|
</div>
|
|
3049
3049
|
<ul class="sidebar-list" data-conversation-list>
|
|
3050
|
-
<li class="sidebar-empty" data-conversation-empty>
|
|
3050
|
+
<li class="sidebar-empty" data-conversation-empty>Loading...</li>
|
|
3051
3051
|
</ul>
|
|
3052
3052
|
<!-- PM2 Monitor Panel: hidden until active processes detected -->
|
|
3053
3053
|
<div class="pm2-monitor-panel" id="pm2MonitorPanel" style="display:none">
|
package/static/js/client.js
CHANGED
|
@@ -1156,6 +1156,16 @@ class AgentGUIClient {
|
|
|
1156
1156
|
if (indicator) {
|
|
1157
1157
|
indicator.innerHTML = `<span style="color:var(--color-error);">Error: ${this.escapeHtml(data.error || 'Unknown error')}</span>`;
|
|
1158
1158
|
}
|
|
1159
|
+
} else {
|
|
1160
|
+
const outputEl3 = document.getElementById('output');
|
|
1161
|
+
const messagesEl3 = outputEl3 && outputEl3.querySelector('.conversation-messages');
|
|
1162
|
+
if (messagesEl3 && data.error) {
|
|
1163
|
+
const errDiv = document.createElement('div');
|
|
1164
|
+
errDiv.className = 'message';
|
|
1165
|
+
errDiv.style = 'padding:0.75rem;border:1px solid var(--color-error, #e53e3e);border-radius:4px;margin:0.5rem 0;';
|
|
1166
|
+
errDiv.innerHTML = `<span style="color:var(--color-error, #e53e3e);">Error: ${this.escapeHtml(data.error)}</span>`;
|
|
1167
|
+
messagesEl3.appendChild(errDiv);
|
|
1168
|
+
}
|
|
1159
1169
|
}
|
|
1160
1170
|
|
|
1161
1171
|
this.unlockAgentAndModel();
|
|
@@ -2891,6 +2901,21 @@ class AgentGUIClient {
|
|
|
2891
2901
|
messagesEl.appendChild(this.renderMessagesFragment(allMessages || []));
|
|
2892
2902
|
}
|
|
2893
2903
|
|
|
2904
|
+
if (shouldResumeStreaming && latestSession && chunks.length === 0) {
|
|
2905
|
+
const streamDiv = document.createElement('div');
|
|
2906
|
+
streamDiv.id = `streaming-${latestSession.id}`;
|
|
2907
|
+
streamDiv.className = 'streaming-message';
|
|
2908
|
+
const indicatorDiv = document.createElement('div');
|
|
2909
|
+
indicatorDiv.className = 'streaming-indicator';
|
|
2910
|
+
indicatorDiv.style = 'display:flex;align-items:center;gap:0.5rem;padding:0.5rem 0;color:var(--color-text-secondary);font-size:0.875rem;';
|
|
2911
|
+
indicatorDiv.innerHTML = `
|
|
2912
|
+
<span class="animate-spin" style="display:inline-block;width:1rem;height:1rem;border:2px solid var(--color-border);border-top-color:var(--color-primary);border-radius:50%;"></span>
|
|
2913
|
+
<span class="streaming-indicator-label">Agent is starting...</span>
|
|
2914
|
+
`;
|
|
2915
|
+
streamDiv.appendChild(indicatorDiv);
|
|
2916
|
+
messagesEl.appendChild(streamDiv);
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2894
2919
|
if (shouldResumeStreaming && latestSession) {
|
|
2895
2920
|
this.state.streamingConversations.set(conversationId, true);
|
|
2896
2921
|
this.state.currentSession = {
|
|
@@ -46,13 +46,14 @@ class ConversationManager {
|
|
|
46
46
|
async init() {
|
|
47
47
|
this.newBtn?.addEventListener('click', () => this.openFolderBrowser());
|
|
48
48
|
this.setupDelegatedListeners();
|
|
49
|
-
|
|
50
|
-
this.loadConversations();
|
|
49
|
+
this.showLoading();
|
|
51
50
|
this.setupWebSocketListener();
|
|
52
51
|
this.setupFolderBrowser();
|
|
53
52
|
this.setupCloneUI();
|
|
54
53
|
this.setupDeleteAllButton();
|
|
55
54
|
|
|
55
|
+
await Promise.all([this.loadAgents(), this.loadConversations()]);
|
|
56
|
+
|
|
56
57
|
this._pollInterval = setInterval(() => this.loadConversations(), 30000);
|
|
57
58
|
|
|
58
59
|
window.addEventListener('beforeunload', () => this.destroy());
|
|
@@ -67,7 +68,10 @@ class ConversationManager {
|
|
|
67
68
|
|
|
68
69
|
async loadAgents() {
|
|
69
70
|
try {
|
|
70
|
-
const
|
|
71
|
+
const base = window.__BASE_URL || '/gm';
|
|
72
|
+
const res = await fetch(base + '/api/agents');
|
|
73
|
+
if (!res.ok) throw new Error('HTTP ' + res.status);
|
|
74
|
+
const data = await res.json();
|
|
71
75
|
for (const agent of data.agents || []) {
|
|
72
76
|
this.agents.set(agent.id, agent);
|
|
73
77
|
}
|
|
@@ -409,9 +413,21 @@ class ConversationManager {
|
|
|
409
413
|
}
|
|
410
414
|
}
|
|
411
415
|
|
|
416
|
+
showLoading() {
|
|
417
|
+
if (!this.listEl) return;
|
|
418
|
+
this.listEl.innerHTML = '';
|
|
419
|
+
if (this.emptyEl) {
|
|
420
|
+
this.emptyEl.textContent = 'Loading...';
|
|
421
|
+
this.emptyEl.style.display = 'block';
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
412
425
|
async loadConversations() {
|
|
413
426
|
try {
|
|
414
|
-
const
|
|
427
|
+
const base = window.__BASE_URL || '/gm';
|
|
428
|
+
const res = await fetch(base + '/api/conversations');
|
|
429
|
+
if (!res.ok) throw new Error('HTTP ' + res.status);
|
|
430
|
+
const data = await res.json();
|
|
415
431
|
const convList = data.conversations || [];
|
|
416
432
|
|
|
417
433
|
this._updateConversations(convList, 'poll');
|