@opencode-ai/protocol
Advanced tools
| import { Location } from "@opencode-ai/schema/location"; | ||
| import { WebSearch } from "@opencode-ai/schema/websearch"; | ||
| import { Schema } from "effect"; | ||
| import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; | ||
| import { InvalidRequestError, ServiceUnavailableError } from "../errors.js"; | ||
| export declare const WebSearchGroup: HttpApiGroup.HttpApiGroup<"server.websearch", HttpApiEndpoint.HttpApiEndpoint<"websearch.providers", "GET", "/api/websearch/provider", never, Schema.toCodecStringTree<Schema.Struct<{ | ||
| readonly location: Schema.optional<Schema.Struct<{ | ||
| readonly directory: Schema.optional<Schema.String>; | ||
| readonly workspace: Schema.optional<Schema.String>; | ||
| }>>; | ||
| }>>, never, never, Schema.toCodecJson<Schema.Struct<{ | ||
| readonly location: typeof Location.Info; | ||
| readonly data: Schema.$Array<Schema.Struct<{ | ||
| readonly id: Schema.brand<Schema.String, "WebSearch.ID">; | ||
| readonly name: Schema.String; | ||
| }>>; | ||
| }>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"websearch.query", "POST", "/api/websearch", never, Schema.toCodecStringTree<Schema.Struct<{ | ||
| readonly location: Schema.optional<Schema.Struct<{ | ||
| readonly directory: Schema.optional<Schema.String>; | ||
| readonly workspace: Schema.optional<Schema.String>; | ||
| }>>; | ||
| }>>, Schema.toCodecJson<Schema.Struct<{ | ||
| readonly query: Schema.String; | ||
| readonly providerID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WebSearch.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "WebSearch.ID">>, never, never>; | ||
| }>>, never, Schema.toCodecJson<Schema.Struct<{ | ||
| readonly location: typeof Location.Info; | ||
| readonly data: typeof WebSearch.Response; | ||
| }>>, Schema.toCodecJson<typeof InvalidRequestError | typeof ServiceUnavailableError>, never, never>, false>; |
| import { Location } from "@opencode-ai/schema/location"; | ||
| import { WebSearch } from "@opencode-ai/schema/websearch"; | ||
| import { Schema } from "effect"; | ||
| import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"; | ||
| import { InvalidRequestError, ServiceUnavailableError } from "../errors.js"; | ||
| import { LocationQuery, locationQueryOpenApi } from "./location.js"; | ||
| export const WebSearchGroup = HttpApiGroup.make("server.websearch") | ||
| .add(HttpApiEndpoint.get("websearch.providers", "/api/websearch/provider", { | ||
| query: LocationQuery, | ||
| success: Location.response(Schema.Array(WebSearch.Provider)), | ||
| error: ServiceUnavailableError, | ||
| }) | ||
| .annotateMerge(locationQueryOpenApi) | ||
| .annotateMerge(OpenApi.annotations({ | ||
| identifier: "v2.websearch.providers", | ||
| summary: "List web search providers", | ||
| description: "Return the registered web search providers.", | ||
| }))) | ||
| .add(HttpApiEndpoint.post("websearch.query", "/api/websearch", { | ||
| query: LocationQuery, | ||
| payload: Schema.Struct(WebSearch.Input.fields), | ||
| success: Location.response(WebSearch.Response), | ||
| error: [InvalidRequestError, ServiceUnavailableError], | ||
| }) | ||
| .annotateMerge(locationQueryOpenApi) | ||
| .annotateMerge(OpenApi.annotations({ | ||
| identifier: "v2.websearch.query", | ||
| summary: "Search the web", | ||
| description: "Run one web search through the selected provider. Specify a provider to override the configured default.", | ||
| }))) | ||
| .annotateMerge(OpenApi.annotations({ | ||
| title: "websearch", | ||
| description: "Location-scoped web search routes.", | ||
| })); |
+2
-1
@@ -28,2 +28,3 @@ import { Context } from "effect"; | ||
| import { IntegrationGroup } from "./groups/integration.js"; | ||
| import { WebSearchGroup } from "./groups/websearch.js"; | ||
| import { McpGroup } from "./groups/mcp.js"; | ||
@@ -34,3 +35,3 @@ import { CredentialGroup } from "./groups/credential.js"; | ||
| import { VcsGroup } from "./groups/vcs.js"; | ||
| type LocationGroups<LocationId extends HttpApiMiddleware.AnyId> = HttpApiGroup.AddMiddleware<typeof LocationGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof AgentGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof PluginGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ModelGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof GenerateGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ProviderGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof IntegrationGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof McpGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof CredentialGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ProjectGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof FileSystemGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof CommandGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof SkillGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof PtyGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ShellGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ReferenceGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ProjectCopyGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof VcsGroup, LocationId>; | ||
| type LocationGroups<LocationId extends HttpApiMiddleware.AnyId> = HttpApiGroup.AddMiddleware<typeof LocationGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof AgentGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof PluginGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ModelGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof GenerateGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ProviderGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof IntegrationGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof WebSearchGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof McpGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof CredentialGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ProjectGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof FileSystemGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof CommandGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof SkillGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof PtyGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ShellGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ReferenceGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ProjectCopyGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof VcsGroup, LocationId>; | ||
| type SessionGroups<SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService> = ReturnType<typeof makeSessionGroup<SessionLocationId, SessionLocationService>> | HttpApiGroup.AddMiddleware<typeof MessageGroup, SessionLocationId>; | ||
@@ -37,0 +38,0 @@ type FormGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService> = ReturnType<typeof makeFormGroup<LocationId, LocationService, FormLocationId, FormLocationService>>; |
+2
-0
@@ -27,2 +27,3 @@ import { Context } from "effect"; | ||
| import { IntegrationGroup } from "./groups/integration.js"; | ||
| import { WebSearchGroup } from "./groups/websearch.js"; | ||
| import { McpGroup } from "./groups/mcp.js"; | ||
@@ -62,2 +63,3 @@ import { CredentialGroup } from "./groups/credential.js"; | ||
| .add(DebugGroup) | ||
| .add(WebSearchGroup.middleware(locationMiddleware)) | ||
| .annotateMerge(OpenApi.annotations({ | ||
@@ -64,0 +66,0 @@ title: "opencode HttpApi", |
+1
-0
@@ -41,2 +41,3 @@ import { InvalidRequestError, SessionNotFoundError } from "./errors.js"; | ||
| readonly "server.integration": "integration"; | ||
| readonly "server.websearch": "websearch"; | ||
| readonly "server.credential": "credential"; | ||
@@ -43,0 +44,0 @@ readonly "server.form": "form"; |
+1
-0
@@ -28,2 +28,3 @@ import { InvalidRequestError, SessionNotFoundError } from "./errors.js"; | ||
| "server.integration": "integration", | ||
| "server.websearch": "websearch", | ||
| "server.credential": "credential", | ||
@@ -30,0 +31,0 @@ "server.form": "form", |
+2
-2
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "name": "@opencode-ai/protocol", | ||
| "version": "0.0.0-next-16229", | ||
| "version": "0.0.0-next-16230", | ||
| "type": "module", | ||
@@ -29,3 +29,3 @@ "license": "MIT", | ||
| "dependencies": { | ||
| "@opencode-ai/schema": "0.0.0-next-16229", | ||
| "@opencode-ai/schema": "0.0.0-next-16230", | ||
| "effect": "4.0.0-beta.98" | ||
@@ -32,0 +32,0 @@ }, |
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
1989975
0.43%67
3.08%31431
0.46%+ Added
- Removed