@@ -24,36 +24,6 @@ const Configuration = Schema.Record(Schema.String, Schema.Unknown);
2424const decodeConfiguration = Schema . decodeEffect ( Schema . fromJsonString ( Configuration ) ) ;
2525const decodeConfigurationObject = Schema . decodeUnknownEffect ( Configuration ) ;
2626
27- const hasOnlyRuntimeDirectories = Effect . fn ( "AntigravityTextGeneration.hasOnlyRuntimeDirectories" ) (
28- function * ( cwd : string ) {
29- const fs = yield * FileSystem . FileSystem ;
30- const path = yield * Path . Path ;
31- const root = yield * fs . realPath ( cwd ) ;
32- // ACP creates these empty skill directories before the first prompt.
33- const allowed = new Set ( [
34- path . join ( root , ".agents" ) ,
35- path . join ( root , ".agents" , "skills" ) ,
36- path . join ( root , ".gemini" ) ,
37- path . join ( root , ".gemini" , "skills" ) ,
38- ] ) ;
39- const directories = [ root ] ;
40- for ( const directory of directories ) {
41- for ( const name of yield * fs . readDirectory ( directory ) ) {
42- const entry = path . join ( directory , name ) ;
43- if (
44- ! allowed . has ( entry ) ||
45- ( yield * fs . realPath ( entry ) ) !== entry ||
46- ( yield * fs . stat ( entry ) ) . type !== "Directory"
47- ) {
48- return false ;
49- }
50- directories . push ( entry ) ;
51- }
52- }
53- return true ;
54- } ,
55- ) ;
56-
5727type AntigravityTextRuntime = Pick <
5828 AcpSessionRuntime . AcpSessionRuntime [ "Service" ] ,
5929 | "start"
@@ -124,6 +94,34 @@ export const makeAntigravityTextGeneration = Effect.fn("makeAntigravityTextGener
12494) {
12595 const fs = yield * FileSystem . FileSystem ;
12696 const path = yield * Path . Path ;
97+ const hasOnlyRuntimeDirectories = Effect . fn (
98+ "AntigravityTextGeneration.hasOnlyRuntimeDirectories" ,
99+ ) ( function * ( cwd : string ) {
100+ const root = yield * fs . realPath ( cwd ) ;
101+ // ACP creates these empty skill directories before the first prompt.
102+ const allowed = new Set ( [
103+ path . join ( root , ".agents" ) ,
104+ path . join ( root , ".agents" , "skills" ) ,
105+ path . join ( root , ".gemini" ) ,
106+ path . join ( root , ".gemini" , "skills" ) ,
107+ ] ) ;
108+ const directories = [ root ] ;
109+ for ( const directory of directories ) {
110+ for ( const name of yield * fs . readDirectory ( directory ) ) {
111+ const entry = path . join ( directory , name ) ;
112+ if (
113+ ! allowed . has ( entry ) ||
114+ ( yield * fs . realPath ( entry ) ) !== entry ||
115+ ( yield * fs . stat ( entry ) ) . type !== "Directory"
116+ ) {
117+ return false ;
118+ }
119+ directories . push ( entry ) ;
120+ }
121+ }
122+ return true ;
123+ } ) ;
124+
127125 const available = isAntigravityTextGenerationAvailable ( options . profileDirectory ) . pipe (
128126 Effect . provideService ( FileSystem . FileSystem , fs ) ,
129127 Effect . provideService ( Path . Path , path ) ,
@@ -283,11 +281,7 @@ export const makeAntigravityTextGeneration = Effect.fn("makeAntigravityTextGener
283281 ) ;
284282 } ) . pipe ( Effect . scoped ) ;
285283
286- const validWorkspace = yield * hasOnlyRuntimeDirectories ( cwd ) . pipe (
287- Effect . provideService ( FileSystem . FileSystem , fs ) ,
288- Effect . provideService ( Path . Path , path ) ,
289- ) ;
290- if ( ! validWorkspace ) {
284+ if ( ! ( yield * hasOnlyRuntimeDirectories ( cwd ) ) ) {
291285 return yield * new TextGenerationError ( {
292286 operation,
293287 detail : "Antigravity wrote files during text generation." ,
0 commit comments