@@ -151,7 +151,9 @@ describe("Session-scoped state extras RPC", async () => {
151151 expect ( JSON . stringify ( added . models [ 0 ] ) ) . toContain ( "SDK Runtime Model" ) ;
152152
153153 const listed = await session . rpc . model . list ( ) ;
154- expect ( listed . list . some ( ( model ) => JSON . stringify ( model ) . includes ( selectionId ) ) ) . toBe ( true ) ;
154+ expect ( listed . list . some ( ( model ) => JSON . stringify ( model ) . includes ( selectionId ) ) ) . toBe (
155+ true
156+ ) ;
155157
156158 const switched = await session . rpc . model . switchTo ( { modelId : selectionId } ) ;
157159 expect ( switched . modelId ) . toBe ( selectionId ) ;
@@ -161,21 +163,25 @@ describe("Session-scoped state extras RPC", async () => {
161163 }
162164 } ) ;
163165
164- it ( "should return empty completions when host does not provide them" , { timeout : 120_000 } , async ( ) => {
165- const session = await createSession ( ) ;
166- try {
167- const triggers = await session . rpc . completions . getTriggerCharacters ( ) ;
168- expect ( triggers . triggerCharacters ) . toEqual ( [ ] ) ;
169-
170- const completions = await session . rpc . completions . request ( {
171- text : "Use @" ,
172- offset : 5 ,
173- } ) ;
174- expect ( completions . items ) . toEqual ( [ ] ) ;
175- } finally {
176- await session . disconnect ( ) ;
166+ it (
167+ "should return empty completions when host does not provide them" ,
168+ { timeout : 120_000 } ,
169+ async ( ) => {
170+ const session = await createSession ( ) ;
171+ try {
172+ const triggers = await session . rpc . completions . getTriggerCharacters ( ) ;
173+ expect ( triggers . triggerCharacters ) . toEqual ( [ ] ) ;
174+
175+ const completions = await session . rpc . completions . request ( {
176+ text : "Use @" ,
177+ offset : 5 ,
178+ } ) ;
179+ expect ( completions . items ) . toEqual ( [ ] ) ;
180+ } finally {
181+ await session . disconnect ( ) ;
182+ }
177183 }
178- } ) ;
184+ ) ;
179185
180186 it ( "should report visibility as unsynced for local session" , { timeout : 120_000 } , async ( ) => {
181187 const session = await createSession ( ) ;
@@ -219,40 +225,46 @@ describe("Session-scoped state extras RPC", async () => {
219225 }
220226 } ) ;
221227
222- it ( "should get context attribution and heaviest messages after turn" , { timeout : 120_000 } , async ( ) => {
223- const session = await createSession ( ) ;
224- try {
225- const answer = await session . sendAndWait ( {
226- prompt : "Say CONTEXT_METADATA_OK exactly." ,
227- } ) ;
228- expect ( answer ?. data . content ?? "" ) . toContain ( "CONTEXT_METADATA_OK" ) ;
229-
230- const attribution = await session . rpc . metadata . getContextAttribution ( ) ;
231- expect ( attribution . contextAttribution ) . not . toBeNull ( ) ;
232- const contextAttribution = attribution . contextAttribution ! ;
233- expect ( contextAttribution . totalTokens ) . toBeGreaterThan ( 0 ) ;
234- expect ( contextAttribution . entries . length ) . toBeGreaterThan ( 0 ) ;
235- for ( const entry of contextAttribution . entries ) {
236- expect ( entry . id . trim ( ) ) . toBeTruthy ( ) ;
237- expect ( entry . kind . trim ( ) ) . toBeTruthy ( ) ;
238- expect ( entry . label . trim ( ) ) . toBeTruthy ( ) ;
239- expect ( entry . tokens ) . toBeGreaterThanOrEqual ( 0 ) ;
240- for ( const attribute of entry . attributes ?? [ ] ) {
241- expect ( attribute . key . trim ( ) ) . toBeTruthy ( ) ;
228+ it (
229+ "should get context attribution and heaviest messages after turn" ,
230+ { timeout : 120_000 } ,
231+ async ( ) => {
232+ const session = await createSession ( ) ;
233+ try {
234+ const answer = await session . sendAndWait ( {
235+ prompt : "Say CONTEXT_METADATA_OK exactly." ,
236+ } ) ;
237+ expect ( answer ?. data . content ?? "" ) . toContain ( "CONTEXT_METADATA_OK" ) ;
238+
239+ const attribution = await session . rpc . metadata . getContextAttribution ( ) ;
240+ expect ( attribution . contextAttribution ) . not . toBeNull ( ) ;
241+ const contextAttribution = attribution . contextAttribution ! ;
242+ expect ( contextAttribution . totalTokens ) . toBeGreaterThan ( 0 ) ;
243+ expect ( contextAttribution . entries . length ) . toBeGreaterThan ( 0 ) ;
244+ for ( const entry of contextAttribution . entries ) {
245+ expect ( entry . id . trim ( ) ) . toBeTruthy ( ) ;
246+ expect ( entry . kind . trim ( ) ) . toBeTruthy ( ) ;
247+ expect ( entry . label . trim ( ) ) . toBeTruthy ( ) ;
248+ expect ( entry . tokens ) . toBeGreaterThanOrEqual ( 0 ) ;
249+ for ( const attribute of entry . attributes ?? [ ] ) {
250+ expect ( attribute . key . trim ( ) ) . toBeTruthy ( ) ;
251+ }
242252 }
243- }
244253
245- const heaviest = await session . rpc . metadata . getContextHeaviestMessages ( { limit : 2 } ) ;
246- expect ( heaviest . totalTokens ) . toBeGreaterThan ( 0 ) ;
247- expect ( heaviest . messages . length ) . toBeLessThanOrEqual ( 2 ) ;
248- for ( const message of heaviest . messages ) {
249- expect ( message . id . trim ( ) ) . toBeTruthy ( ) ;
250- expect ( message . tokens ) . toBeGreaterThanOrEqual ( 0 ) ;
254+ const heaviest = await session . rpc . metadata . getContextHeaviestMessages ( {
255+ limit : 2 ,
256+ } ) ;
257+ expect ( heaviest . totalTokens ) . toBeGreaterThan ( 0 ) ;
258+ expect ( heaviest . messages . length ) . toBeLessThanOrEqual ( 2 ) ;
259+ for ( const message of heaviest . messages ) {
260+ expect ( message . id . trim ( ) ) . toBeTruthy ( ) ;
261+ expect ( message . tokens ) . toBeGreaterThanOrEqual ( 0 ) ;
262+ }
263+ } finally {
264+ await session . disconnect ( ) ;
251265 }
252- } finally {
253- await session . disconnect ( ) ;
254266 }
255- } ) ;
267+ ) ;
256268
257269 it ( "should update and clear live subagent settings" , { timeout : 120_000 } , async ( ) => {
258270 const session = await createSession ( ) ;
0 commit comments