@@ -39,7 +39,6 @@ import {
3939 makeAntigravityAcpAdapterFlavor ,
4040 makeAntigravityAdapterV2 ,
4141} from "./AntigravityAdapterV2.ts" ;
42- import { antigravityThreadUploadsRoot } from "../../provider/acp/AntigravityThreadUploads.ts" ;
4342
4443const flavor = makeAntigravityAcpAdapterFlavor ( {
4544 instanceId : ProviderInstanceId . make ( "antigravity-test" ) ,
@@ -140,9 +139,7 @@ const layerSession = Layer.mergeAll(
140139 NodeServices . layer ,
141140 IdAllocator . layer ,
142141 McpProviderSessions . layer ,
143- TestProviderHost . layer ( {
144- readableAttachments : { "thread-antigravity-containment" : [ "pasted.txt" ] } ,
145- } ) . pipe ( Layer . provide ( NodeServices . layer ) ) ,
142+ TestProviderHost . layer ( ) . pipe ( Layer . provide ( NodeServices . layer ) ) ,
146143) ;
147144
148145describe ( "AntigravityAdapterV2 compaction" , ( ) => {
@@ -245,55 +242,6 @@ describe("AntigravityAdapterV2 session open", () => {
245242 ) ;
246243} ) ;
247244
248- describe ( "AntigravityAdapterV2 thread uploads" , ( ) => {
249- it . effect ( "copies only uploads this thread owns or inherited, not another thread's by ID" , ( ) =>
250- Effect . gen ( function * ( ) {
251- const fileSystem = yield * FileSystem . FileSystem ;
252- const path = yield * Path . Path ;
253- const host = yield * ProviderHost . ProviderHost ;
254- const threadId = ThreadId . make ( "thread-antigravity-containment" ) ;
255- const upload = ( id : string ) => {
256- const attachment = {
257- type : "file" ,
258- id,
259- name : `${ id } .txt` ,
260- mimeType : "text/plain" ,
261- sizeBytes : 4 ,
262- } as const ;
263- return fileSystem
264- . writeFileString ( path . join ( host . paths . attachmentsDir , id ) , "data" )
265- . pipe ( Effect . as ( attachment ) ) ;
266- } ;
267- const own = yield * upload (
268- "thread-antigravity-containment-00000000-0000-4000-8000-000000000001" ,
269- ) ;
270- const foreign = yield * upload ( "thread-other-00000000-0000-4000-8000-000000000002" ) ;
271- const inherited = yield * upload ( "pasted.txt" ) ;
272- const uploadsFlavor = makeAntigravityAcpAdapterFlavor ( {
273- instanceId : ProviderInstanceId . make ( "antigravity-uploads-test" ) ,
274- crypto : yield * Crypto . Crypto ,
275- fileSystem,
276- path,
277- host,
278- selfInvocation : yield * resolveSelfInvocation ( ) ,
279- makeRuntime : ( ) => Effect . die ( "not spawned in this test" ) ,
280- withProcess : ( _stop , task ) => task ,
281- // @effect -diagnostics-next-line effectSucceedWithVoid:off - This optional result requires undefined, not the wider void type.
282- defaultModel : Effect . succeed ( undefined ) ,
283- } ) ;
284- const resolve = yield * uploadsFlavor . prepareAttachments ! ( {
285- threadId,
286- attachments : [ own , foreign , inherited ] ,
287- } ) ;
288- assert . isString ( resolve ( own ) ) ;
289- assert . isString ( resolve ( inherited ) ) ;
290- assert . isNull ( resolve ( foreign ) ) ;
291- const root = antigravityThreadUploadsRoot ( host . paths . stateDir , threadId ) ;
292- assert . isFalse ( yield * fileSystem . exists ( path . join ( root , foreign . id ) ) ) ;
293- } ) . pipe ( Effect . provide ( layerSession ) , Effect . scoped ) ,
294- ) ;
295- } ) ;
296-
297245describe ( "AntigravityAdapterV2 client file system" , ( ) => {
298246 it . effect ( "serves confined reads and leaves edits to the agent's diff tools" , ( ) =>
299247 Effect . gen ( function * ( ) {
@@ -393,27 +341,11 @@ describe("AntigravityAdapterV2 client file system", () => {
393341 const insidePath = path . join ( workspace , "src" , "inside.ts" ) ;
394342 yield * fileSystem . makeDirectory ( path . dirname ( insidePath ) , { recursive : true } ) ;
395343 yield * fileSystem . writeFileString ( insidePath , "inside" ) ;
396- // The agent gets only this thread's copies; the shared store stays out of reach.
397- // The copies live under the canonical root (macOS temp paths resolve through /private).
398- const threadUploads = yield * fileSystem . realPath (
399- antigravityThreadUploadsRoot ( host . paths . stateDir , threadId ) ,
400- ) ;
401- const sessionNew = ( yield * fileSystem . readFileString ( requestLog ) )
402- . trim ( )
403- . split ( "\n" )
404- . map ( ( line ) => JSON . parse ( line ) as { method ?: string ; params ?: unknown } )
405- . find ( ( request ) => request . method === "session/new" ) ;
406- assert . deepNestedPropertyVal ( sessionNew , "params.additionalDirectories" , [ threadUploads ] ) ;
407344 const pasted = yield * readTextFile (
408- { sessionId : "mock-session-1" , path : path . join ( threadUploads , "pasted.txt" ) } ,
345+ { sessionId : "mock-session-1" , path : attachment } ,
409346 context ( "fs/read_text_file" ) ,
410347 ) ;
411348 assert . equal ( pasted . content , "pasted" ) ;
412- const shared = yield * readTextFile (
413- { sessionId : "mock-session-1" , path : attachment } ,
414- context ( "fs/read_text_file" ) ,
415- ) . pipe ( Effect . exit ) ;
416- assert . isTrue ( Exit . isFailure ( shared ) , "the shared attachment store is not a read root" ) ;
417349 yield * fileSystem . writeFileString ( insidePath , "\uFEFFfirst\né中🙂\nlast" ) ;
418350 const sliced = yield * readTextFile (
419351 { sessionId : "mock-session-1" , path : insidePath , line : 2 , limit : 1 } ,
@@ -472,19 +404,13 @@ describe("AntigravityAdapterV2 workspace changes", () => {
472404 const host = yield * ProviderHost . ProviderHost ;
473405 const document = ChatFileAttachment . make ( {
474406 type : "file" ,
475- id : "thread-antigravity-workspace-change-00000000-0000-4000-8000-000000000003 " ,
407+ id : "native-pdf " ,
476408 name : "diagram.pdf" ,
477409 mimeType : "application/pdf" ,
478410 sizeBytes : 9 ,
479411 } ) ;
480- yield * fileSystem . writeFileString ( host . resolveAttachmentPath ( document ) ! , "%PDF-1.7" ) ;
481- const documentPath = path . join (
482- antigravityThreadUploadsRoot (
483- host . paths . stateDir ,
484- ThreadId . make ( "thread-antigravity-workspace-change" ) ,
485- ) ,
486- "thread-antigravity-workspace-change-00000000-0000-4000-8000-000000000003" ,
487- ) ;
412+ const documentPath = host . resolveAttachmentPath ( document ) ! ;
413+ yield * fileSystem . writeFileString ( documentPath , "%PDF-1.7" ) ;
488414 let readTextFile : Parameters < RuntimeService [ "handleReadTextFile" ] > [ 0 ] | undefined ;
489415 const instanceId = ProviderInstanceId . make ( "antigravity-workspace-change-test" ) ;
490416 const adapter = yield * makeAntigravityAdapterV2 ( {
@@ -603,26 +529,19 @@ describe("AntigravityAdapterV2 workspace changes", () => {
603529 Stream . runHead ,
604530 ) ;
605531 const sent = yield * Deferred . await ( promptReceived ) ;
606- // Staged copies live under the canonical root (macOS temp paths resolve through /private).
607- const stagedDocument = yield * fileSystem . realPath ( documentPath ) ;
608532 assert . deepEqual (
609533 sent . prompt . filter ( ( block ) => block . type === "resource_link" ) ,
610534 [
611535 {
612536 type : "resource_link" ,
613- uri : ( yield * path . toFileUrl ( stagedDocument ) ) . href ,
537+ uri : ( yield * path . toFileUrl ( documentPath ) ) . href ,
614538 name : "diagram.pdf" ,
615539 mimeType : "application/pdf" ,
616540 size : 8 ,
617541 } ,
618542 ] ,
619543 ) ;
620- // The prompt names this thread's private copy, never the shared store.
621- assert . include ( JSON . stringify ( sent . prompt ) , stagedDocument ) ;
622- assert . notInclude (
623- JSON . stringify ( sent . prompt ) ,
624- yield * fileSystem . realPath ( host . paths . attachmentsDir ) ,
625- ) ;
544+ assert . include ( JSON . stringify ( sent . prompt ) , documentPath ) ;
626545 if ( readTextFile === undefined ) {
627546 return yield * Effect . die ( "Antigravity sessions must serve client file requests" ) ;
628547 }
0 commit comments