From 89be6edb5ec7eab1a83443b4af2f62827bd0e6be Mon Sep 17 00:00:00 2001 From: yiliang114 <1204183885@qq.com> Date: Fri, 12 Dec 2025 13:59:05 +0800 Subject: [PATCH] chore(vscode-ide-companion): add comment --- .../src/services/acpConnection.ts | 1 - .../src/services/qwenConnectionHandler.ts | 1 - .../src/webview/WebViewProvider.ts | 16 +++------------- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/packages/vscode-ide-companion/src/services/acpConnection.ts b/packages/vscode-ide-companion/src/services/acpConnection.ts index 9fd548cc..5486e14d 100644 --- a/packages/vscode-ide-companion/src/services/acpConnection.ts +++ b/packages/vscode-ide-companion/src/services/acpConnection.ts @@ -31,7 +31,6 @@ export class AcpConnection { private child: ChildProcess | null = null; private pendingRequests = new Map>(); private nextRequestId = { value: 0 }; - // 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(); diff --git a/packages/vscode-ide-companion/src/services/qwenConnectionHandler.ts b/packages/vscode-ide-companion/src/services/qwenConnectionHandler.ts index 78731734..6a74cd56 100644 --- a/packages/vscode-ide-companion/src/services/qwenConnectionHandler.ts +++ b/packages/vscode-ide-companion/src/services/qwenConnectionHandler.ts @@ -138,7 +138,6 @@ export class QwenConnectionHandler { '[QwenAgentManager] Qwen requires authentication. Authenticating and retrying session/new...', ); try { - // Let CLI handle authentication - it's the single source of truth await connection.authenticate(authMethod); // FIXME: @yiliang114 If there is no delay for a while, immediately executing // newSession may cause the cli authorization jump to be triggered again diff --git a/packages/vscode-ide-companion/src/webview/WebViewProvider.ts b/packages/vscode-ide-companion/src/webview/WebViewProvider.ts index 12b5a99c..b4da60ab 100644 --- a/packages/vscode-ide-companion/src/webview/WebViewProvider.ts +++ b/packages/vscode-ide-companion/src/webview/WebViewProvider.ts @@ -131,7 +131,7 @@ export class WebViewProvider { // Note: Tool call updates are handled in handleSessionUpdate within QwenAgentManager // and sent via onStreamChunk callback this.agentManager.onToolCall((update) => { - // Always surface tool calls; they are part of the live assistant process. + // Always surface tool calls; they are part of the live assistant flow. // Cast update to access sessionUpdate property const updateData = update as unknown as Record; @@ -516,15 +516,13 @@ export class WebViewProvider { /** * Attempt to restore authentication state and initialize connection * This is called when the webview is first shown - * - * In the new architecture, let CLI handle authentication state management */ private async attemptAuthStateRestoration(): Promise { try { console.log( - '[WebViewProvider] Attempting connection (letting CLI handle authentication)...', + '[WebViewProvider] Attempting connection (CLI handle authentication)...', ); - // In the new architecture, always attempt connection and let CLI handle authentication + //always attempt connection and let CLI handle authentication await this.initializeAgentConnection(); } catch (error) { console.error( @@ -540,7 +538,6 @@ export class WebViewProvider { * Can be called from show() or via /login command */ async initializeAgentConnection(): Promise { - // In the new architecture, let CLI handle authentication without local state caching return this.doInitializeAgentConnection(); } @@ -586,7 +583,6 @@ export class WebViewProvider { console.log('[WebViewProvider] Connecting to agent...'); // Pass the detected CLI path to ensure we use the correct installation - // In the new architecture, let CLI handle authentication without local state caching await this.agentManager.connect(workingDir, cliDetection.cliPath); console.log('[WebViewProvider] Agent connected successfully'); this.agentInitialized = true; @@ -755,12 +751,6 @@ export class WebViewProvider { try { await this.agentManager.createNewSession(workingDir); console.log('[WebViewProvider] ACP session created successfully'); - - // In the new architecture, CLI handles authentication state - // No need to save auth state locally anymore - console.log( - '[WebViewProvider] Session created successfully (CLI manages auth state)', - ); } catch (sessionError) { console.error( '[WebViewProvider] Failed to create ACP session:',