@@ -292,16 +292,35 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
292292 } satisfies AntigravityExecutable ;
293293 } ) ;
294294
295- const commandPath = Effect . fn ( "AntigravityInstallation.commandPath" ) ( function * (
296- command : string ,
297- processEnvironment = environment ,
298- ) {
299- const resolved = yield * resolveCommandPath ( command , { env : processEnvironment } ) . pipe (
295+ const commandPath = ( command : string , env : NodeJS . ProcessEnv ) =>
296+ resolveCommandPath ( command , { env } ) . pipe (
297+ Effect . map ( ( resolved ) => ( resolved === null ? null : path . resolve ( resolved ) ) ) ,
300298 Effect . provideService ( HostProcess . Platform , platform ) ,
301299 Effect . provideService ( FileSystem . FileSystem , fs ) ,
302300 Effect . provideService ( Path . Path , path ) ,
303301 ) ;
304- return resolved === null ? null : path . resolve ( resolved ) ;
302+
303+ // Resolve per PATH entry so an executable without its harness falls through to later entries.
304+ const commandCandidates = Effect . fn ( "AntigravityInstallation.commandCandidates" ) ( function * (
305+ command : string ,
306+ processEnvironment = environment ,
307+ ) {
308+ if ( command . includes ( "/" ) || command . includes ( "\\" ) ) {
309+ const resolved = yield * commandPath ( command , processEnvironment ) ;
310+ return resolved === null ? [ ] : [ resolved ] ;
311+ }
312+ const pathValue =
313+ platform === "win32"
314+ ? Object . entries ( processEnvironment ) . findLast ( ( [ key ] ) => key . toUpperCase ( ) === "PATH" ) ?. [ 1 ]
315+ : processEnvironment . PATH ;
316+ const candidates : string [ ] = [ ] ;
317+ for ( const directory of ( pathValue ?? "" ) . split ( platform === "win32" ? ";" : ":" ) ) {
318+ const entry = directory . trim ( ) . replace ( / ^ " | " $ / gu, "" ) ;
319+ if ( entry . length === 0 ) continue ;
320+ const resolved = yield * commandPath ( command , { ...processEnvironment , PATH : entry } ) ;
321+ if ( resolved !== null ) candidates . push ( resolved ) ;
322+ }
323+ return candidates ;
305324 } ) ;
306325
307326 const resolve : AntigravityInstallationService [ "resolve" ] = Effect . fn (
@@ -310,9 +329,10 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
310329 function * ( binaryPath ?: string , processEnvironment ?: NodeJS . ProcessEnv ) {
311330 const override = binaryPath ?. trim ( ) ;
312331 if ( override ) {
313- const candidate = yield * commandPath ( override , processEnvironment ) ;
314- const selected = candidate === null ? null : yield * fromExternal ( candidate , "override" ) ;
315- if ( selected ) return selected ;
332+ for ( const candidate of yield * commandCandidates ( override , processEnvironment ) ) {
333+ const selected = yield * fromExternal ( candidate , "override" ) ;
334+ if ( selected ) return selected ;
335+ }
316336 return yield * installationError (
317337 "resolve" ,
318338 "The custom Antigravity executable is missing or not executable, or it needs a localharness_external sibling. The agy CLI does not." ,
@@ -322,9 +342,10 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
322342 const active = yield * readRecord ( activePath , ActiveRelease ) ;
323343 return yield * completedRelease ( active . releaseId ) ;
324344 }
325- const candidate = yield * commandPath ( names . executable , processEnvironment ) ;
326- const selected = candidate === null ? null : yield * fromExternal ( candidate , "path" ) ;
327- if ( selected ) return selected ;
345+ for ( const candidate of yield * commandCandidates ( names . executable , processEnvironment ) ) {
346+ const selected = yield * fromExternal ( candidate , "path" ) ;
347+ if ( selected ) return selected ;
348+ }
328349 return yield * installationError (
329350 "resolve" ,
330351 releaseAsset
0 commit comments