@@ -18,6 +18,9 @@ import { isUserCancelledError, ToolkitError } from '../shared/errors'
1818import { telemetry } from '../shared/telemetry/telemetry'
1919import { cast } from '../shared/utilities/typeConstructors'
2020import { CancellationError } from '../shared/utilities/timeoutUtils'
21+ import { isAmazonQ , isCloud9 , productName } from '../shared/extensionUtilities'
22+ import * as config from './config'
23+ import { isReleaseVersion } from '../shared/vscode/env'
2124
2225const localize = nls . loadMessageBundle ( )
2326
@@ -39,6 +42,16 @@ async function updateBetaToolkitData(vsixUrl: string, data: BetaToolkit) {
3942 } )
4043}
4144
45+ /**
46+ * Set up "beta" update monitoring.
47+ */
48+ export async function activate ( ctx : vscode . ExtensionContext ) {
49+ const betaUrl = isAmazonQ ( ) ? config . betaUrl . amazonq : config . betaUrl . toolkit
50+ if ( ! isCloud9 ( ) && ! isReleaseVersion ( ) && betaUrl ) {
51+ ctx . subscriptions . push ( watchBetaVSIX ( betaUrl ) )
52+ }
53+ }
54+
4255/**
4356 * Watch the beta VSIX daily for changes.
4457 * If this is the first time we are watching the beta version or if its been 24 hours since it was last checked then try to prompt for update
@@ -75,11 +88,12 @@ async function runAutoUpdate(vsixUrl: string) {
7588async function checkBetaUrl ( vsixUrl : string ) : Promise < void > {
7689 const resp = await got ( vsixUrl ) . buffer ( )
7790 const latestBetaInfo = await getExtensionInfo ( resp )
78- if ( VSCODE_EXTENSION_ID . awstoolkit !== `${ latestBetaInfo . publisher } .${ latestBetaInfo . name } ` ) {
91+ const extId = isAmazonQ ( ) ? VSCODE_EXTENSION_ID . amazonq : VSCODE_EXTENSION_ID . awstoolkit
92+ if ( extId !== `${ latestBetaInfo . publisher } .${ latestBetaInfo . name } ` ) {
7993 throw new ToolkitError ( 'URL does not point to an AWS Toolkit artifact' , { code : 'InvalidExtensionName' } )
8094 }
8195
82- const currentVersion = vscode . extensions . getExtension ( VSCODE_EXTENSION_ID . awstoolkit ) ?. packageJSON . version
96+ const currentVersion = vscode . extensions . getExtension ( extId ) ?. packageJSON . version
8397 if ( latestBetaInfo . version !== currentVersion ) {
8498 const tmpFolder = await makeTemporaryToolkitFolder ( )
8599 const betaPath = vscode . Uri . joinPath ( vscode . Uri . file ( tmpFolder ) , path . basename ( vsixUrl ) )
@@ -141,7 +155,7 @@ async function promptInstallToolkit(pluginPath: vscode.Uri, newVersion: string,
141155 const response = await vscode . window . showInformationMessage (
142156 localize (
143157 'AWS.dev.beta.updatePrompt' ,
144- `New version of AWS Toolkit is available at the [beta URL]({0}). Install the new version "{1}" to continue using the beta.` ,
158+ `New version of ${ productName ( ) } is available at the [beta URL]({0}). Install the new version "{1}" to continue using the beta.` ,
145159 vsixUrl ,
146160 newVersion
147161 ) ,
0 commit comments