@@ -18,6 +18,25 @@ function getVibeExecutablePath() {
1818 return join ( appPath , "vibecommit" , "win64" , "vibe.exe" ) ;
1919}
2020
21+ // Helper function to get command-specific timeout values
22+ function getCommandTimeout ( command ) {
23+ switch ( command ) {
24+ case 'expand' :
25+ // Expand operations can be very large, especially for commits with many files
26+ return 10 * 60 * 1000 ; // 10 minutes
27+ case 'commit' :
28+ case 'improve' :
29+ // Commit operations can also be large when analyzing working directory changes
30+ return 5 * 60 * 1000 ; // 5 minutes
31+ case 'generate' :
32+ case 'info' :
33+ case 'help' :
34+ default :
35+ // Default timeout for other commands
36+ return 2 * 60 * 1000 ; // 2 minutes
37+ }
38+ }
39+
2140// Register Vibe IPC handlers
2241function registerVibeHandlers ( ) {
2342 const logger = createLogger ( { component : 'vibe-ipc' } ) ;
@@ -29,7 +48,10 @@ function registerVibeHandlers() {
2948 if ( ! parsed . success ) {
3049 throw new Error ( parsed . error . issues . map ( i => i . message ) . join ( ', ' ) ) ;
3150 }
32- const { command, args, timeout = 30000 , workingDirectory, apiKey } = parsed . data ;
51+ const { command, args, timeout, workingDirectory, apiKey } = parsed . data ;
52+
53+ // Set command-specific timeouts if not provided
54+ const defaultTimeout = timeout || getCommandTimeout ( command ) ;
3355
3456 // Resolve API key from secure store if not provided
3557 let resolvedApiKey = apiKey ;
@@ -88,13 +110,13 @@ function registerVibeHandlers() {
88110 executablePath ,
89111 [ command , ...args ] ,
90112 {
91- timeout,
113+ timeout : defaultTimeout ,
92114 maxBuffer : 1024 * 1024 * 10 , // 10MB buffer
93115 cwd : workingDirectory || process . cwd ( ) ,
94116 env,
95117 } ,
96118 ) ;
97- logger . info ( 'vibe-execute-command success' , { command, args, stdoutLength : stdout . length , stderrLength : stderr . length , workingDirectory, timeout } ) ;
119+ logger . info ( 'vibe-execute-command success' , { command, args, stdoutLength : stdout . length , stderrLength : stderr . length , workingDirectory, timeout : defaultTimeout } ) ;
98120 return {
99121 success : true ,
100122 stdout,
@@ -248,7 +270,10 @@ function registerVibeHandlers() {
248270 if ( ! parsed . success ) {
249271 throw new Error ( parsed . error . issues . map ( i => i . message ) . join ( ', ' ) ) ;
250272 }
251- const { command, args, timeout = 30000 , workingDirectory, apiKey } = parsed . data ;
273+ const { command, args, timeout, workingDirectory, apiKey } = parsed . data ;
274+
275+ // Set command-specific timeouts if not provided
276+ const defaultTimeout = timeout || getCommandTimeout ( command ) ;
252277
253278 // Resolve API key from secure store if not provided
254279 let resolvedApiKey = apiKey ;
@@ -302,14 +327,14 @@ function registerVibeHandlers() {
302327 executablePath ,
303328 [ command , ...args ] ,
304329 {
305- timeout,
330+ timeout : defaultTimeout ,
306331 maxBuffer : 1024 * 1024 * 10 , // 10MB buffer
307332 cwd : workingDirectory || process . cwd ( ) ,
308333 env,
309334 } ,
310335 ) ;
311336
312- logger . info ( 'vibe-run-command success' , { command, args, stdoutLength : stdout . length , stderrLength : stderr . length , workingDirectory, timeout } ) ;
337+ logger . info ( 'vibe-run-command success' , { command, args, stdoutLength : stdout . length , stderrLength : stderr . length , workingDirectory, timeout : defaultTimeout } ) ;
313338 return {
314339 success : true ,
315340 stdout,
0 commit comments