@@ -22,13 +22,15 @@ import * as Path from "effect/Path";
2222import * as Stream from "effect/Stream" ;
2323import { ChildProcessSpawner } from "effect/process" ;
2424import type * as EffectAcpSchema from "effect-acp/compat" ;
25+ import * as EffectAcpErrors from "effect-acp/errors" ;
2526
2627import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost" ;
2728import * as McpProviderSessions from "@t3tools/provider-core/server/McpProviderSessions" ;
2829import * as TestProviderHost from "@t3tools/provider-testing/TestProviderHost" ;
2930import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime" ;
3031import { makeAntigravityAcpRuntime } from "../../provider/acp/AntigravityAcpSupport.ts" ;
3132import { normalizeAntigravitySessionUpdate } from "../../provider/acp/AntigravityProtocol.ts" ;
33+ import { ANTIGRAVITY_SIGN_IN_REQUIRED_MESSAGE } from "../../provider/antigravityAuthSupport.ts" ;
3234import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator" ;
3335import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter" ;
3436import {
@@ -122,6 +124,43 @@ const layerSession = Layer.mergeAll(
122124 TestProviderHost . layer ( ) . pipe ( Layer . provide ( NodeServices . layer ) ) ,
123125) ;
124126
127+ describe ( "AntigravityAdapterV2 session open" , ( ) => {
128+ it . effect ( "marks a session that waits for Google sign-in as needing sign-in" , ( ) =>
129+ Effect . gen ( function * ( ) {
130+ const instanceId = ProviderInstanceId . make ( "antigravity-sign-in-test" ) ;
131+ const adapter = yield * makeAntigravityAdapterV2 ( {
132+ instanceId,
133+ selfInvocation : yield * resolveSelfInvocation ( ) ,
134+ makeRuntime : ( ) =>
135+ Effect . fail (
136+ new EffectAcpErrors . AcpTransportError ( {
137+ detail : ANTIGRAVITY_SIGN_IN_REQUIRED_MESSAGE ,
138+ cause : undefined ,
139+ } ) ,
140+ ) ,
141+ withProcess : ( _stop , task ) => task ,
142+ defaultModel : Effect . succeed ( undefined ) ,
143+ } ) ;
144+ const threadId = ThreadId . make ( "thread-antigravity-sign-in" ) ;
145+ const error = yield * adapter
146+ . openSession ( {
147+ threadId,
148+ providerSessionId : ProviderSessionId . make ( "provider-session-antigravity-sign-in" ) ,
149+ modelSelection : { instanceId, model : "gemini-test-low" } ,
150+ runtimePolicy : ProviderAdapter . ProviderAdapterV2RuntimePolicy . make ( {
151+ runtimeMode : "full-access" ,
152+ interactionMode : "default" ,
153+ cwd : process . cwd ( ) ,
154+ } ) ,
155+ } )
156+ . pipe ( Effect . flip ) ;
157+
158+ assert . equal ( error . _tag , "ProviderAdapterOpenSessionError" ) ;
159+ assert . isTrue ( error . _tag === "ProviderAdapterOpenSessionError" && error . requiresSignIn ) ;
160+ } ) . pipe ( Effect . provide ( layerSession ) , Effect . scoped ) ,
161+ ) ;
162+ } ) ;
163+
125164describe ( "AntigravityAdapterV2 client file system" , ( ) => {
126165 it . effect ( "confines agent file requests to the workspace under full access" , ( ) =>
127166 Effect . gen ( function * ( ) {
0 commit comments