mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-11-07 06:19:43 -10:00
* fix(web-shell): wait for session before checking subscription commands * fix(cli): keep signed-out subscription startup in the composer * fix(subscription): preserve model selection across sign-in * fix(subscription): align sign-in with model selection scope * fix(subscription): apply reasoning defaults across models * fix(subscription): tag Qwen web links by client * fix(subscription): prefix Qwen web client tags * fix(subscription): attribute Qwen web links by paywall scene * fix(subscription): recover historical sessions with saved API models * fix(cli): remove the signed-out subscription startup notice * fix(subscription): support standalone desktop activation and expose errors * fix(subscription): isolate activation and session model selection * fix(subscription): enforce auth policy and restore home login * test(cli): preserve the default initializer mock on restore --------- Co-authored-by: luoyun <[email protected]> Co-authored-by: 易良 <[email protected]>
52 lines
1.7 KiB
TypeScript
52 lines
1.7 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Qwen Team
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import * as vscode from 'vscode';
|
|
import { withQwenChatTracking } from '@qwen-code/qwen-code-core/qwen/oauth-config.js';
|
|
import type { AuthenticateUpdateNotification } from '../types/acpTypes.js';
|
|
|
|
// Store reference to the current notification
|
|
let currentNotification: Thenable<string | undefined> | null = null;
|
|
|
|
/**
|
|
* Handle authentication update notifications by showing a VS Code notification
|
|
* with the authentication URI and action buttons.
|
|
*
|
|
* @param data - Authentication update notification data containing the auth URI
|
|
*/
|
|
export function handleAuthenticateUpdate(
|
|
data: AuthenticateUpdateNotification,
|
|
): void {
|
|
const authUri = withQwenChatTracking(data._meta.authUri, 'plugin');
|
|
|
|
// Store reference to the current notification
|
|
currentNotification = vscode.window.showInformationMessage(
|
|
`Qwen Code needs authentication. Click an action below:`,
|
|
'Open in Browser',
|
|
'Copy Link',
|
|
'Dismiss',
|
|
);
|
|
|
|
currentNotification.then((selection) => {
|
|
if (selection === 'Open in Browser') {
|
|
// Open the authentication URI in the default browser
|
|
vscode.env.openExternal(vscode.Uri.parse(authUri));
|
|
vscode.window.showInformationMessage(
|
|
'Opening authentication page in your browser...',
|
|
);
|
|
} else if (selection === 'Copy Link') {
|
|
// Copy the authentication URI to clipboard
|
|
vscode.env.clipboard.writeText(authUri);
|
|
vscode.window.showInformationMessage(
|
|
'Authentication link copied to clipboard!',
|
|
);
|
|
}
|
|
|
|
// Clear the notification reference after user interaction
|
|
currentNotification = null;
|
|
});
|
|
}
|