refactor(websearch): rename search domain
This commit is contained in:
parent
97aa6713b5
commit
c86f4e9b9b
51 changed files with 478 additions and 462 deletions
|
|
@ -1,7 +1,9 @@
|
|||
import type { ModelApi, ProviderApi } from "./api/api.js"
|
||||
import type { ModelApi, ProviderApi, WebsearchApi } from "./api/api.js"
|
||||
|
||||
export type * from "./api/api.js"
|
||||
|
||||
export type WebSearchApi<E = never> = WebsearchApi<E>
|
||||
|
||||
export interface CatalogApi<E = never> {
|
||||
readonly provider: ProviderApi<E>
|
||||
readonly model: ModelApi<E>
|
||||
|
|
|
|||
|
|
@ -923,33 +923,38 @@ export interface DebugApi<E = never> {
|
|||
readonly location: { readonly list: DebugLocationListOperation<E>; readonly evict: DebugLocationEvictOperation<E> }
|
||||
}
|
||||
|
||||
type Endpoint26_0Request = Parameters<RawClient["server.search"]["search.provider.get"]>[0]
|
||||
type Endpoint26_0Request = Parameters<RawClient["server.websearch"]["websearch.provider.get"]>[0]
|
||||
export type Endpoint26_0Input = { readonly location?: Endpoint26_0Request["query"]["location"] }
|
||||
export type Endpoint26_0Output = EffectValue<ReturnType<RawClient["server.search"]["search.provider.get"]>>
|
||||
export type SearchProviderGetOperation<E = never> = (input?: Endpoint26_0Input) => Effect.Effect<Endpoint26_0Output, E>
|
||||
export type Endpoint26_0Output = EffectValue<ReturnType<RawClient["server.websearch"]["websearch.provider.get"]>>
|
||||
export type WebsearchProviderGetOperation<E = never> = (
|
||||
input?: Endpoint26_0Input,
|
||||
) => Effect.Effect<Endpoint26_0Output, E>
|
||||
|
||||
type Endpoint26_1Request = Parameters<RawClient["server.search"]["search.provider.select"]>[0]
|
||||
type Endpoint26_1Request = Parameters<RawClient["server.websearch"]["websearch.provider.select"]>[0]
|
||||
export type Endpoint26_1Input = {
|
||||
readonly location?: Endpoint26_1Request["query"]["location"]
|
||||
readonly providerID: Endpoint26_1Request["payload"]["providerID"]
|
||||
}
|
||||
export type Endpoint26_1Output = EffectValue<ReturnType<RawClient["server.search"]["search.provider.select"]>>
|
||||
export type SearchProviderSelectOperation<E = never> = (
|
||||
export type Endpoint26_1Output = EffectValue<ReturnType<RawClient["server.websearch"]["websearch.provider.select"]>>
|
||||
export type WebsearchProviderSelectOperation<E = never> = (
|
||||
input: Endpoint26_1Input,
|
||||
) => Effect.Effect<Endpoint26_1Output, E>
|
||||
|
||||
type Endpoint26_2Request = Parameters<RawClient["server.search"]["search.query"]>[0]
|
||||
type Endpoint26_2Request = Parameters<RawClient["server.websearch"]["websearch.query"]>[0]
|
||||
export type Endpoint26_2Input = {
|
||||
readonly location?: Endpoint26_2Request["query"]["location"]
|
||||
readonly query: Endpoint26_2Request["payload"]["query"]
|
||||
readonly providerID?: Endpoint26_2Request["payload"]["providerID"]
|
||||
}
|
||||
export type Endpoint26_2Output = EffectValue<ReturnType<RawClient["server.search"]["search.query"]>>
|
||||
export type SearchQueryOperation<E = never> = (input: Endpoint26_2Input) => Effect.Effect<Endpoint26_2Output, E>
|
||||
export type Endpoint26_2Output = EffectValue<ReturnType<RawClient["server.websearch"]["websearch.query"]>>
|
||||
export type WebsearchQueryOperation<E = never> = (input: Endpoint26_2Input) => Effect.Effect<Endpoint26_2Output, E>
|
||||
|
||||
export interface SearchApi<E = never> {
|
||||
readonly provider: { readonly get: SearchProviderGetOperation<E>; readonly select: SearchProviderSelectOperation<E> }
|
||||
readonly query: SearchQueryOperation<E>
|
||||
export interface WebsearchApi<E = never> {
|
||||
readonly provider: {
|
||||
readonly get: WebsearchProviderGetOperation<E>
|
||||
readonly select: WebsearchProviderSelectOperation<E>
|
||||
}
|
||||
readonly query: WebsearchQueryOperation<E>
|
||||
}
|
||||
|
||||
export interface AppApi<E = never> {
|
||||
|
|
@ -979,5 +984,5 @@ export interface AppApi<E = never> {
|
|||
readonly projectCopy: ProjectCopyApi<E>
|
||||
readonly vcs: VcsApi<E>
|
||||
readonly debug: DebugApi<E>
|
||||
readonly search: SearchApi<E>
|
||||
readonly websearch: WebsearchApi<E>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1099,35 +1099,35 @@ const adaptGroup25 = (raw: RawClient["server.debug"]) => ({
|
|||
location: { list: Endpoint25_0(raw), evict: Endpoint25_1(raw) },
|
||||
})
|
||||
|
||||
type Endpoint26_0Request = Parameters<RawClient["server.search"]["search.provider.get"]>[0]
|
||||
type Endpoint26_0Request = Parameters<RawClient["server.websearch"]["websearch.provider.get"]>[0]
|
||||
type Endpoint26_0Input = { readonly location?: Endpoint26_0Request["query"]["location"] }
|
||||
const Endpoint26_0 = (raw: RawClient["server.search"]) => (input?: Endpoint26_0Input) =>
|
||||
raw["search.provider.get"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))
|
||||
const Endpoint26_0 = (raw: RawClient["server.websearch"]) => (input?: Endpoint26_0Input) =>
|
||||
raw["websearch.provider.get"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))
|
||||
|
||||
type Endpoint26_1Request = Parameters<RawClient["server.search"]["search.provider.select"]>[0]
|
||||
type Endpoint26_1Request = Parameters<RawClient["server.websearch"]["websearch.provider.select"]>[0]
|
||||
type Endpoint26_1Input = {
|
||||
readonly location?: Endpoint26_1Request["query"]["location"]
|
||||
readonly providerID: Endpoint26_1Request["payload"]["providerID"]
|
||||
}
|
||||
const Endpoint26_1 = (raw: RawClient["server.search"]) => (input: Endpoint26_1Input) =>
|
||||
raw["search.provider.select"]({
|
||||
const Endpoint26_1 = (raw: RawClient["server.websearch"]) => (input: Endpoint26_1Input) =>
|
||||
raw["websearch.provider.select"]({
|
||||
query: { location: input["location"] },
|
||||
payload: { providerID: input["providerID"] },
|
||||
}).pipe(Effect.mapError(mapClientError))
|
||||
|
||||
type Endpoint26_2Request = Parameters<RawClient["server.search"]["search.query"]>[0]
|
||||
type Endpoint26_2Request = Parameters<RawClient["server.websearch"]["websearch.query"]>[0]
|
||||
type Endpoint26_2Input = {
|
||||
readonly location?: Endpoint26_2Request["query"]["location"]
|
||||
readonly query: Endpoint26_2Request["payload"]["query"]
|
||||
readonly providerID?: Endpoint26_2Request["payload"]["providerID"]
|
||||
}
|
||||
const Endpoint26_2 = (raw: RawClient["server.search"]) => (input: Endpoint26_2Input) =>
|
||||
raw["search.query"]({
|
||||
const Endpoint26_2 = (raw: RawClient["server.websearch"]) => (input: Endpoint26_2Input) =>
|
||||
raw["websearch.query"]({
|
||||
query: { location: input["location"] },
|
||||
payload: { query: input["query"], providerID: input["providerID"] },
|
||||
}).pipe(Effect.mapError(mapClientError))
|
||||
|
||||
const adaptGroup26 = (raw: RawClient["server.search"]) => ({
|
||||
const adaptGroup26 = (raw: RawClient["server.websearch"]) => ({
|
||||
provider: { get: Endpoint26_0(raw), select: Endpoint26_1(raw) },
|
||||
query: Endpoint26_2(raw),
|
||||
})
|
||||
|
|
@ -1159,7 +1159,7 @@ const adaptClient = (raw: RawClient) => ({
|
|||
projectCopy: adaptGroup23(raw["server.projectCopy"]),
|
||||
vcs: adaptGroup24(raw["server.vcs"]),
|
||||
debug: adaptGroup25(raw["server.debug"]),
|
||||
search: adaptGroup26(raw["server.search"]),
|
||||
websearch: adaptGroup26(raw["server.websearch"]),
|
||||
})
|
||||
|
||||
export const make = (options?: { readonly baseUrl?: URL | string }) =>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export type {
|
|||
PluginApi,
|
||||
ProviderApi,
|
||||
ReferenceApi,
|
||||
SearchApi,
|
||||
WebSearchApi,
|
||||
SessionApi,
|
||||
SkillApi,
|
||||
} from "./api.js"
|
||||
|
|
@ -37,7 +37,7 @@ export { Provider } from "@opencode-ai/schema/provider"
|
|||
export { Pty } from "@opencode-ai/schema/pty"
|
||||
export { Question } from "@opencode-ai/schema/question"
|
||||
export { Reference } from "@opencode-ai/schema/reference"
|
||||
export { Search } from "@opencode-ai/schema/search"
|
||||
export { WebSearch } from "@opencode-ai/schema/websearch"
|
||||
export { AbsolutePath, RelativePath } from "@opencode-ai/schema/schema"
|
||||
export { Session } from "@opencode-ai/schema/session"
|
||||
export { SessionInput } from "@opencode-ai/schema/session-input"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import type {
|
|||
PluginApi as EffectPluginApi,
|
||||
ProviderApi as EffectProviderApi,
|
||||
ReferenceApi as EffectReferenceApi,
|
||||
SearchApi as EffectSearchApi,
|
||||
WebsearchApi,
|
||||
SessionApi as EffectSessionApi,
|
||||
SkillApi as EffectSkillApi,
|
||||
} from "../effect/api/api.js"
|
||||
|
|
@ -37,7 +37,7 @@ export type ModelApi = PromisifyApi<EffectModelApi<unknown>>
|
|||
export type PluginApi = PromisifyApi<EffectPluginApi<unknown>>
|
||||
export type ProviderApi = PromisifyApi<EffectProviderApi<unknown>>
|
||||
export type ReferenceApi = PromisifyApi<EffectReferenceApi<unknown>>
|
||||
export type SearchApi = PromisifyApi<EffectSearchApi<unknown>>
|
||||
export type WebSearchApi = PromisifyApi<WebsearchApi<unknown>>
|
||||
export type SessionApi = PromisifyApi<EffectSessionApi<unknown>>
|
||||
export type SkillApi = PromisifyApi<EffectSkillApi<unknown>>
|
||||
|
||||
|
|
|
|||
|
|
@ -184,12 +184,12 @@ import type {
|
|||
DebugLocationListOutput,
|
||||
DebugLocationEvictInput,
|
||||
DebugLocationEvictOutput,
|
||||
SearchProviderGetInput,
|
||||
SearchProviderGetOutput,
|
||||
SearchProviderSelectInput,
|
||||
SearchProviderSelectOutput,
|
||||
SearchQueryInput,
|
||||
SearchQueryOutput,
|
||||
WebsearchProviderGetInput,
|
||||
WebsearchProviderGetOutput,
|
||||
WebsearchProviderSelectInput,
|
||||
WebsearchProviderSelectOutput,
|
||||
WebsearchQueryInput,
|
||||
WebsearchQueryOutput,
|
||||
} from "./types"
|
||||
import { ClientError } from "./client-error"
|
||||
|
||||
|
|
@ -1566,13 +1566,13 @@ export function make(options: ClientOptions) {
|
|||
),
|
||||
},
|
||||
},
|
||||
search: {
|
||||
websearch: {
|
||||
provider: {
|
||||
get: (input?: SearchProviderGetInput, requestOptions?: RequestOptions) =>
|
||||
request<SearchProviderGetOutput>(
|
||||
get: (input?: WebsearchProviderGetInput, requestOptions?: RequestOptions) =>
|
||||
request<WebsearchProviderGetOutput>(
|
||||
{
|
||||
method: "GET",
|
||||
path: `/api/search/provider`,
|
||||
path: `/api/websearch/provider`,
|
||||
query: { location: input?.["location"] },
|
||||
successStatus: 200,
|
||||
declaredStatuses: [401, 400],
|
||||
|
|
@ -1580,11 +1580,11 @@ export function make(options: ClientOptions) {
|
|||
},
|
||||
requestOptions,
|
||||
),
|
||||
select: (input: SearchProviderSelectInput, requestOptions?: RequestOptions) =>
|
||||
request<SearchProviderSelectOutput>(
|
||||
select: (input: WebsearchProviderSelectInput, requestOptions?: RequestOptions) =>
|
||||
request<WebsearchProviderSelectOutput>(
|
||||
{
|
||||
method: "POST",
|
||||
path: `/api/search/provider`,
|
||||
path: `/api/websearch/provider`,
|
||||
query: { location: input["location"] },
|
||||
body: { providerID: input["providerID"] },
|
||||
successStatus: 204,
|
||||
|
|
@ -1594,11 +1594,11 @@ export function make(options: ClientOptions) {
|
|||
requestOptions,
|
||||
),
|
||||
},
|
||||
query: (input: SearchQueryInput, requestOptions?: RequestOptions) =>
|
||||
request<SearchQueryOutput>(
|
||||
query: (input: WebsearchQueryInput, requestOptions?: RequestOptions) =>
|
||||
request<WebsearchQueryOutput>(
|
||||
{
|
||||
method: "POST",
|
||||
path: `/api/search`,
|
||||
path: `/api/websearch`,
|
||||
query: { location: input["location"] },
|
||||
body: { query: input["query"], providerID: input["providerID"] },
|
||||
successStatus: 200,
|
||||
|
|
|
|||
|
|
@ -2306,7 +2306,7 @@ export type IntegrationListOutput = {
|
|||
| { readonly type: "key"; readonly label?: string }
|
||||
| { readonly type: "env"; readonly names: ReadonlyArray<string> }
|
||||
>
|
||||
readonly search?: { readonly connection: "optional" | "required" }
|
||||
readonly websearch?: { readonly connection: "optional" | "required" }
|
||||
readonly connections: ReadonlyArray<
|
||||
| { readonly type: "credential"; readonly id: string; readonly label: string }
|
||||
| { readonly type: "env"; readonly name: string }
|
||||
|
|
@ -2359,7 +2359,7 @@ export type IntegrationGetOutput = {
|
|||
| { readonly type: "key"; readonly label?: string }
|
||||
| { readonly type: "env"; readonly names: ReadonlyArray<string> }
|
||||
>
|
||||
readonly search?: { readonly connection: "optional" | "required" }
|
||||
readonly websearch?: { readonly connection: "optional" | "required" }
|
||||
readonly connections: ReadonlyArray<
|
||||
| { readonly type: "credential"; readonly id: string; readonly label: string }
|
||||
| { readonly type: "env"; readonly name: string }
|
||||
|
|
@ -6279,13 +6279,13 @@ export type DebugLocationEvictInput = {
|
|||
|
||||
export type DebugLocationEvictOutput = void
|
||||
|
||||
export type SearchProviderGetInput = {
|
||||
export type WebsearchProviderGetInput = {
|
||||
readonly location?: {
|
||||
readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined
|
||||
}["location"]
|
||||
}
|
||||
|
||||
export type SearchProviderGetOutput = {
|
||||
export type WebsearchProviderGetOutput = {
|
||||
readonly location: {
|
||||
readonly directory: string
|
||||
readonly workspaceID?: string
|
||||
|
|
@ -6294,16 +6294,16 @@ export type SearchProviderGetOutput = {
|
|||
readonly data: string | null
|
||||
}
|
||||
|
||||
export type SearchProviderSelectInput = {
|
||||
export type WebsearchProviderSelectInput = {
|
||||
readonly location?: {
|
||||
readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined
|
||||
}["location"]
|
||||
readonly providerID: { readonly providerID: string }["providerID"]
|
||||
}
|
||||
|
||||
export type SearchProviderSelectOutput = void
|
||||
export type WebsearchProviderSelectOutput = void
|
||||
|
||||
export type SearchQueryInput = {
|
||||
export type WebsearchQueryInput = {
|
||||
readonly location?: {
|
||||
readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined
|
||||
}["location"]
|
||||
|
|
@ -6311,7 +6311,7 @@ export type SearchQueryInput = {
|
|||
readonly providerID?: { readonly query: string; readonly providerID?: string }["providerID"]
|
||||
}
|
||||
|
||||
export type SearchQueryOutput = {
|
||||
export type WebsearchQueryOutput = {
|
||||
readonly location: {
|
||||
readonly directory: string
|
||||
readonly workspaceID?: string
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export type {
|
|||
PluginApi,
|
||||
ProviderApi,
|
||||
ReferenceApi,
|
||||
SearchApi,
|
||||
WebSearchApi,
|
||||
SessionApi,
|
||||
SkillApi,
|
||||
} from "./api.js"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue