chore(vscode-ide-companion): rm authState manager in vscode-ide-companion to simplify the login architecture

This commit is contained in:
yiliang114
2025-12-12 13:40:18 +08:00
parent 02234f5434
commit d754767e73
5 changed files with 102 additions and 559 deletions

View File

@@ -32,8 +32,6 @@ export class AcpConnection {
private pendingRequests = new Map<number, PendingRequest<unknown>>();
private nextRequestId = { value: 0 };
// Deduplicate concurrent authenticate calls (across retry paths)
private static authInFlight: Promise<AcpResponse> | null = null;
// Remember the working dir provided at connect() so later ACP calls
// that require cwd (e.g. session/list) can include it.
private workingDir: string = process.cwd();
@@ -274,23 +272,12 @@ export class AcpConnection {
* @returns Authentication response
*/
async authenticate(methodId?: string): Promise<AcpResponse> {
if (AcpConnection.authInFlight) {
return AcpConnection.authInFlight;
}
const p = this.sessionManager
.authenticate(
methodId,
this.child,
this.pendingRequests,
this.nextRequestId,
)
.finally(() => {
AcpConnection.authInFlight = null;
});
AcpConnection.authInFlight = p;
return p;
return this.sessionManager.authenticate(
methodId,
this.child,
this.pendingRequests,
this.nextRequestId,
);
}
/**