refactor(websearch): rename search domain
This commit is contained in:
parent
97aa6713b5
commit
c86f4e9b9b
51 changed files with 478 additions and 462 deletions
|
|
@ -24,7 +24,7 @@ import { ReferenceGroup } from "./groups/reference.js"
|
|||
import { Authorization } from "./middleware/authorization.js"
|
||||
import { LocationGroup } from "./groups/location.js"
|
||||
import { IntegrationGroup } from "./groups/integration.js"
|
||||
import { SearchGroup } from "./groups/search.js"
|
||||
import { WebSearchGroup } from "./groups/websearch.js"
|
||||
import { McpGroup } from "./groups/mcp.js"
|
||||
import { CredentialGroup } from "./groups/credential.js"
|
||||
import { ProjectGroup } from "./groups/project.js"
|
||||
|
|
@ -39,7 +39,7 @@ type LocationGroups<LocationId extends HttpApiMiddleware.AnyId> =
|
|||
| HttpApiGroup.AddMiddleware<typeof GenerateGroup, LocationId>
|
||||
| HttpApiGroup.AddMiddleware<typeof ProviderGroup, LocationId>
|
||||
| HttpApiGroup.AddMiddleware<typeof IntegrationGroup, LocationId>
|
||||
| HttpApiGroup.AddMiddleware<typeof SearchGroup, LocationId>
|
||||
| HttpApiGroup.AddMiddleware<typeof WebSearchGroup, LocationId>
|
||||
| HttpApiGroup.AddMiddleware<typeof McpGroup, LocationId>
|
||||
| HttpApiGroup.AddMiddleware<typeof CredentialGroup, LocationId>
|
||||
| HttpApiGroup.AddMiddleware<typeof ProjectGroup, LocationId>
|
||||
|
|
@ -170,7 +170,7 @@ const makeApiFromGroup = <
|
|||
.add(ProjectCopyGroup.middleware(locationMiddleware))
|
||||
.add(VcsGroup.middleware(locationMiddleware))
|
||||
.add(DebugGroup)
|
||||
.add(SearchGroup.middleware(locationMiddleware))
|
||||
.add(WebSearchGroup.middleware(locationMiddleware))
|
||||
.annotateMerge(
|
||||
OpenApi.annotations({
|
||||
title: "opencode HttpApi",
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ export const groupNames = {
|
|||
"server.generate": "generate",
|
||||
"server.provider": "provider",
|
||||
"server.integration": "integration",
|
||||
"server.search": "search",
|
||||
"server.websearch": "websearch",
|
||||
"server.credential": "credential",
|
||||
"server.form": "form",
|
||||
"server.permission": "permission",
|
||||
|
|
|
|||
|
|
@ -1,28 +1,28 @@
|
|||
import { Integration } from "@opencode-ai/schema/integration"
|
||||
import { Location } from "@opencode-ai/schema/location"
|
||||
import { Search } from "@opencode-ai/schema/search"
|
||||
import { WebSearch } from "@opencode-ai/schema/websearch"
|
||||
import { Schema } from "effect"
|
||||
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/unstable/httpapi"
|
||||
import { InvalidRequestError, ServiceUnavailableError } from "../errors.js"
|
||||
import { LocationQuery, locationQueryOpenApi } from "./location.js"
|
||||
|
||||
export const SearchGroup = HttpApiGroup.make("server.search")
|
||||
export const WebSearchGroup = HttpApiGroup.make("server.websearch")
|
||||
.add(
|
||||
HttpApiEndpoint.get("search.provider.get", "/api/search/provider", {
|
||||
HttpApiEndpoint.get("websearch.provider.get", "/api/websearch/provider", {
|
||||
query: LocationQuery,
|
||||
success: Location.response(Schema.UndefinedOr(Integration.ID)),
|
||||
})
|
||||
.annotateMerge(locationQueryOpenApi)
|
||||
.annotateMerge(
|
||||
OpenApi.annotations({
|
||||
identifier: "v2.search.provider.get",
|
||||
summary: "Get default search provider",
|
||||
identifier: "v2.websearch.provider.get",
|
||||
summary: "Get default web search provider",
|
||||
description: "Return the globally selected web search provider.",
|
||||
}),
|
||||
),
|
||||
)
|
||||
.add(
|
||||
HttpApiEndpoint.post("search.provider.select", "/api/search/provider", {
|
||||
HttpApiEndpoint.post("websearch.provider.select", "/api/websearch/provider", {
|
||||
query: LocationQuery,
|
||||
payload: Schema.Struct({ providerID: Integration.ID }),
|
||||
success: HttpApiSchema.NoContent,
|
||||
|
|
@ -31,23 +31,23 @@ export const SearchGroup = HttpApiGroup.make("server.search")
|
|||
.annotateMerge(locationQueryOpenApi)
|
||||
.annotateMerge(
|
||||
OpenApi.annotations({
|
||||
identifier: "v2.search.provider.select",
|
||||
summary: "Select default search provider",
|
||||
identifier: "v2.websearch.provider.select",
|
||||
summary: "Select default web search provider",
|
||||
description: "Persist the global web search provider in the user configuration.",
|
||||
}),
|
||||
),
|
||||
)
|
||||
.add(
|
||||
HttpApiEndpoint.post("search.query", "/api/search", {
|
||||
HttpApiEndpoint.post("websearch.query", "/api/websearch", {
|
||||
query: LocationQuery,
|
||||
payload: Schema.Struct(Search.Input.fields),
|
||||
success: Location.response(Search.Result),
|
||||
payload: Schema.Struct(WebSearch.Input.fields),
|
||||
success: Location.response(WebSearch.Result),
|
||||
error: [InvalidRequestError, ServiceUnavailableError],
|
||||
})
|
||||
.annotateMerge(locationQueryOpenApi)
|
||||
.annotateMerge(
|
||||
OpenApi.annotations({
|
||||
identifier: "v2.search.query",
|
||||
identifier: "v2.websearch.query",
|
||||
summary: "Search the web",
|
||||
description:
|
||||
"Run one web search through the selected integration. Specify a provider to override the configured default.",
|
||||
|
|
@ -56,7 +56,7 @@ export const SearchGroup = HttpApiGroup.make("server.search")
|
|||
)
|
||||
.annotateMerge(
|
||||
OpenApi.annotations({
|
||||
title: "search",
|
||||
title: "websearch",
|
||||
description: "Location-scoped web search routes.",
|
||||
}),
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue