@@ -209,6 +209,31 @@ export const modelInfoSchema = z.object({
209209
210210export type ModelInfo = z . infer < typeof modelInfoSchema >
211211
212+ /**
213+ * Codebase Index Config
214+ */
215+ export const codebaseIndexConfigSchema = z . object ( {
216+ codebaseIndexEnabled : z . boolean ( ) . optional ( ) ,
217+ codebaseIndexQdrantUrl : z . string ( ) . optional ( ) ,
218+ codebaseIndexEmbedderProvider : z . enum ( [ "openai" , "ollama" ] ) . optional ( ) ,
219+ codebaseIndexEmbedderBaseUrl : z . string ( ) . optional ( ) ,
220+ codebaseIndexEmbedderModelId : z . string ( ) . optional ( ) ,
221+ } )
222+
223+ export type CodebaseIndexConfig = z . infer < typeof codebaseIndexConfigSchema >
224+
225+ export const codebaseIndexModelsSchema = z . object ( {
226+ openai : z . record ( z . string ( ) , z . object ( { dimension : z . number ( ) } ) ) . optional ( ) ,
227+ ollama : z . record ( z . string ( ) , z . object ( { dimension : z . number ( ) } ) ) . optional ( ) ,
228+ } )
229+
230+ export type CodebaseIndexModels = z . infer < typeof codebaseIndexModelsSchema >
231+
232+ export const codebaseIndexProviderSchema = z . object ( {
233+ codeIndexOpenAiKey : z . string ( ) . optional ( ) ,
234+ codeIndexQdrantApiKey : z . string ( ) . optional ( ) ,
235+ } )
236+
212237/**
213238 * HistoryItem
214239 */
@@ -622,6 +647,7 @@ export const providerSettingsSchema = z.object({
622647 ...groqSchema . shape ,
623648 ...chutesSchema . shape ,
624649 ...litellmSchema . shape ,
650+ ...codebaseIndexProviderSchema . shape ,
625651} )
626652
627653export type ProviderSettings = z . infer < typeof providerSettingsSchema >
@@ -698,6 +724,9 @@ const providerSettingsRecord: ProviderSettingsRecord = {
698724 // Requesty
699725 requestyApiKey : undefined ,
700726 requestyModelId : undefined ,
727+ // Code Index
728+ codeIndexOpenAiKey : undefined ,
729+ codeIndexQdrantApiKey : undefined ,
701730 // Reasoning
702731 enableReasoningEffort : undefined ,
703732 reasoningEffort : undefined ,
@@ -744,6 +773,8 @@ export const globalSettingsSchema = z.object({
744773 autoApprovalEnabled : z . boolean ( ) . optional ( ) ,
745774 alwaysAllowReadOnly : z . boolean ( ) . optional ( ) ,
746775 alwaysAllowReadOnlyOutsideWorkspace : z . boolean ( ) . optional ( ) ,
776+ codebaseIndexModels : codebaseIndexModelsSchema . optional ( ) ,
777+ codebaseIndexConfig : codebaseIndexConfigSchema . optional ( ) ,
747778 alwaysAllowWrite : z . boolean ( ) . optional ( ) ,
748779 alwaysAllowWriteOutsideWorkspace : z . boolean ( ) . optional ( ) ,
749780 writeDelayMs : z . number ( ) . optional ( ) ,
@@ -814,6 +845,8 @@ export type GlobalSettings = z.infer<typeof globalSettingsSchema>
814845type GlobalSettingsRecord = Record < Keys < GlobalSettings > , undefined >
815846
816847const globalSettingsRecord : GlobalSettingsRecord = {
848+ codebaseIndexModels : undefined ,
849+ codebaseIndexConfig : undefined ,
817850 currentApiConfigName : undefined ,
818851 listApiConfigMeta : undefined ,
819852 pinnedApiConfigs : undefined ,
@@ -926,8 +959,12 @@ export type SecretState = Pick<
926959 | "groqApiKey"
927960 | "chutesApiKey"
928961 | "litellmApiKey"
962+ | "codeIndexOpenAiKey"
963+ | "codeIndexQdrantApiKey"
929964>
930965
966+ export type CodeIndexSecrets = "codeIndexOpenAiKey" | "codeIndexQdrantApiKey"
967+
931968type SecretStateRecord = Record < Keys < SecretState > , undefined >
932969
933970const secretStateRecord : SecretStateRecord = {
@@ -948,6 +985,8 @@ const secretStateRecord: SecretStateRecord = {
948985 groqApiKey : undefined ,
949986 chutesApiKey : undefined ,
950987 litellmApiKey : undefined ,
988+ codeIndexOpenAiKey : undefined ,
989+ codeIndexQdrantApiKey : undefined ,
951990}
952991
953992export const SECRET_STATE_KEYS = Object . keys ( secretStateRecord ) as Keys < SecretState > [ ]
@@ -1016,6 +1055,7 @@ export const clineSays = [
10161055 "rooignore_error" ,
10171056 "diff_error" ,
10181057 "condense_context" ,
1058+ "codebase_search_result" ,
10191059] as const
10201060
10211061export const clineSaySchema = z . enum ( clineSays )
@@ -1104,6 +1144,7 @@ export const toolNames = [
11041144 "switch_mode" ,
11051145 "new_task" ,
11061146 "fetch_instructions" ,
1147+ "codebase_search" ,
11071148] as const
11081149
11091150export const toolNamesSchema = z . enum ( toolNames )
0 commit comments