mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-22 17:57:46 +00:00
chore(vscode-ide-companion): add qwen-code dependency to package files
This commit is contained in:
@@ -47,14 +47,14 @@ export class AuthMessageHandler extends BaseMessageHandler {
|
||||
try {
|
||||
console.log('[AuthMessageHandler] Login requested');
|
||||
|
||||
// Direct login without additional confirmation
|
||||
if (this.loginHandler) {
|
||||
await this.loginHandler();
|
||||
} else {
|
||||
// Fallback: show message and use command
|
||||
vscode.window.showInformationMessage(
|
||||
'Please wait while we connect to Qwen Code...',
|
||||
);
|
||||
|
||||
// Fallback: trigger WebViewProvider's forceReLogin
|
||||
await vscode.commands.executeCommand('qwenCode.login');
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@@ -150,6 +150,13 @@ export class MessageRouter {
|
||||
*/
|
||||
setLoginHandler(handler: () => Promise<void>): void {
|
||||
this.authHandler.setLoginHandler(handler);
|
||||
// Also set login handler for SessionMessageHandler
|
||||
if (
|
||||
this.sessionHandler &&
|
||||
typeof this.sessionHandler.setLoginHandler === 'function'
|
||||
) {
|
||||
this.sessionHandler.setLoginHandler(handler);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,7 @@ import type { ChatMessage } from '../../agents/qwenAgentManager.js';
|
||||
export class SessionMessageHandler extends BaseMessageHandler {
|
||||
private currentStreamContent = '';
|
||||
private isSavingCheckpoint = false;
|
||||
private loginHandler: (() => Promise<void>) | null = null;
|
||||
|
||||
canHandle(messageType: string): boolean {
|
||||
return [
|
||||
@@ -27,6 +28,13 @@ export class SessionMessageHandler extends BaseMessageHandler {
|
||||
].includes(messageType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set login handler
|
||||
*/
|
||||
setLoginHandler(handler: () => Promise<void>): void {
|
||||
this.loginHandler = handler;
|
||||
}
|
||||
|
||||
async handle(message: { type: string; data?: unknown }): Promise<void> {
|
||||
const data = message.data as Record<string, unknown> | undefined;
|
||||
|
||||
@@ -231,13 +239,23 @@ export class SessionMessageHandler extends BaseMessageHandler {
|
||||
if (!this.agentManager.isConnected) {
|
||||
console.warn('[SessionMessageHandler] Agent not connected');
|
||||
|
||||
// Show non-modal notification with Login button
|
||||
const result = await vscode.window.showWarningMessage(
|
||||
'You need to login first to use Qwen Code.',
|
||||
'Login Now',
|
||||
);
|
||||
|
||||
if (result === 'Login Now') {
|
||||
vscode.commands.executeCommand('qwenCode.login');
|
||||
// Use login handler directly
|
||||
if (this.loginHandler) {
|
||||
await this.loginHandler();
|
||||
} else {
|
||||
// Fallback to command
|
||||
vscode.window.showInformationMessage(
|
||||
'Please wait while we connect to Qwen Code...',
|
||||
);
|
||||
await vscode.commands.executeCommand('qwenCode.login');
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user