@@ -64,18 +64,21 @@ let checkTimer: NodeJS.Timeout | undefined;
6464let intervalTimer : NodeJS . Timeout | undefined ;
6565
6666export function setupPeriodicAiCheck ( context : ExtensionContext ) {
67- // Run first check after 1 minute
68- checkTimer = setTimeout ( ( ) => {
69- runAiAgentCheck ( ) ;
70-
71- // Then check every hour
72- intervalTimer = setInterval (
73- ( ) => {
74- runAiAgentCheck ( ) ;
75- } ,
76- 60 * 60 * 1000 ,
77- ) ;
78- } , 60 * 1000 ) ;
67+ // Run first check after 3 minutes
68+ checkTimer = setTimeout (
69+ ( ) => {
70+ runAiAgentCheck ( ) ;
71+
72+ // Then check every 3 hours
73+ intervalTimer = setInterval (
74+ ( ) => {
75+ runAiAgentCheck ( ) ;
76+ } ,
77+ 3 * 60 * 60 * 1000 ,
78+ ) ;
79+ } ,
80+ 3 * 60 * 1000 ,
81+ ) ;
7982
8083 context . subscriptions . push (
8184 new Disposable ( ( ) => {
@@ -144,25 +147,12 @@ async function constructCommand(flags: string, forceNpx = false) {
144147 // there are older versions of nx that have this outdated config
145148 // 'yarn' isn't actually a dlx command it's only for local packages
146149 if ( dlx === 'yarn' || dlx === 'npx' || dlx === undefined ) {
147- dlx = ' npx -y --ignore-scripts' ;
150+ dlx = ` npx -y --ignore-scripts ${ cacheParam } ` ;
148151 }
149152
150153 return `${ forceNpx ? `npx -y ${ cacheParam } --ignore-scripts` : dlx } nx@latest configure-ai-agents ${ flags } ` . trim ( ) ;
151154}
152155
153- async function getNxLatestVersion ( ) : Promise < string | undefined > {
154- try {
155- const result = await promisify ( exec ) ( 'npm view nx@latest version' , {
156- encoding : 'utf-8' ,
157- timeout : 10000 ,
158- } ) ;
159- return result . stdout . trim ( ) ;
160- } catch ( e ) {
161- vscodeLogger . log ( `Failed to get nx@latest version: ${ e } ` ) ;
162- return undefined ;
163- }
164- }
165-
166156async function doRunAiAgentCheck (
167157 workspacePath : string ,
168158 forceNpx = false ,
@@ -369,16 +359,6 @@ async function runAiAgentCheck() {
369359
370360 const now = Date . now ( ) ;
371361
372- const lastUpdateNotificationTimestamp =
373- WorkspaceConfigurationStore . instance . get (
374- 'lastAiCheckNotificationTimestamp' ,
375- 0 ,
376- ) ;
377- const gap = 12 * 60 * 60 * 1000 ;
378- if ( now - lastUpdateNotificationTimestamp < gap ) {
379- return ;
380- }
381-
382362 const workspacePath = getWorkspacePath ( ) ;
383363 if ( ! workspacePath ) {
384364 return ;
@@ -438,6 +418,16 @@ async function runAiAgentCheck() {
438418 }
439419 }
440420
421+ const lastUpdateNotificationTimestamp =
422+ WorkspaceConfigurationStore . instance . get (
423+ 'lastAiCheckNotificationTimestamp' ,
424+ 0 ,
425+ ) ;
426+ const gap = 12 * 60 * 60 * 1000 ;
427+ if ( now - lastUpdateNotificationTimestamp < gap ) {
428+ return ;
429+ }
430+
441431 WorkspaceConfigurationStore . instance . set (
442432 'lastAiCheckNotificationTimestamp' ,
443433 now ,
@@ -490,10 +480,6 @@ async function runAiAgentCheck() {
490480 }
491481 }
492482 getTelemetry ( ) . logUsage ( 'ai.configure-agents-check-end' ) ;
493- WorkspaceConfigurationStore . instance . set (
494- 'lastAiCheckNotificationTimestamp' ,
495- now ,
496- ) ;
497483
498484 // If we get here, the update check passed (no updates needed)
499485 // Now check if we should prompt for configuration
0 commit comments