@@ -139,6 +139,21 @@ <h3 class="text-sm font-black text-black mb-2 flex items-center gap-1">
139
139
workspaceSection . style . transition = 'opacity 300ms ease-in-out' ;
140
140
}
141
141
142
+ // Debug: Global click logger to catch ALL clicks
143
+ document . addEventListener ( 'click' , function ( e ) {
144
+ const target = e . target ;
145
+ const button = target . closest ( 'button' ) ;
146
+ if ( button ) {
147
+ console . log ( '[GLOBAL CLICK DEBUG] Button clicked:' , {
148
+ button : button ,
149
+ onclick : button . getAttribute ( 'onclick' ) ,
150
+ classes : button . className ,
151
+ text : button . textContent . trim ( ) ,
152
+ target : target
153
+ } ) ;
154
+ }
155
+ } , true ) ; // Use capture phase to get it early
156
+
142
157
// Load actions from backend
143
158
loadActionsFromBackend ( ) ;
144
159
} ) ;
@@ -173,10 +188,13 @@ <h3 class="text-sm font-black text-black mb-2 flex items-center gap-1">
173
188
// Render agents (max 4)
174
189
const agentsContainer = document . getElementById ( 'agents-container' ) ;
175
190
if ( agentsContainer && data . agents ) {
191
+ console . log ( '[renderActions] Rendering agents:' , data . agents ) ;
176
192
agentsContainer . innerHTML = data . agents . slice ( 0 , 4 ) . map ( agent => {
177
193
const name = agent . name || 'Unknown' ;
194
+ console . log ( '[renderActions] Processing agent:' , agent , 'name:' , name ) ;
195
+ const escapedName = name . replace ( / ' / g, "\\'" ) . replace ( / " / g, '\\"' ) ;
178
196
return `
179
- <button class="action-button action-button--primary" onclick="addAgent('${ name . replace ( / ' / g , "\\'" ) } ')">
197
+ <button class="action-button action-button--primary" onclick="addAgent('${ escapedName } ')">
180
198
<div class="action-button__plus">+</div>
181
199
<div class="action-button__content">
182
200
<span class="action-button__label">${ name } </span>
@@ -261,24 +279,27 @@ <h3 class="text-sm font-black text-black mb-2 flex items-center gap-1">
261
279
262
280
// Action functions that use backend data
263
281
function addAgent ( name ) {
282
+ console . log ( '[addAgent] Called with name:' , name ) ;
264
283
if ( ! name || name === 'Unknown' ) {
265
- console . error ( 'Invalid agent name' ) ;
284
+ console . error ( '[addAgent] Invalid agent name:' , name ) ;
266
285
return ;
267
286
}
268
287
createNewContextAndInstallAgent ( name ) ;
269
288
}
270
289
271
290
function addRule ( name ) {
291
+ console . log ( '[addRule] Called with name:' , name ) ;
272
292
if ( ! name || name === 'Unknown' ) {
273
- console . error ( 'Invalid rule name' ) ;
293
+ console . error ( '[addRule] Invalid rule name:' , name ) ;
274
294
return ;
275
295
}
276
296
createNewContextAndInsertRule ( name ) ;
277
297
}
278
298
279
299
function addMCP ( name ) {
300
+ console . log ( '[addMCP] Called with name:' , name ) ;
280
301
if ( ! name || name === 'Unknown' ) {
281
- console . error ( 'Invalid MCP name' ) ;
302
+ console . error ( '[addMCP] Invalid MCP name:' , name ) ;
282
303
return ;
283
304
}
284
305
createNewContextAndInstallMCP ( name ) ;
0 commit comments