chore(vscode-ide-companion): add comment

This commit is contained in:
yiliang114
2025-12-12 13:59:05 +08:00
parent d812c9dcf2
commit 89be6edb5e
3 changed files with 3 additions and 15 deletions

View File

@@ -31,7 +31,6 @@ export class AcpConnection {
private child: ChildProcess | null = null; private child: ChildProcess | null = null;
private pendingRequests = new Map<number, PendingRequest<unknown>>(); private pendingRequests = new Map<number, PendingRequest<unknown>>();
private nextRequestId = { value: 0 }; private nextRequestId = { value: 0 };
// Remember the working dir provided at connect() so later ACP calls // Remember the working dir provided at connect() so later ACP calls
// that require cwd (e.g. session/list) can include it. // that require cwd (e.g. session/list) can include it.
private workingDir: string = process.cwd(); private workingDir: string = process.cwd();

View File

@@ -138,7 +138,6 @@ export class QwenConnectionHandler {
'[QwenAgentManager] Qwen requires authentication. Authenticating and retrying session/new...', '[QwenAgentManager] Qwen requires authentication. Authenticating and retrying session/new...',
); );
try { try {
// Let CLI handle authentication - it's the single source of truth
await connection.authenticate(authMethod); await connection.authenticate(authMethod);
// FIXME: @yiliang114 If there is no delay for a while, immediately executing // FIXME: @yiliang114 If there is no delay for a while, immediately executing
// newSession may cause the cli authorization jump to be triggered again // newSession may cause the cli authorization jump to be triggered again

View File

@@ -131,7 +131,7 @@ export class WebViewProvider {
// Note: Tool call updates are handled in handleSessionUpdate within QwenAgentManager // Note: Tool call updates are handled in handleSessionUpdate within QwenAgentManager
// and sent via onStreamChunk callback // and sent via onStreamChunk callback
this.agentManager.onToolCall((update) => { 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 // Cast update to access sessionUpdate property
const updateData = update as unknown as Record<string, unknown>; const updateData = update as unknown as Record<string, unknown>;
@@ -516,15 +516,13 @@ export class WebViewProvider {
/** /**
* Attempt to restore authentication state and initialize connection * Attempt to restore authentication state and initialize connection
* This is called when the webview is first shown * This is called when the webview is first shown
*
* In the new architecture, let CLI handle authentication state management
*/ */
private async attemptAuthStateRestoration(): Promise<void> { private async attemptAuthStateRestoration(): Promise<void> {
try { try {
console.log( 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(); await this.initializeAgentConnection();
} catch (error) { } catch (error) {
console.error( console.error(
@@ -540,7 +538,6 @@ export class WebViewProvider {
* Can be called from show() or via /login command * Can be called from show() or via /login command
*/ */
async initializeAgentConnection(): Promise<void> { async initializeAgentConnection(): Promise<void> {
// In the new architecture, let CLI handle authentication without local state caching
return this.doInitializeAgentConnection(); return this.doInitializeAgentConnection();
} }
@@ -586,7 +583,6 @@ export class WebViewProvider {
console.log('[WebViewProvider] Connecting to agent...'); console.log('[WebViewProvider] Connecting to agent...');
// Pass the detected CLI path to ensure we use the correct installation // 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); await this.agentManager.connect(workingDir, cliDetection.cliPath);
console.log('[WebViewProvider] Agent connected successfully'); console.log('[WebViewProvider] Agent connected successfully');
this.agentInitialized = true; this.agentInitialized = true;
@@ -755,12 +751,6 @@ export class WebViewProvider {
try { try {
await this.agentManager.createNewSession(workingDir); await this.agentManager.createNewSession(workingDir);
console.log('[WebViewProvider] ACP session created successfully'); 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) { } catch (sessionError) {
console.error( console.error(
'[WebViewProvider] Failed to create ACP session:', '[WebViewProvider] Failed to create ACP session:',