@@ -3,6 +3,7 @@ import * as NodeCrypto from "node:crypto";
33import * as NodeFSP from "node:fs/promises" ;
44// @effect -diagnostics-next-line nodeBuiltinImport:off - resolveAntigravityProfileDirectory is a pure sync helper, so it cannot use the Path service.
55import * as NodePath from "node:path" ;
6+ import * as NodeOS from "node:os" ;
67
78import type { AntigravityAuthMethod , ProviderInstanceId } from "@t3tools/contracts" ;
89import { HostProcessPlatform } from "@t3tools/shared/hostProcess" ;
@@ -194,8 +195,23 @@ export function resolveAntigravityProfileDirectory(
194195 return NodePath . join ( stateDir , "providers" , "antigravity" , directoryName ) ;
195196}
196197
197- /** Parent of the per-process runtime temp directories inside a profile. */
198- export function resolveAntigravityRuntimeTempDirectory ( profileDirectory : string ) : string {
198+ /** Parent of the per-process runtime temp directories. */
199+ export function resolveAntigravityRuntimeTempDirectory (
200+ profileDirectory : string ,
201+ platform : NodeJS . Platform = process . platform ,
202+ ) : string {
203+ if ( platform === "win32" ) {
204+ // The profile directory already nests ~114 chars deep on Windows, which
205+ // pushes the PyInstaller bundle's extraction paths past MAX_PATH (260)
206+ // and kills the server during startup. Keep the runtime temp directory
207+ // under the system temp dir instead; it stays T3-owned so the driver
208+ // reclaims it the same way.
209+ const scope = NodeCrypto . createHash ( "sha256" )
210+ . update ( profileDirectory )
211+ . digest ( "hex" )
212+ . slice ( 0 , 16 ) ;
213+ return NodePath . join ( NodeOS . tmpdir ( ) , "t3-antigravity" , scope ) ;
214+ }
199215 return NodePath . join ( profileDirectory , "antigravity-acp" , "tmp" ) ;
200216}
201217
0 commit comments