fix: added Cursor OAuth provider and fixed authentication flow race conditions

- Added Cursor OAuth provider support to CLI authentication flow.
- Fixed race conditions in OAuth callback handling and session picker cleanup.
- Improved JWT token parsing and error handling across OAuth providers.
- Replaced Bun.sleep() with abortable sleep for proper cancellation support.
- Enhanced process execution with concurrent stream reading and better timeout handling.
- Added cache cleanup mechanism for auth storage with 5-minute intervals.
This commit is contained in:
can1357
2026-01-20 19:50:50 +01:00
parent 94f406d4f0
commit 21af96d890
35 changed files with 468 additions and 287 deletions
@@ -109,7 +109,9 @@ export class LoginDialogComponent extends Container {
showManualInput(prompt: string): Promise<string> {
this.contentContainer.addChild(new Spacer(1));
this.contentContainer.addChild(new Text(theme.fg("dim", prompt), 1, 0));
this.contentContainer.addChild(this.input);
if (!this.contentContainer.children.includes(this.input)) {
this.contentContainer.addChild(this.input);
}
this.contentContainer.addChild(new Text(theme.fg("dim", "(Escape to cancel)"), 1, 0));
this.tui.requestRender();
@@ -129,7 +131,9 @@ export class LoginDialogComponent extends Container {
if (placeholder) {
this.contentContainer.addChild(new Text(theme.fg("dim", `e.g., ${placeholder}`), 1, 0));
}
this.contentContainer.addChild(this.input);
if (!this.contentContainer.children.includes(this.input)) {
this.contentContainer.addChild(this.input);
}
this.contentContainer.addChild(new Text(theme.fg("dim", "(Escape to cancel, Enter to submit)"), 1, 0));
this.input.setValue("");
@@ -260,6 +260,10 @@ export class ToolExecutionComponent extends Container {
): void {
this.result = result;
this.isPartial = isPartial;
// When tool is complete, ensure args are marked complete so spinner stops
if (!isPartial) {
this.argsComplete = true;
}
this.updateSpinnerAnimation();
this.updateDisplay();
// Convert non-PNG images to PNG for Kitty protocol (async)
@@ -168,6 +168,9 @@ export class InteractiveMode implements InteractiveModeContext {
this.editor.onAutocompleteCancel = () => {
this.ui.requestRender(true);
};
this.editor.onAutocompleteUpdate = () => {
this.ui.requestRender(true);
};
try {
this.historyStorage = HistoryStorage.open();
this.editor.setHistoryStorage(this.historyStorage);