mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Add 'reset state' debug option; fix kodu login flow after reset state; update Announcement
This commit is contained in:
@@ -378,6 +378,9 @@ export class ClaudeDevProvider implements vscode.WebviewViewProvider {
|
|||||||
await this.updateGlobalState("shouldShowKoduPromo", false)
|
await this.updateGlobalState("shouldShowKoduPromo", false)
|
||||||
await this.postStateToWebview()
|
await this.postStateToWebview()
|
||||||
break
|
break
|
||||||
|
case "resetState":
|
||||||
|
await this.resetState()
|
||||||
|
break
|
||||||
// Add more switch case statements here as more webview message commands
|
// Add more switch case statements here as more webview message commands
|
||||||
// are created within the webview context (i.e. inside media/main.js)
|
// 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) {
|
private async getSecret(key: SecretKey) {
|
||||||
return await this.context.secrets.get(key)
|
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" })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export interface WebviewMessage {
|
|||||||
| "didClickKoduSignOut"
|
| "didClickKoduSignOut"
|
||||||
| "fetchKoduCredits"
|
| "fetchKoduCredits"
|
||||||
| "didDismissKoduPromo"
|
| "didDismissKoduPromo"
|
||||||
|
| "resetState"
|
||||||
text?: string
|
text?: string
|
||||||
askResponse?: ClaudeAskResponse
|
askResponse?: ClaudeAskResponse
|
||||||
apiConfiguration?: ApiConfiguration
|
apiConfiguration?: ApiConfiguration
|
||||||
|
|||||||
@@ -33,8 +33,9 @@ const App: React.FC = () => {
|
|||||||
const [taskHistory, setTaskHistory] = useState<HistoryItem[]>([])
|
const [taskHistory, setTaskHistory] = useState<HistoryItem[]>([])
|
||||||
const [showAnnouncement, setShowAnnouncement] = useState(false)
|
const [showAnnouncement, setShowAnnouncement] = useState(false)
|
||||||
const [koduCredits, setKoduCredits] = useState<number | undefined>(undefined)
|
const [koduCredits, setKoduCredits] = useState<number | undefined>(undefined)
|
||||||
const [isNewUser, setIsNewUser] = useState(false)
|
|
||||||
const [shouldShowKoduPromo, setShouldShowKoduPromo] = useState(true)
|
const [shouldShowKoduPromo, setShouldShowKoduPromo] = useState(true)
|
||||||
|
const [didAuthKoduFromWelcome, setDidAuthKoduFromWelcome] = useState<boolean>(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
vscode.postMessage({ type: "webviewDidLaunch" })
|
vscode.postMessage({ type: "webviewDidLaunch" })
|
||||||
}, [])
|
}, [])
|
||||||
@@ -51,8 +52,8 @@ const App: React.FC = () => {
|
|||||||
message.state!.apiConfiguration?.awsAccessKey !== undefined ||
|
message.state!.apiConfiguration?.awsAccessKey !== undefined ||
|
||||||
message.state!.apiConfiguration?.koduApiKey !== undefined
|
message.state!.apiConfiguration?.koduApiKey !== undefined
|
||||||
setShowWelcome(!hasKey)
|
setShowWelcome(!hasKey)
|
||||||
if (!hasKey && !isNewUser) {
|
if (!hasKey) {
|
||||||
setIsNewUser(true)
|
setDidAuthKoduFromWelcome(false)
|
||||||
}
|
}
|
||||||
setApiConfiguration(message.state!.apiConfiguration)
|
setApiConfiguration(message.state!.apiConfiguration)
|
||||||
setMaxRequestsPerTask(
|
setMaxRequestsPerTask(
|
||||||
@@ -88,31 +89,25 @@ const App: React.FC = () => {
|
|||||||
setShowSettings(false)
|
setShowSettings(false)
|
||||||
setShowHistory(false)
|
setShowHistory(false)
|
||||||
break
|
break
|
||||||
|
case "koduCreditsFetched":
|
||||||
|
setKoduCredits(message.state!.koduCredits)
|
||||||
|
break
|
||||||
case "koduAuthenticated":
|
case "koduAuthenticated":
|
||||||
if (!isNewUser) {
|
if (!didAuthKoduFromWelcome) {
|
||||||
setShowSettings(true)
|
setShowSettings(true)
|
||||||
setShowHistory(false)
|
setShowHistory(false)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case "koduCreditsFetched":
|
|
||||||
setKoduCredits(message.state!.koduCredits)
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
// (react-use takes care of not registering the same listener multiple times even if this callback is updated.)
|
// (react-use takes care of not registering the same listener multiple times even if this callback is updated.)
|
||||||
},
|
},
|
||||||
[isNewUser]
|
[didAuthKoduFromWelcome]
|
||||||
)
|
)
|
||||||
|
|
||||||
useEvent("message", handleMessage)
|
useEvent("message", handleMessage)
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (showWelcome === false) {
|
|
||||||
setIsNewUser(false)
|
|
||||||
}
|
|
||||||
}, [showWelcome])
|
|
||||||
|
|
||||||
const { selectedModelInfo } = useMemo(() => {
|
const { selectedModelInfo } = useMemo(() => {
|
||||||
return normalizeApiConfiguration(apiConfiguration)
|
return normalizeApiConfiguration(apiConfiguration)
|
||||||
}, [apiConfiguration])
|
}, [apiConfiguration])
|
||||||
@@ -128,6 +123,7 @@ const App: React.FC = () => {
|
|||||||
apiConfiguration={apiConfiguration}
|
apiConfiguration={apiConfiguration}
|
||||||
setApiConfiguration={setApiConfiguration}
|
setApiConfiguration={setApiConfiguration}
|
||||||
vscodeUriScheme={vscodeUriScheme}
|
vscodeUriScheme={vscodeUriScheme}
|
||||||
|
setDidAuthKoduFromWelcome={setDidAuthKoduFromWelcome}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -32,11 +32,11 @@ const Announcement = ({ version, hideAnnouncement, apiConfiguration, vscodeUriSc
|
|||||||
🎉{" "}New in v{version}
|
🎉{" "}New in v{version}
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<ul style={{ margin: "0 0 8px", paddingLeft: "20px" }}>
|
<ul style={{ margin: "0 0 8px", paddingLeft: "12px" }}>
|
||||||
<li>
|
<li>
|
||||||
Excited to announce that we've partnered with Anthropic and are offering $20 free credits to help
|
Excited to announce that we've partnered with Anthropic and are offering <b>$20 free credits</b> to
|
||||||
users get the most out of Claude Dev with high rate limits and prompt caching! Stay tuned for some
|
help users get the most out of Claude Dev with increased rate limits and prompt caching! Stay tuned
|
||||||
exciting updates like easier billing, voice mode and one click deployment.
|
for some exciting updates like easier billing, voice mode and one click deployment!
|
||||||
{apiConfiguration?.koduApiKey === undefined && (
|
{apiConfiguration?.koduApiKey === undefined && (
|
||||||
<VSCodeButtonLink
|
<VSCodeButtonLink
|
||||||
appearance="secondary"
|
appearance="secondary"
|
||||||
@@ -44,17 +44,17 @@ const Announcement = ({ version, hideAnnouncement, apiConfiguration, vscodeUriSc
|
|||||||
style={{
|
style={{
|
||||||
transform: "scale(0.85)",
|
transform: "scale(0.85)",
|
||||||
transformOrigin: "left center",
|
transformOrigin: "left center",
|
||||||
margin: "4px 0 2px 0",
|
margin: "4px -30px 2px 0",
|
||||||
}}>
|
}}>
|
||||||
Claim $20 Free Credits with Kodu
|
Claim $20 Credits on Kodu
|
||||||
</VSCodeButtonLink>
|
</VSCodeButtonLink>
|
||||||
)}
|
)}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Added "Always allow read-only operations" setting to let Claude read files and view directories
|
Added "Always allow read-only operations" setting to let Claude read files and view directories
|
||||||
without needing to approve (off by default)
|
without needing to approve (off by default).
|
||||||
</li>
|
</li>
|
||||||
<li>Added sliding window context management to keep tasks going past 200k tokens</li>
|
<li>Added sliding window context management to keep tasks going past 200k tokens.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p style={{ margin: "0" }}>
|
<p style={{ margin: "0" }}>
|
||||||
Follow me for more updates!{" "}
|
Follow me for more updates!{" "}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ interface ApiOptionsProps {
|
|||||||
koduCredits?: number
|
koduCredits?: number
|
||||||
apiErrorMessage?: string
|
apiErrorMessage?: string
|
||||||
vscodeUriScheme?: string
|
vscodeUriScheme?: string
|
||||||
|
setDidAuthKodu?: React.Dispatch<React.SetStateAction<boolean>>
|
||||||
}
|
}
|
||||||
|
|
||||||
const ApiOptions: React.FC<ApiOptionsProps> = ({
|
const ApiOptions: React.FC<ApiOptionsProps> = ({
|
||||||
@@ -35,6 +36,7 @@ const ApiOptions: React.FC<ApiOptionsProps> = ({
|
|||||||
koduCredits,
|
koduCredits,
|
||||||
apiErrorMessage,
|
apiErrorMessage,
|
||||||
vscodeUriScheme,
|
vscodeUriScheme,
|
||||||
|
setDidAuthKodu,
|
||||||
}) => {
|
}) => {
|
||||||
const [, setDidFetchKoduCredits] = useState(false)
|
const [, setDidFetchKoduCredits] = useState(false)
|
||||||
const handleInputChange = (field: keyof ApiConfiguration) => (event: any) => {
|
const handleInputChange = (field: keyof ApiConfiguration) => (event: any) => {
|
||||||
@@ -192,7 +194,9 @@ const ApiOptions: React.FC<ApiOptionsProps> = ({
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<div style={{ margin: "4px 0px" }}>
|
<div style={{ margin: "4px 0px" }}>
|
||||||
<VSCodeButtonLink href={getKoduSignInUrl(vscodeUriScheme)}>
|
<VSCodeButtonLink
|
||||||
|
href={getKoduSignInUrl(vscodeUriScheme)}
|
||||||
|
onClick={() => setDidAuthKodu?.(true)}>
|
||||||
Sign in to Kodu
|
Sign in to Kodu
|
||||||
</VSCodeButtonLink>
|
</VSCodeButtonLink>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import { validateApiConfiguration, validateMaxRequestsPerTask } from "../utils/v
|
|||||||
import { vscode } from "../utils/vscode"
|
import { vscode } from "../utils/vscode"
|
||||||
import ApiOptions from "./ApiOptions"
|
import ApiOptions from "./ApiOptions"
|
||||||
|
|
||||||
|
const IS_DEV = true
|
||||||
|
|
||||||
type SettingsViewProps = {
|
type SettingsViewProps = {
|
||||||
version: string
|
version: string
|
||||||
apiConfiguration?: ApiConfiguration
|
apiConfiguration?: ApiConfiguration
|
||||||
@@ -79,6 +81,10 @@ const SettingsView = ({
|
|||||||
If we only want to run code once on mount we can use react-use's useEffectOnce or useMount
|
If we only want to run code once on mount we can use react-use's useEffectOnce or useMount
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const handleResetState = () => {
|
||||||
|
vscode.postMessage({ type: "resetState" })
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
@@ -183,6 +189,23 @@ const SettingsView = ({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{IS_DEV && (
|
||||||
|
<>
|
||||||
|
<div style={{ marginTop: "10px", marginBottom: "4px" }}>Debug</div>
|
||||||
|
<VSCodeButton onClick={handleResetState} style={{ marginTop: "5px", width: "auto" }}>
|
||||||
|
Reset State
|
||||||
|
</VSCodeButton>
|
||||||
|
<p
|
||||||
|
style={{
|
||||||
|
fontSize: "12px",
|
||||||
|
marginTop: "5px",
|
||||||
|
color: "var(--vscode-descriptionForeground)",
|
||||||
|
}}>
|
||||||
|
This will reset all global state and secret storage in the extension.
|
||||||
|
</p>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
|
|||||||
@@ -10,9 +10,15 @@ interface WelcomeViewProps {
|
|||||||
apiConfiguration?: ApiConfiguration
|
apiConfiguration?: ApiConfiguration
|
||||||
setApiConfiguration: React.Dispatch<React.SetStateAction<ApiConfiguration | undefined>>
|
setApiConfiguration: React.Dispatch<React.SetStateAction<ApiConfiguration | undefined>>
|
||||||
vscodeUriScheme?: string
|
vscodeUriScheme?: string
|
||||||
|
setDidAuthKoduFromWelcome: React.Dispatch<React.SetStateAction<boolean>>
|
||||||
}
|
}
|
||||||
|
|
||||||
const WelcomeView: React.FC<WelcomeViewProps> = ({ apiConfiguration, setApiConfiguration, vscodeUriScheme }) => {
|
const WelcomeView: React.FC<WelcomeViewProps> = ({
|
||||||
|
apiConfiguration,
|
||||||
|
setApiConfiguration,
|
||||||
|
vscodeUriScheme,
|
||||||
|
setDidAuthKoduFromWelcome,
|
||||||
|
}) => {
|
||||||
const [apiErrorMessage, setApiErrorMessage] = useState<string | undefined>(undefined)
|
const [apiErrorMessage, setApiErrorMessage] = useState<string | undefined>(undefined)
|
||||||
|
|
||||||
const disableLetsGoButton = apiErrorMessage != null
|
const disableLetsGoButton = apiErrorMessage != null
|
||||||
@@ -73,6 +79,7 @@ const WelcomeView: React.FC<WelcomeViewProps> = ({ apiConfiguration, setApiConfi
|
|||||||
setApiConfiguration={setApiConfiguration}
|
setApiConfiguration={setApiConfiguration}
|
||||||
showModelOptions={false}
|
showModelOptions={false}
|
||||||
vscodeUriScheme={vscodeUriScheme}
|
vscodeUriScheme={vscodeUriScheme}
|
||||||
|
setDidAuthKodu={setDidAuthKoduFromWelcome}
|
||||||
/>
|
/>
|
||||||
{apiConfiguration?.apiProvider !== "kodu" && (
|
{apiConfiguration?.apiProvider !== "kodu" && (
|
||||||
<VSCodeButton onClick={handleSubmit} disabled={disableLetsGoButton} style={{ marginTop: "3px" }}>
|
<VSCodeButton onClick={handleSubmit} disabled={disableLetsGoButton} style={{ marginTop: "3px" }}>
|
||||||
|
|||||||
Reference in New Issue
Block a user