@opencode-ai/protocol 0.0.0-next-16229 → 0.0.0-next-16231

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api.d.ts CHANGED
@@ -25,12 +25,13 @@ import { ReferenceGroup } from "./groups/reference.js";
25
25
  import { Authorization } from "./middleware/authorization.js";
26
26
  import { LocationGroup } from "./groups/location.js";
27
27
  import { IntegrationGroup } from "./groups/integration.js";
28
+ import { WebSearchGroup } from "./groups/websearch.js";
28
29
  import { McpGroup } from "./groups/mcp.js";
29
30
  import { CredentialGroup } from "./groups/credential.js";
30
31
  import { ProjectGroup } from "./groups/project.js";
31
32
  import { ProjectCopyGroup } from "./groups/project-copy.js";
32
33
  import { VcsGroup } from "./groups/vcs.js";
33
- 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>;
34
+ 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>;
34
35
  type SessionGroups<SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService> = ReturnType<typeof makeSessionGroup<SessionLocationId, SessionLocationService>> | HttpApiGroup.AddMiddleware<typeof MessageGroup, SessionLocationId>;
35
36
  type FormGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService> = ReturnType<typeof makeFormGroup<LocationId, LocationService, FormLocationId, FormLocationService>>;
36
37
  type MixedMiddlewareGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService> = ReturnType<typeof makePermissionGroup<LocationId, LocationService, SessionLocationId, SessionLocationService>> | ReturnType<typeof makeQuestionGroup<LocationId, LocationService, SessionLocationId, SessionLocationService>>;
package/dist/api.js CHANGED
@@ -24,6 +24,7 @@ import { ReferenceGroup } from "./groups/reference.js";
24
24
  import { Authorization } from "./middleware/authorization.js";
25
25
  import { LocationGroup } from "./groups/location.js";
26
26
  import { IntegrationGroup } from "./groups/integration.js";
27
+ import { WebSearchGroup } from "./groups/websearch.js";
27
28
  import { McpGroup } from "./groups/mcp.js";
28
29
  import { CredentialGroup } from "./groups/credential.js";
29
30
  import { ProjectGroup } from "./groups/project.js";
