Skip to content

Commit c4fdbe3

Browse files
committed
test
1 parent f878c35 commit c4fdbe3

File tree

3 files changed

+58
-6
lines changed

3 files changed

+58
-6
lines changed

app/static/js/monaco_editor.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,31 @@ function initializeWorkspaceEditor() {
5050
}
5151

5252
function insertTextAtCursor(text) {
53-
if (!workspaceMonacoEditor) return;
53+
console.log('[insertTextAtCursor] Called with text:', text);
54+
console.log('[insertTextAtCursor] Type of text:', typeof text);
55+
console.trace('Stack trace for insertTextAtCursor');
56+
57+
if (!workspaceMonacoEditor) {
58+
console.error('[insertTextAtCursor] No workspace editor available');
59+
return;
60+
}
61+
62+
if (text === 'Unknown' || text === undefined || text === null || text === 'undefined') {
63+
console.error('[insertTextAtCursor] WARNING: Attempting to insert problematic text:', text);
64+
console.trace('Stack trace for problematic insertion');
65+
// Block insertion of "Unknown"
66+
return;
67+
}
5468

5569
const selection = workspaceMonacoEditor.getSelection();
5670
const position = selection.getStartPosition();
5771

72+
console.log('[insertTextAtCursor] Executing edit at position:', position);
5873
workspaceMonacoEditor.executeEdits('quickaction-insert', [{
5974
range: new monaco.Range(position.lineNumber, position.column, position.lineNumber, position.column),
6075
text: text
6176
}]);
62-
console.log("Inserted text:", text);
77+
console.log("[insertTextAtCursor] Successfully inserted text:", text);
6378

6479
// Move cursor to end of inserted text
6580
const newPosition = new monaco.Position(position.lineNumber, position.column + text.length);

app/templates/base.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,22 @@
2626
{% include 'components/styles.html' %}
2727
</head>
2828
<body class="bg-gradient-to-br from-pink-50 to-cyan-50 min-h-screen flex flex-col" style="font-family: 'Plus Jakarta Sans', sans-serif;">
29+
<script>
30+
// Global debug for Unknown issue
31+
console.log('[DEBUG] Page loaded at', new Date().toISOString());
32+
33+
// Monitor for Unknown text being added
34+
let checkInterval = setInterval(() => {
35+
if (window.workspaceMonacoEditor && window.workspaceMonacoEditor.getValue) {
36+
const value = window.workspaceMonacoEditor.getValue();
37+
if (value && value.includes('Unknown')) {
38+
console.error('[MONITOR] Found "Unknown" in editor!');
39+
console.trace('Stack trace when Unknown detected');
40+
clearInterval(checkInterval); // Stop checking once found
41+
}
42+
}
43+
}, 500);
44+
</script>
2945
{% include 'components/navbar.html' %}
3046

3147
<main class="flex-1 w-full">

app/templates/components/quick_actions.html

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,21 @@ <h3 class="text-sm font-black text-black mb-2 flex items-center gap-1">
139139
workspaceSection.style.transition = 'opacity 300ms ease-in-out';
140140
}
141141

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+
142157
// Load actions from backend
143158
loadActionsFromBackend();
144159
});
@@ -173,10 +188,13 @@ <h3 class="text-sm font-black text-black mb-2 flex items-center gap-1">
173188
// Render agents (max 4)
174189
const agentsContainer = document.getElementById('agents-container');
175190
if (agentsContainer && data.agents) {
191+
console.log('[renderActions] Rendering agents:', data.agents);
176192
agentsContainer.innerHTML = data.agents.slice(0, 4).map(agent => {
177193
const name = agent.name || 'Unknown';
194+
console.log('[renderActions] Processing agent:', agent, 'name:', name);
195+
const escapedName = name.replace(/'/g, "\\'").replace(/"/g, '\\"');
178196
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}')">
180198
<div class="action-button__plus">+</div>
181199
<div class="action-button__content">
182200
<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">
261279

262280
// Action functions that use backend data
263281
function addAgent(name) {
282+
console.log('[addAgent] Called with name:', name);
264283
if (!name || name === 'Unknown') {
265-
console.error('Invalid agent name');
284+
console.error('[addAgent] Invalid agent name:', name);
266285
return;
267286
}
268287
createNewContextAndInstallAgent(name);
269288
}
270289

271290
function addRule(name) {
291+
console.log('[addRule] Called with name:', name);
272292
if (!name || name === 'Unknown') {
273-
console.error('Invalid rule name');
293+
console.error('[addRule] Invalid rule name:', name);
274294
return;
275295
}
276296
createNewContextAndInsertRule(name);
277297
}
278298

279299
function addMCP(name) {
300+
console.log('[addMCP] Called with name:', name);
280301
if (!name || name === 'Unknown') {
281-
console.error('Invalid MCP name');
302+
console.error('[addMCP] Invalid MCP name:', name);
282303
return;
283304
}
284305
createNewContextAndInstallMCP(name);

0 commit comments

Comments
 (0)