@@ -29,4 +29,37 @@ describe('session control RPCs', () => {
2929 const agent = Agent . fromSDK ( sdk ) ;
3030 await expect ( agent . reset ( ) ) . resolves . toEqual ( { sessionId : 'session-reset' } ) ;
3131 } ) ;
32+
33+ it ( 'creates a browser handoff through every public layer' , async ( ) => {
34+ const client = new RPCClient ( ) ;
35+ const calls : Array < { method : string ; params ?: unknown } > = [ ] ;
36+ const handoff = {
37+ token : 'handoff-token' ,
38+ sessionId : 'session-browser' ,
39+ workspaceRoot : '/workspace' ,
40+ createdAt : '2026-07-20T00:00:00.000Z' ,
41+ expiresAt : '2026-07-20T00:10:00.000Z' ,
42+ url : 'chrome-extension://extension/sidepanel.html?handoff=handoff-token' ,
43+ } ;
44+ getTransport ( client ) . request = async ( method , params ) => {
45+ calls . push ( { method, params } ) ;
46+ return handoff ;
47+ } ;
48+
49+ const params = {
50+ extensionId : 'extension' ,
51+ installUrl : 'https://autohand.ai/chrome/installed' ,
52+ } ;
53+ await expect ( client . createBrowserHandoff ( params ) ) . resolves . toEqual ( handoff ) ;
54+ expect ( calls ) . toEqual ( [ {
55+ method : 'autohand.browserHandoff.create' ,
56+ params,
57+ } ] ) ;
58+
59+ const sdk = {
60+ createBrowserHandoff : async ( ) => handoff ,
61+ } as unknown as AutohandSDK ;
62+ const agent = Agent . fromSDK ( sdk ) ;
63+ await expect ( agent . createBrowserHandoff ( params ) ) . resolves . toEqual ( handoff ) ;
64+ } ) ;
3265} ) ;
0 commit comments