agentgui 1.0.855 → 1.0.857

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.
@@ -1,8 +1,11 @@
1
+ <<<<<<< HEAD
2
+ =======
1
3
  /**
2
4
  * AgentGUI Client
3
5
  * Main application orchestrator that integrates WebSocket, event processing,
4
6
  * and streaming renderer for real-time Claude Code execution visualization
5
7
  */
8
+ >>>>>>> 6bfde951cbeb65ec72b73da9c23b9c8c0ba0bbc1
6
9
 
7
10
  class AgentGUIClient {
8
11
  constructor(config = {}) {
@@ -14,13 +17,19 @@ class AgentGUIClient {
14
17
  ...config
15
18
  };
16
19
 
20
+ <<<<<<< HEAD
21
+ =======
17
22
  // Initialize components - reuse global wsManager/wsClient if available
23
+ >>>>>>> 6bfde951cbeb65ec72b73da9c23b9c8c0ba0bbc1
18
24
  this.renderer = new StreamingRenderer(config.renderer || {});
19
25
  this.wsManager = window.wsManager || new WebSocketManager(config.websocket || {});
20
26
  if (!window.wsManager) window.wsManager = this.wsManager;
21
27
  this.eventProcessor = new EventProcessor(config.eventProcessor || {});
22
28
 
29
+ <<<<<<< HEAD
30
+ =======
23
31
  // Application state
32
+ >>>>>>> 6bfde951cbeb65ec72b73da9c23b9c8c0ba0bbc1
24
33
  this.state = {
25
34
  isInitialized: false,
26
35
  currentSession: null,
@@ -31,6 +40,21 @@ class AgentGUIClient {
31
40
  agents: []
32
41
  };
33
42
 
43
+ <<<<<<< HEAD
44
+ this.conversationCache = new Map();
45
+ this.MAX_CACHE_SIZE = 10;
46
+
47
+ this.conversationListCache = {
48
+ data: [],
49
+ timestamp: 0,
50
+ ttl: 30000
51
+ };
52
+
53
+ this.draftPrompts = new Map();
54
+
55
+ this.eventHandlers = {};
56
+
57
+ =======
34
58
  // Conversation DOM cache: store rendered DOM + scroll position per conversationId
35
59
  this.conversationCache = new Map();
36
60
  this.MAX_CACHE_SIZE = 10;
@@ -49,6 +73,7 @@ class AgentGUIClient {
49
73
  this.eventHandlers = {};
50
74
 
51
75
  // UI state
76
+ >>>>>>> 6bfde951cbeb65ec72b73da9c23b9c8c0ba0bbc1
52
77
  this.ui = {
53
78
  statusIndicator: null,
54
79
  messageInput: null,
@@ -62,6 +87,17 @@ class AgentGUIClient {
62
87
  this._isLoadingConversation = false;
63
88
  this._modelCache = new Map();
64
89
 
90
+ <<<<<<< HEAD
91
+ this._renderedSeqs = {};
92
+ this._inflightRequests = new Map();
93
+ this._previousConvAbort = null;
94
+
95
+ this._bgCache = new Map();
96
+ this.BG_CACHE_MAX = 50;
97
+
98
+ this._loadInProgress = {};
99
+ this._currentRequestId = 0;
100
+ =======
65
101
  this._renderedSeqs = {}; // plain object: sessionId → Set<number>
66
102
  this._inflightRequests = new Map();
67
103
  this._previousConvAbort = null;
@@ -74,6 +110,7 @@ class AgentGUIClient {
74
110
  // PHASE 2: Request Lifetime Tracking
75
111
  this._loadInProgress = {}; // { [conversationId]: { requestId, abortController, timestamp, prevConversationId } }
76
112
  this._currentRequestId = 0; // Auto-incrementing request counter
113
+ >>>>>>> 6bfde951cbeb65ec72b73da9c23b9c8c0ba0bbc1
77
114
 
78
115
 
79
116
  this._scrollTarget = 0;
@@ -85,7 +122,10 @@ class AgentGUIClient {
85
122
  this._lastSendTime = 0;
86
123
  this._countdownTimer = null;
87
124
 
125
+ <<<<<<< HEAD
126
+ =======
88
127
  // Router state
128
+ >>>>>>> 6bfde951cbeb65ec72b73da9c23b9c8c0ba0bbc1
89
129
  this.routerState = {
90
130
  currentConversationId: null,
91
131
  currentSessionId: null
@@ -96,17 +136,25 @@ class AgentGUIClient {
96
136
 
97
137
  _dbg(...args) { if (this._debug) console.log('[AgentGUI]', ...args); }
98
138
 
139
+ <<<<<<< HEAD
140
+ =======
99
141
  /**
100
142
  * Initialize the client
101
143
  */
144
+ >>>>>>> 6bfde951cbeb65ec72b73da9c23b9c8c0ba0bbc1
102
145
  async init() {
103
146
  try {
104
147
  this._dbg('Initializing AgentGUI client');
105
148
 
149
+ <<<<<<< HEAD
150
+ const wsReady = this.config.autoConnect ? this.connectWebSocket() : Promise.resolve();
151
+
152
+ =======
106
153
  // Start WebSocket connection immediately (don't wait for UI setup)
107
154
  const wsReady = this.config.autoConnect ? this.connectWebSocket() : Promise.resolve();
108
155
 
109
156
  // Initialize renderer and UI in parallel with WS connection
157
+ >>>>>>> 6bfde951cbeb65ec72b73da9c23b9c8c0ba0bbc1
110
158
  this.renderer.init(this.config.outputContainerId, this.config.scrollContainerId);
111
159
 
112
160
  if (typeof ImageLoader !== 'undefined') {
@@ -117,7 +165,10 @@ class AgentGUIClient {
117
165
  this.setupRendererListeners();
118
166
  this.setupUI();
119
167
 
168
+ <<<<<<< HEAD
169
+ =======
120
170
  // Wait for WS, then load data in parallel
171
+ >>>>>>> 6bfde951cbeb65ec72b73da9c23b9c8c0ba0bbc1
121
172
  await wsReady;
122
173
  await Promise.all([
123
174
  this.loadAgents(),
@@ -125,10 +176,15 @@ class AgentGUIClient {
125
176
  this.checkSpeechStatus()
126
177
  ]);
127
178
 
179
+ <<<<<<< HEAD
180
+ this.enableControls();
181
+
182
+ =======
128
183
  // Enable controls for initial interaction
129
184
  this.enableControls();
130
185
 
131
186
  // Restore state from URL on page load
187
+ >>>>>>> 6bfde951cbeb65ec72b73da9c23b9c8c0ba0bbc1
132
188
  this.restoreStateFromUrl();
133
189
 
134
190
  this.state.isInitialized = true;
@@ -144,6 +200,8 @@ class AgentGUIClient {
144
200
  }
145
201
  }
146
202
 
203
+ <<<<<<< HEAD
204
+ =======
147
205
  /**
148
206
  * Setup WebSocket event listeners
149
207
  */
@@ -3552,6 +3610,7 @@ class AgentGUIClient {
3552
3610
  this.wsManager.destroy();
3553
3611
  this.eventHandlers = {};
3554
3612
  }
3613
+ >>>>>>> 6bfde951cbeb65ec72b73da9c23b9c8c0ba0bbc1
3555
3614
  }
3556
3615
 
3557
3616
  window.__convPerfMetrics = () => {
@@ -3559,6 +3618,11 @@ window.__convPerfMetrics = () => {
3559
3618
  return entries.map(e => ({ name: e.name, ms: Math.round(e.duration) }));
3560
3619
  };
3561
3620
 
3621
+ <<<<<<< HEAD
3622
+ let agentGUIClient = null;
3623
+
3624
+ document.addEventListener('DOMContentLoaded', async () => {
3625
+ =======
3562
3626
  function updateWelcomeScreen() {
3563
3627
  const welcomeScreen = document.getElementById('welcomeScreen');
3564
3628
  const outputScroll = document.getElementById('output-scroll');
@@ -3615,6 +3679,7 @@ let agentGUIClient = null;
3615
3679
  // Initialize on DOM ready
3616
3680
  document.addEventListener('DOMContentLoaded', async () => {
3617
3681
  updateWelcomeScreen();
3682
+ >>>>>>> 6bfde951cbeb65ec72b73da9c23b9c8c0ba0bbc1
3618
3683
  try {
3619
3684
  agentGUIClient = new AgentGUIClient();
3620
3685
  window.agentGuiClient = agentGUIClient;
@@ -3625,7 +3690,10 @@ document.addEventListener('DOMContentLoaded', async () => {
3625
3690
  }
3626
3691
  });
3627
3692
 
3693
+ <<<<<<< HEAD
3694
+ =======
3628
3695
  // Export for testing
3696
+ >>>>>>> 6bfde951cbeb65ec72b73da9c23b9c8c0ba0bbc1
3629
3697
  if (typeof module !== 'undefined' && module.exports) {
3630
3698
  module.exports = AgentGUIClient;
3631
3699
  }
@@ -1,3 +1,5 @@
1
+ <<<<<<< HEAD
2
+ =======
1
3
  /**
2
4
  * Conversations Module
3
5
  * Manages conversation list sidebar with real-time updates
@@ -23,6 +25,7 @@ function getAgentColor(agentId) {
23
25
  return key ? AGENT_COLORS[key] : AGENT_COLORS.default;
24
26
  }
25
27
 
28
+ >>>>>>> 6bfde951cbeb65ec72b73da9c23b9c8c0ba0bbc1
26
29
  function pathSplit(p) {
27
30
  return p.split(/[\/\\]/).filter(Boolean);
28
31
  }
@@ -134,6 +137,8 @@ class ConversationManager {
134
137
  return ' (' + model.replace(/^claude-/i, '').replace(/-\d{8,}.*$/, '').replace(/-/g, ' ') + ')';
135
138
  }
136
139
 
140
+ <<<<<<< HEAD
141
+ =======
137
142
  setupDelegatedListeners() {
138
143
  let draggedId = null;
139
144
  this.listEl.addEventListener('dragstart', (e) => {
@@ -801,11 +806,14 @@ class ConversationManager {
801
806
  });
802
807
  }
803
808
 
809
+ >>>>>>> 6bfde951cbeb65ec72b73da9c23b9c8c0ba0bbc1
804
810
  escapeHtml(text) {
805
811
  return window._escHtml(text);
806
812
  }
807
813
  }
808
814
 
815
+ <<<<<<< HEAD
816
+ =======
809
817
  if (document.readyState === 'loading') {
810
818
  document.addEventListener('DOMContentLoaded', () => {
811
819
  window.conversationManager = new ConversationManager();
@@ -813,3 +821,4 @@ if (document.readyState === 'loading') {
813
821
  } else {
814
822
  window.conversationManager = new ConversationManager();
815
823
  }
824
+ >>>>>>> 6bfde951cbeb65ec72b73da9c23b9c8c0ba0bbc1