Fix dynamic cog menu updates and improve override file UI

- Changed 'Override Prompt' to contextual text:
  - '📁 Create Override File' when file doesn't exist
  - '📁 Recreate Override File' when file exists
- Added dynamic webview updating after override file creation
- Fixed cog menu not showing reload option when override created during session
- Added updateOverrideFileExists message handler to refresh menu state
- Fixed character encoding issues in webview menu options
This commit is contained in:
B Harper
2025-10-23 15:39:41 +11:00
parent 0f1b5fa820
commit 20fba4fb96
2 changed files with 16 additions and 2 deletions
+2
View File
@@ -1444,3 +1444,5 @@ Hey Ben! Your MCP server is running and I'm here to chat. What's on your mind to
[2025-10-23T03:36:07.981Z] Independent server started successfully and is responding
[2025-10-23T03:36:17.577Z] ServerManager disposed
[2025-10-23T03:43:20.831Z] ServerManager disposed
[2025-10-23T03:49:26.833Z] ServerManager disposed
[2025-10-23T04:35:00.860Z] ServerManager disposed
+14 -2
View File
@@ -395,6 +395,14 @@ export class ChatWebviewProvider implements vscode.WebviewViewProvider {
// Write the file
fs.writeFileSync(overrideFilePath, JSON.stringify(overrideConfig, null, 2));
// Update webview to reflect that override file now exists
if (this._view) {
this._view.webview.postMessage({
command: 'updateOverrideFileExists',
exists: true
});
}
vscode.window.showInformationMessage(
`Override file created at ${overrideFilePath}. Modify the tool configuration as needed.`,
'Open File'
@@ -908,7 +916,7 @@ export class ChatWebviewProvider implements vscode.WebviewViewProvider {
{ text: '📦 Install Globally', action: 'register' },
{ text: '📁 Install in Workspace', action: 'register' },
{ text: '📊 Show Status', action: 'requestServerStatus' },
{ text: '🛠️ Override Prompt', action: 'overridePrompt' }
{ text: window.overrideFileExists ? '📁 Recreate Override File' : '📁 Create Override File', action: 'overridePrompt' }
];
// Check for override file existence even when status unknown
@@ -934,7 +942,7 @@ export class ChatWebviewProvider implements vscode.WebviewViewProvider {
}
options.push({ text: '📊 Show Status', action: 'requestServerStatus' });
options.push({ text: '🛠️ Override Prompt', action: 'overridePrompt' });
options.push({ text: window.overrideFileExists ? '📁 Recreate Override File' : '📁 Create Override File', action: 'overridePrompt' });
// Check for HumanAgentOverride.json file existence (passed from extension)
if (window.overrideFileExists) {
@@ -992,6 +1000,10 @@ export class ChatWebviewProvider implements vscode.WebviewViewProvider {
// Play notification sound
console.log('Playing notification sound...');
playNotificationBeep();
} else if (message.command === 'updateOverrideFileExists') {
// Update override file existence and refresh cog menu
window.overrideFileExists = message.exists;
console.log('Updated overrideFileExists to:', message.exists);
}
});