@@ -6,7 +6,7 @@ import * as path from "path"
66import * as vscode from "vscode"
77import { Anthropic } from "@anthropic-ai/sdk"
88
9- import { providerIdentifiers , type GlobalState , type ProviderSettings , type ModelInfo } from "@roo-code/types"
9+ import type { GlobalState , ProviderSettings , ModelInfo } from "@roo-code/types"
1010import { TelemetryService } from "@roo-code/telemetry"
1111
1212import { Task } from "../Task"
@@ -1902,55 +1902,47 @@ describe("Cline", () => {
19021902 expect ( metadata ! . abortSignal ) . toBe ( task . currentRequestAbortController ! . signal )
19031903 } )
19041904
1905- it ( "uses the canonical Gemini identifier when configuring tool restrictions" , async ( ) => {
1906- const identifiers = providerIdentifiers as Record < string , string >
1907- const originalIdentifier = identifiers . gemini
1908-
1909- try {
1910- identifiers . gemini = "canonical-gemini"
1911- const apiConfiguration = {
1912- ...mockApiConfig ,
1913- apiProvider : identifiers . gemini ,
1914- } as ProviderSettings
1915- const task = new Task ( {
1916- provider : mockProvider ,
1917- apiConfiguration,
1918- task : "test task" ,
1919- startTask : false ,
1920- } )
1921-
1922- vi . spyOn ( task as any , "getSystemPrompt" ) . mockResolvedValue ( "mock system prompt" )
1923- vi . spyOn ( task . api , "getModel" ) . mockReturnValue ( {
1924- id : mockApiConfig . apiModelId ! ,
1925- info : { contextWindow : 200000 , maxTokens : 4096 } as ModelInfo ,
1926- } )
1927- const providerState = await mockProvider . getState ( )
1928- vi . spyOn ( mockProvider , "getState" ) . mockResolvedValue ( {
1929- ...providerState ,
1930- apiConfiguration,
1931- autoApprovalEnabled : true ,
1932- requestDelaySeconds : 0 ,
1933- } )
1934- const mockStream = ( async function * ( ) {
1935- yield { type : "text" , text : "response" } as ApiStreamChunk
1936- } ) ( )
1937- const createMessageSpy = vi . spyOn ( task . api , "createMessage" ) . mockReturnValue ( mockStream )
1938- task . apiConversationHistory = [
1939- { role : "user" , content : [ { type : "text" , text : "test message" } ] , ts : Date . now ( ) } ,
1940- ] as any
1941-
1942- await task . attemptApiRequest ( 0 ) . next ( )
1943-
1944- const [ , , metadata ] = createMessageSpy . mock . calls [ 0 ] !
1945- expect ( metadata ) . toEqual (
1946- expect . objectContaining ( {
1947- tools : expect . any ( Array ) ,
1948- allowedFunctionNames : expect . any ( Array ) ,
1949- } ) ,
1950- )
1951- } finally {
1952- identifiers . gemini = originalIdentifier
1953- }
1905+ it ( "configures tool restrictions for Gemini requests" , async ( ) => {
1906+ const apiConfiguration = {
1907+ ...mockApiConfig ,
1908+ apiProvider : "gemini" ,
1909+ } as ProviderSettings
1910+ const task = new Task ( {
1911+ provider : mockProvider ,
1912+ apiConfiguration,
1913+ task : "test task" ,
1914+ startTask : false ,
1915+ } )
1916+
1917+ vi . spyOn ( task as any , "getSystemPrompt" ) . mockResolvedValue ( "mock system prompt" )
1918+ vi . spyOn ( task . api , "getModel" ) . mockReturnValue ( {
1919+ id : mockApiConfig . apiModelId ! ,
1920+ info : { contextWindow : 200000 , maxTokens : 4096 } as ModelInfo ,
1921+ } )
1922+ const providerState = await mockProvider . getState ( )
1923+ vi . spyOn ( mockProvider , "getState" ) . mockResolvedValue ( {
1924+ ...providerState ,
1925+ apiConfiguration,
1926+ autoApprovalEnabled : true ,
1927+ requestDelaySeconds : 0 ,
1928+ } )
1929+ const mockStream = ( async function * ( ) {
1930+ yield { type : "text" , text : "response" } as ApiStreamChunk
1931+ } ) ( )
1932+ const createMessageSpy = vi . spyOn ( task . api , "createMessage" ) . mockReturnValue ( mockStream )
1933+ task . apiConversationHistory = [
1934+ { role : "user" , content : [ { type : "text" , text : "test message" } ] , ts : Date . now ( ) } ,
1935+ ] as any
1936+
1937+ await task . attemptApiRequest ( 0 ) . next ( )
1938+
1939+ const [ , , metadata ] = createMessageSpy . mock . calls [ 0 ] !
1940+ expect ( metadata ) . toEqual (
1941+ expect . objectContaining ( {
1942+ tools : expect . any ( Array ) ,
1943+ allowedFunctionNames : expect . any ( Array ) ,
1944+ } ) ,
1945+ )
19541946 } )
19551947
19561948 it ( "should invoke abort on currentRequestAbortController during first-chunk wait" , async ( ) => {
0 commit comments