File size: 691 Bytes
1f21206 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import { api } from './client'
type SearchResult = {
file: string
line: number
text: string
context?: string[]
}
type SearchResponse = { results: SearchResult[]; total: number }
type SessionSearchResult = {
sessionId: string
title: string
matchCount: number
matches: Array<{ line: number; text: string }>
}
type SessionSearchResponse = { results: SessionSearchResult[] }
export const searchApi = {
search(params: { query: string; cwd?: string; maxResults?: number; glob?: string }) {
return api.post<SearchResponse>('/api/search', params)
},
searchSessions(query: string) {
return api.post<SessionSearchResponse>('/api/search/sessions', { query })
},
}
|