Add 'reset state' debug option; fix kodu login flow after reset state; update Announcement

This commit is contained in:
Saoud Rizwan
2024-08-26 00:21:12 -04:00
parent 2d5c3ad63b
commit 4af5eee2a5
7 changed files with 78 additions and 24 deletions

View File

@@ -378,6 +378,9 @@ export class ClaudeDevProvider implements vscode.WebviewViewProvider {
await this.updateGlobalState("shouldShowKoduPromo", false)
await this.postStateToWebview()
break
case "resetState":
await this.resetState()
break
// Add more switch case statements here as more webview message commands
// are created within the webview context (i.e. inside media/main.js)
}
@@ -744,4 +747,24 @@ export class ClaudeDevProvider implements vscode.WebviewViewProvider {
private async getSecret(key: SecretKey) {
return await this.context.secrets.get(key)
}
// dev
async resetState() {
vscode.window.showInformationMessage("Resetting state...")
for (const key of this.context.globalState.keys()) {
await this.context.globalState.update(key, undefined)
}
const secretKeys: SecretKey[] = ["apiKey", "openRouterApiKey", "awsAccessKey", "awsSecretKey", "koduApiKey"]
for (const key of secretKeys) {
await this.storeSecret(key, undefined)
}
if (this.claudeDev) {
this.claudeDev.abortTask()
this.claudeDev = undefined
}
vscode.window.showInformationMessage("State reset")
await this.postStateToWebview()
await this.postMessageToWebview({ type: "action", action: "chatButtonTapped" })
}
}

View File

@@ -19,6 +19,7 @@ export interface WebviewMessage {
| "didClickKoduSignOut"
| "fetchKoduCredits"
| "didDismissKoduPromo"
| "resetState"
text?: string
askResponse?: ClaudeAskResponse
apiConfiguration?: ApiConfiguration