@@ -58,6 +59,7 @@ const makeApiFromGroup = (eventGroup, locationMiddleware, formLocationMiddleware
58
59
  .add(ProjectCopyGroup.middleware(locationMiddleware))
59
60
  .add(VcsGroup.middleware(locationMiddleware))
60
61
  .add(DebugGroup)
62
+ .add(WebSearchGroup.middleware(locationMiddleware))
61
63
  .annotateMerge(OpenApi.annotations({
62
64
  title: "opencode HttpApi",
63
65
  version: "0.0.1",
package/dist/client.d.ts CHANGED
@@ -38,6 +38,7 @@ export declare const groupNames: {
38
38
  readonly "server.generate": "generate";
39
39
  readonly "server.provider": "provider";
40
40
  readonly "server.integration": "integration";
41
+ readonly "server.websearch": "websearch";
41
42
  readonly "server.credential": "credential";
42
43
  readonly "server.form": "form";
43
44
  readonly "server.permission": "permission";
package/dist/client.js CHANGED
@@ -25,6 +25,7 @@ export const groupNames = {
25
25
  "server.generate": "generate",
26
26
  "server.provider": "provider",
27
27
  "server.integration": "integration",
28
+ "server.websearch": "websearch",
28
29
  "server.credential": "credential",
29
30
  "server.form": "form",
30
31
  "server.permission": "permission",
@@ -7825,6 +7825,38 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
7825
7825
  data: Schema.Struct<{
7826
7826
  readonly branch: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
7827
7827
  }>;
7828
+ }) | (Schema.Struct<{
7829
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
7830
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
7831
+ };
7832
+ readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
7833
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
7834
+ readonly type: Schema.Literal<"websearch.updated">;
7835
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
7836
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
7837
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
7838
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
7839
+ create: () => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
7840
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
7841
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
7842
+ create: () => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
7843
+ }>, never, never>;
7844
+ }>>>, Schema.optionalKey<Schema.Struct<{
7845
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
7846
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
7847
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
7848
+ create: () => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
7849
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
7850
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
7851
+ create: () => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
7852
+ }>, never, never>;
7853
+ }>>, never, never>;
7854
+ readonly data: Schema.Struct<{}>;
7855
+ }> & {
7856
+ type: "websearch.updated";
7857
+ durability: "ephemeral";
7858
+ durable: undefined;
7859
+ data: Schema.Struct<{}>;
7828
7860
  }) | Schema.Struct<{
7829
7861
  readonly type: Schema.Literal<"server.connected">;
7830
7862
  readonly data: Schema.Struct<{}>;
@@ -11269,6 +11301,18 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
11269
11301
  readonly metadata?: {
11270
11302
  readonly [x: string]: unknown;
11271
11303
  } | undefined;
11304
+ } | {
11305
+ readonly id: string & import("effect/Brand").Brand<"Event.ID">;
11306
+ readonly data: Schema.Struct.ReadonlySide<{}, "Type">;
11307
+ readonly type: "websearch.updated";
11308
+ readonly created: import("effect/DateTime").Utc;
11309
+ readonly location?: {
11310
+ readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
11311
+ readonly workspaceID?: (string & import("effect/Brand").Brand<"WorkspaceV2.ID">) | undefined;
11312
+ } | undefined;
11313
+ readonly metadata?: {
11314
+ readonly [x: string]: unknown;
11315
+ } | undefined;
11272
11316
  } | {
11273
11317
  readonly id: string & import("effect/Brand").Brand<"Event.ID">;
11274
11318
  readonly data: Schema.Struct.ReadonlySide<{}, "Type">;
@@ -19075,6 +19119,38 @@ export declare const OpenCodeEvent: Schema.Union<readonly [Schema.Struct<{
19075
19119
  data: Schema.Struct<{
19076
19120
  readonly branch: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
19077
19121
  }>;
19122
+ }) | (Schema.Struct<{
19123
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
19124
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
19125
+ };
19126
+ readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
19127
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
19128
+ readonly type: Schema.Literal<"websearch.updated">;
19129
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
19130
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
19131
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
19132
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
19133
+ create: () => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
19134
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
19135
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
19136
+ create: () => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
19137
+ }>, never, never>;
19138
+ }>>>, Schema.optionalKey<Schema.Struct<{
19139
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
19140
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
19141
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
19142
+ create: () => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
19143
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
19144
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
19145
+ create: () => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
19146
+ }>, never, never>;
19147
+ }>>, never, never>;
19148
+ readonly data: Schema.Struct<{}>;
19149
+ }> & {
19150
+ type: "websearch.updated";
19151
+ durability: "ephemeral";
19152
+ durable: undefined;
19153
+ data: Schema.Struct<{}>;
19078
19154
  }) | Schema.Struct<{
19079
19155
  readonly type: Schema.Literal<"server.connected">;
19080
19156
  readonly data: Schema.Struct<{}>;
@@ -0,0 +1,28 @@
1
+ import { Location } from "@opencode-ai/schema/location";
2
+ import { WebSearch } from "@opencode-ai/schema/websearch";
3
+ import { Schema } from "effect";
4
+ import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
5
+ import { InvalidRequestError, ServiceUnavailableError } from "../errors.js";
6
+ export declare const WebSearchGroup: HttpApiGroup.HttpApiGroup<"server.websearch", HttpApiEndpoint.HttpApiEndpoint<"websearch.providers", "GET", "/api/websearch/provider", never, Schema.toCodecStringTree<Schema.Struct<{
7
+ readonly location: Schema.optional<Schema.Struct<{
8
+ readonly directory: Schema.optional<Schema.String>;
9
+ readonly workspace: Schema.optional<Schema.String>;
10
+ }>>;
11
+ }>>, never, never, Schema.toCodecJson<Schema.Struct<{
12
+ readonly location: typeof Location.Info;
13
+ readonly data: Schema.$Array<Schema.Struct<{
14
+ readonly id: Schema.brand<Schema.String, "WebSearch.ID">;
15
+ readonly name: Schema.String;
16
+ }>>;
17
+ }>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"websearch.query", "POST", "/api/websearch", never, Schema.toCodecStringTree<Schema.Struct<{
18
+ readonly location: Schema.optional<Schema.Struct<{
19
+ readonly directory: Schema.optional<Schema.String>;
20
+ readonly workspace: Schema.optional<Schema.String>;
21
+ }>>;
22
+ }>>, Schema.toCodecJson<Schema.Struct<{
23
+ readonly query: Schema.String;
24
+ readonly providerID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WebSearch.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "WebSearch.ID">>, never, never>;
25
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
26
+ readonly location: typeof Location.Info;
27
+ readonly data: typeof WebSearch.Response;
28
+ }>>, Schema.toCodecJson<typeof InvalidRequestError | typeof ServiceUnavailableError>, never, never>, false>;
@@ -0,0 +1,34 @@
1
+ import { Location } from "@opencode-ai/schema/location";
2
+ import { WebSearch } from "@opencode-ai/schema/websearch";
3
+ import { Schema } from "effect";
4
+ import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
5
+ import { InvalidRequestError, ServiceUnavailableError } from "../errors.js";
6
+ import { LocationQuery, locationQueryOpenApi } from "./location.js";
7
+ export const WebSearchGroup = HttpApiGroup.make("server.websearch")
8
+ .add(HttpApiEndpoint.get("websearch.providers", "/api/websearch/provider", {
9
+ query: LocationQuery,
10
+ success: Location.response(Schema.Array(WebSearch.Provider)),
11
+ error: ServiceUnavailableError,
12
+ })
13
+ .annotateMerge(locationQueryOpenApi)
14
+ .annotateMerge(OpenApi.annotations({
15
+ identifier: "v2.websearch.providers",
16
+ summary: "List web search providers",
17
+ description: "Return the registered web search providers.",
18
+ })))
19
+ .add(HttpApiEndpoint.post("websearch.query", "/api/websearch", {
20
+ query: LocationQuery,
21
+ payload: Schema.Struct(WebSearch.Input.fields),
22
+ success: Location.response(WebSearch.Response),
23
+ error: [InvalidRequestError, ServiceUnavailableError],
24
+ })
25
+ .annotateMerge(locationQueryOpenApi)
26
+ .annotateMerge(OpenApi.annotations({
27
+ identifier: "v2.websearch.query",
28
+ summary: "Search the web",
29
+ description: "Run one web search through the selected provider. Specify a provider to override the configured default.",
30
+ })))
31
+ .annotateMerge(OpenApi.annotations({
32
+ title: "websearch",
33
+ description: "Location-scoped web search routes.",
34
+ }));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode-ai/protocol",
4
- "version": "0.0.0-next-16229",
4
+ "version": "0.0.0-next-16231",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -26,7 +26,7 @@
26
26
  "typecheck": "tsgo --noEmit"
27
27
  },
28
28
  "dependencies": {
29
- "@opencode-ai/schema": "0.0.0-next-16229",
29
+ "@opencode-ai/schema": "0.0.0-next-16231",
30
30
  "effect": "4.0.0-beta.98"
31
31
  },
32
32
  "devDependencies": {