@@ -60,6 +60,7 @@ const makeFixture = Effect.fn("makeAntigravityTextGenerationFixture")(function*
6060 readonly startError ?: AcpError ;
6161 readonly rejectAdmission ?: boolean ;
6262 readonly sessionId ?: string ;
63+ readonly startupSkills ?: boolean ;
6364 } = { } ,
6465) {
6566 const fs = yield * FileSystem . FileSystem ;
@@ -135,6 +136,13 @@ const makeFixture = Effect.fn("makeAntigravityTextGenerationFixture")(function*
135136 start : ( ) =>
136137 Effect . gen ( function * ( ) {
137138 if ( options . startError ) return yield * options . startError ;
139+ if ( options . startupSkills ) {
140+ for ( const directory of [ ".agents" , ".gemini" ] ) {
141+ yield * fs
142+ . makeDirectory ( path . join ( cwd , directory , "skills" ) , { recursive : true } )
143+ . pipe ( Effect . orDie ) ;
144+ }
145+ }
138146 yield * fs . makeDirectory ( brainDirectory , { recursive : true } ) . pipe ( Effect . orDie ) ;
139147 yield * fs . writeFileString ( `${ sessionBase } .db` , "helper session" ) . pipe ( Effect . orDie ) ;
140148 yield * fs . writeFileString ( `${ sessionBase } .db-wal` , "helper journal" ) . pipe ( Effect . orDie ) ;
@@ -284,6 +292,7 @@ it.layer(NodeServices.layer)("AntigravityTextGeneration", (it) => {
284292 ( ) =>
285293 Effect . gen ( function * ( ) {
286294 const fixture = yield * makeFixture ( {
295+ startupSkills : true ,
287296 outputs : [
288297 '{"subject":" Repair Google login.\\nExtra line","body":" Keep the remote callback. ","branch":"Repair Login"}' ,
289298 '```json\n{"title":" Repair Google login\\nExtra line","body":" ## Summary\\nSupport remote callbacks. "}\n```' ,
@@ -442,29 +451,72 @@ it.layer(NodeServices.layer)("AntigravityTextGeneration", (it) => {
442451 } ) . pipe ( Effect . scoped ) ,
443452 ) ;
444453
445- it . effect ( "rejects a helper that writes files in its temporary workspace" , ( ) =>
446- Effect . gen ( function * ( ) {
447- const fs = yield * FileSystem . FileSystem ;
448- const path = yield * Path . Path ;
449- const fixture = yield * makeFixture ( {
450- prompt : ( { cwd, emit } ) =>
451- Effect . gen ( function * ( ) {
452- yield * fs
453- . writeFileString ( path . join ( cwd , "unexpected.txt" ) , "unexpected" )
454- . pipe ( Effect . orDie ) ;
455- yield * emit ( {
456- sessionUpdate : "agent_message_chunk" ,
457- content : { type : "text" , text : '{"title":"Ignored output"}' } ,
458- } ) ;
459- return { stopReason : "end_turn" } ;
460- } ) ,
461- } ) ;
462- const error = yield * fixture . textGeneration
463- . generateThreadTitle ( fixture . titleInput )
464- . pipe ( Effect . flip ) ;
465- expect ( error . detail ) . toContain ( "wrote files" ) ;
466- yield * fixture . assertCleaned ;
467- } ) . pipe ( Effect . scoped ) ,
454+ it . effect . each ( [
455+ { relativePath : "unexpected.txt" , directory : false } ,
456+ { relativePath : ".agents/skills/unexpected.txt" , directory : false } ,
457+ { relativePath : ".gemini/skills/unexpected.txt" , directory : false } ,
458+ { relativePath : ".gemini/unexpected" , directory : true } ,
459+ { relativePath : ".agents/skills" , directory : false } ,
460+ ] ) (
461+ "rejects a helper that writes $relativePath in its temporary workspace" ,
462+ ( { relativePath, directory } ) =>
463+ Effect . gen ( function * ( ) {
464+ const fs = yield * FileSystem . FileSystem ;
465+ const path = yield * Path . Path ;
466+ const fixture = yield * makeFixture ( {
467+ startupSkills : true ,
468+ prompt : ( { cwd, emit } ) =>
469+ Effect . gen ( function * ( ) {
470+ const entry = path . join ( cwd , relativePath ) ;
471+ if ( yield * fs . exists ( entry ) . pipe ( Effect . orDie ) ) {
472+ yield * fs . remove ( entry , { recursive : true } ) . pipe ( Effect . orDie ) ;
473+ }
474+ yield * (
475+ directory ? fs . makeDirectory ( entry ) : fs . writeFileString ( entry , "unexpected" )
476+ ) . pipe ( Effect . orDie ) ;
477+ yield * emit ( {
478+ sessionUpdate : "agent_message_chunk" ,
479+ content : { type : "text" , text : '{"title":"Ignored output"}' } ,
480+ } ) ;
481+ return { stopReason : "end_turn" } ;
482+ } ) ,
483+ } ) ;
484+ const error = yield * fixture . textGeneration
485+ . generateThreadTitle ( fixture . titleInput )
486+ . pipe ( Effect . flip ) ;
487+ expect ( error . detail ) . toContain ( "wrote files" ) ;
488+ yield * fixture . assertCleaned ;
489+ } ) . pipe ( Effect . scoped ) ,
490+ ) ;
491+
492+ it . effect . each ( [ ".agents" , ".gemini/skills" ] ) (
493+ "rejects a helper that replaces %s with a symlink" ,
494+ ( relativePath ) =>
495+ Effect . gen ( function * ( ) {
496+ const fs = yield * FileSystem . FileSystem ;
497+ const path = yield * Path . Path ;
498+ const target = yield * fs . makeTempDirectoryScoped ( { prefix : "t3-antigravity-link-test-" } ) ;
499+ const fixture = yield * makeFixture ( {
500+ startupSkills : true ,
501+ prompt : ( { cwd, emit } ) =>
502+ Effect . gen ( function * ( ) {
503+ const link = path . join ( cwd , relativePath ) ;
504+ yield * fs . remove ( link , { recursive : true } ) . pipe ( Effect . orDie ) ;
505+ yield * fs . symlink ( target , link ) . pipe ( Effect . orDie ) ;
506+ yield * emit ( {
507+ sessionUpdate : "agent_message_chunk" ,
508+ content : { type : "text" , text : '{"title":"Ignored output"}' } ,
509+ } ) ;
510+ return { stopReason : "end_turn" } ;
511+ } ) ,
512+ } ) ;
513+ const error = yield * fixture . textGeneration
514+ . generateThreadTitle ( fixture . titleInput )
515+ . pipe ( Effect . flip ) ;
516+ expect ( error . detail ) . toContain ( "wrote files" ) ;
517+ expect ( yield * fs . exists ( target ) ) . toBe ( true ) ;
518+ yield * fixture . assertCleaned ;
519+ } ) . pipe ( Effect . scoped ) ,
468520 ) ;
469521
470522 it . effect ( "uses the native default without sending T3's default selection as a model ID" , ( ) =>
@@ -576,3 +628,15 @@ it.layer(NodeServices.layer)("AntigravityTextGeneration", (it) => {
576628 } ) . pipe ( Effect . scoped ) ,
577629 ) ;
578630} ) ;
631+
632+ it . effect ( "retains filesystem services supplied only during construction" , ( ) =>
633+ Effect . gen ( function * ( ) {
634+ const fixture = yield * makeFixture ( { startupSkills : true } ) . pipe (
635+ Effect . provide ( NodeServices . layer ) ,
636+ ) ;
637+ expect ( yield * fixture . textGeneration . generateThreadTitle ( fixture . titleInput ) ) . toEqual ( {
638+ title : "Repair login" ,
639+ } ) ;
640+ yield * fixture . assertCleaned ;
641+ } ) . pipe ( Effect . scoped ) ,
642+ ) ;
0 commit comments