@@ -64,18 +64,18 @@ let checkTimer: NodeJS.Timeout | undefined;
6464let intervalTimer : NodeJS . Timeout | undefined ;
6565
6666export function setupPeriodicAiCheck ( context : ExtensionContext ) {
67- // Run first check after 1 minute
67+ // Run first check after 3 minutes
6868 checkTimer = setTimeout ( ( ) => {
6969 runAiAgentCheck ( ) ;
7070
71- // Then check every hour
71+ // Then check every 3 hours
7272 intervalTimer = setInterval (
7373 ( ) => {
7474 runAiAgentCheck ( ) ;
7575 } ,
76- 60 * 60 * 1000 ,
76+ 3 * 60 * 60 * 1000 ,
7777 ) ;
78- } , 60 * 1000 ) ;
78+ } , 3 * 60 * 1000 ) ;
7979
8080 context . subscriptions . push (
8181 new Disposable ( ( ) => {
@@ -144,25 +144,12 @@ async function constructCommand(flags: string, forceNpx = false) {
144144 // there are older versions of nx that have this outdated config
145145 // 'yarn' isn't actually a dlx command it's only for local packages
146146 if ( dlx === 'yarn' || dlx === 'npx' || dlx === undefined ) {
147- dlx = ' npx -y --ignore-scripts' ;
147+ dlx = ` npx -y --ignore-scripts ${ cacheParam } ` ;
148148 }
149149
150150 return `${ forceNpx ? `npx -y ${ cacheParam } --ignore-scripts` : dlx } nx@latest configure-ai-agents ${ flags } ` . trim ( ) ;
151151}
152152
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-
166153async function doRunAiAgentCheck (
167154 workspacePath : string ,
168155 forceNpx = false ,
@@ -369,16 +356,6 @@ async function runAiAgentCheck() {
369356
370357 const now = Date . now ( ) ;
371358
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-
382359 const workspacePath = getWorkspacePath ( ) ;
383360 if ( ! workspacePath ) {
384361 return ;
@@ -438,6 +415,16 @@ async function runAiAgentCheck() {
438415 }
439416 }
440417
418+ const lastUpdateNotificationTimestamp =
419+ WorkspaceConfigurationStore . instance . get (
420+ 'lastAiCheckNotificationTimestamp' ,
421+ 0 ,
422+ ) ;
423+ const gap = 12 * 60 * 60 * 1000 ;
424+ if ( now - lastUpdateNotificationTimestamp < gap ) {
425+ return ;
426+ }
427+
441428 WorkspaceConfigurationStore . instance . set (
442429 'lastAiCheckNotificationTimestamp' ,
443430 now ,
@@ -490,10 +477,6 @@ async function runAiAgentCheck() {
490477 }
491478 }
492479 getTelemetry ( ) . logUsage ( 'ai.configure-agents-check-end' ) ;
493- WorkspaceConfigurationStore . instance . set (
494- 'lastAiCheckNotificationTimestamp' ,
495- now ,
496- ) ;
497480
498481 // If we get here, the update check passed (no updates needed)
499482 // Now check if we should prompt for configuration
0 commit comments