@opencode/protocol 2.0.30 → 2.0.32

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
@@ -2,6 +2,7 @@ import { Context } from "effect";
2
2
  import { HttpApi, HttpApiGroup, HttpApiMiddleware } from "effect/http-api";
3
3
  import { SchemaErrorMiddleware } from "./middleware/schema-error.js";
4
4
  import { GenerateGroup } from "./groups/generate.js";
5
+ import { VoiceGroup } from "./groups/voice.js";
5
6
  import { MessageGroup } from "./groups/message.js";
6
7
  import { ModelGroup } from "./groups/model.js";
7
8
  import { ProviderGroup } from "./groups/provider.js";
@@ -39,7 +40,7 @@ type SessionGroups<SessionLocationId extends HttpApiMiddleware.AnyId, SessionLoc
39
40
  type FormGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService> = ReturnType<typeof makeFormGroup<LocationId, LocationService>>;
40
41
  type LocationGroup<LocationId extends HttpApiMiddleware.AnyId, LocationService> = ReturnType<typeof makeLocationGroup<LocationId, LocationService>>;
41
42
  type MixedMiddlewareGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService> = ReturnType<typeof makePermissionGroup<LocationId, LocationService, SessionLocationId, SessionLocationService>>;
42
- type ApiGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, Event extends HttpApiGroup.Constraint> = typeof ServerGroup | typeof DebugGroup | typeof MigrationGroup | typeof WorktreeGroup | typeof GenerateGroup | typeof PersistentPtyGroup | typeof CredentialGroup | LocationGroups<LocationId> | LocationGroup<LocationId, LocationService> | PtyGroups<LocationId, LocationService> | FormGroups<LocationId, LocationService> | SessionGroups<SessionLocationId, SessionLocationService, FormLocationId, FormLocationService> | MixedMiddlewareGroups<LocationId, LocationService, SessionLocationId, SessionLocationService> | Event;
43
+ type ApiGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, Event extends HttpApiGroup.Constraint> = typeof ServerGroup | typeof DebugGroup | typeof MigrationGroup | typeof WorktreeGroup | typeof GenerateGroup | typeof VoiceGroup | typeof PersistentPtyGroup | typeof CredentialGroup | LocationGroups<LocationId> | LocationGroup<LocationId, LocationService> | PtyGroups<LocationId, LocationService> | FormGroups<LocationId, LocationService> | SessionGroups<SessionLocationId, SessionLocationService, FormLocationId, FormLocationService> | MixedMiddlewareGroups<LocationId, LocationService, SessionLocationId, SessionLocationService> | Event;
43
44
  type EventGroupFor<Definitions extends ReadonlyArray<Definition>> = ReturnType<typeof makeEventGroup<Definitions>>;
44
45
  export type Api<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, Event extends HttpApiGroup.Constraint> = HttpApi.HttpApi<"server", HttpApiGroup.AddMiddleware<HttpApiGroup.AddMiddleware<ApiGroups<LocationId, LocationService, FormLocationId, FormLocationService, SessionLocationId, SessionLocationService, Event>, Authorization>, SchemaErrorMiddleware>>;
45
46
  export declare const makeApi: <const Definitions extends ReadonlyArray<Definition>, LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService>(options: {
package/dist/api.js CHANGED
@@ -2,6 +2,7 @@ import { Context } from "effect";
2
2
  import { HttpApi, HttpApiGroup, HttpApiMiddleware, OpenApi } from "effect/http-api";
3
3
  import { SchemaErrorMiddleware } from "./middleware/schema-error.js";
4
4
  import { GenerateGroup } from "./groups/generate.js";
5
+ import { VoiceGroup } from "./groups/voice.js";
5
6
  import { MessageGroup } from "./groups/message.js";
6
7
  import { ModelGroup } from "./groups/model.js";
7
8
  import { ProviderGroup } from "./groups/provider.js";
@@ -42,6 +43,7 @@ const makeApiFromGroup = (eventGroup, locationMiddleware, formLocationMiddleware
42
43
  .add(MessageGroup)
43
44
  .add(ModelGroup.middleware(locationMiddleware))
44
45
  .add(GenerateGroup)
46
+ .add(VoiceGroup)
45
47
  .add(ProviderGroup.middleware(locationMiddleware))
46
48
  .add(IntegrationGroup.middleware(locationMiddleware))
47
49
  .add(McpGroup.middleware(locationMiddleware))
package/dist/client.d.ts CHANGED
@@ -36,6 +36,7 @@ export declare const groupNames: {
36
36
  readonly "server.message": "message";
37
37
  readonly "server.model": "model";
38
38
  readonly "server.generate": "generate";
39
+ readonly "server.voice": "voice";
39
40
  readonly "server.provider": "provider";
40
41
  readonly "server.integration": "integration";
41
42
  readonly "server.websearch": "websearch";
package/dist/client.js CHANGED
@@ -23,6 +23,7 @@ export const groupNames = {
23
23
  "server.message": "message",
24
24
  "server.model": "model",
25
25
  "server.generate": "generate",
26
+ "server.voice": "voice",
26
27
  "server.provider": "provider",
27
28
  "server.integration": "integration",
28
29
  "server.websearch": "websearch",
@@ -15,6 +15,7 @@ export declare const ModelGroup: HttpApiGroup.HttpApiGroup<"server.model", HttpA
15
15
  readonly tools: Schema.Boolean;
16
16
  readonly input: Schema.$Array<Schema.String>;
17
17
  readonly output: Schema.$Array<Schema.String>;
18
+ readonly temperature: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
18
19
  }> & {
19
20
  default: () => {
20
21
  tools: true;
@@ -209,6 +210,7 @@ export declare const ModelGroup: HttpApiGroup.HttpApiGroup<"server.model", HttpA
209
210
  readonly tools: Schema.Boolean;
210
211
  readonly input: Schema.$Array<Schema.String>;
211
212
  readonly output: Schema.$Array<Schema.String>;
213
+ readonly temperature: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
212
214
  }> & {
213
215
  default: () => {
214
216
  tools: true;
@@ -0,0 +1,60 @@
1
+ import { Schema } from "effect";
2
+ import { HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
3
+ import { InvalidRequestError, LocationNotFoundError, ServiceUnavailableError } from "../errors.js";
4
+ export declare const VoiceWebRTCTransportInput: Schema.Struct<{
5
+ readonly type: Schema.Literal<"webrtc">;
6
+ readonly sdp: Schema.String;
7
+ readonly dcid: Schema.optional<Schema.Number>;
8
+ }>;
9
+ export declare const VoiceWebSocketTransportInput: Schema.Struct<{
10
+ readonly type: Schema.Literal<"websocket">;
11
+ }>;
12
+ export declare const VoiceTransportInput: Schema.Union<readonly [Schema.Struct<{
13
+ readonly type: Schema.Literal<"webrtc">;
14
+ readonly sdp: Schema.String;
15
+ readonly dcid: Schema.optional<Schema.Number>;
16
+ }>, Schema.Struct<{
17
+ readonly type: Schema.Literal<"websocket">;
18
+ }>]>;
19
+ export declare const VoiceWebRTCTransport: Schema.Struct<{
20
+ readonly type: Schema.Literal<"webrtc">;
21
+ readonly sdp: Schema.String;
22
+ }>;
23
+ export declare const VoiceWebSocketTransport: Schema.Struct<{
24
+ readonly type: Schema.Literal<"websocket">;
25
+ readonly url: Schema.String;
26
+ readonly token: Schema.String;
27
+ readonly expiresAt: Schema.Number;
28
+ }>;
29
+ export declare const VoiceTransport: Schema.Union<readonly [Schema.Struct<{
30
+ readonly type: Schema.Literal<"webrtc">;
31
+ readonly sdp: Schema.String;
32
+ }>, Schema.Struct<{
33
+ readonly type: Schema.Literal<"websocket">;
34
+ readonly url: Schema.String;
35
+ readonly token: Schema.String;
36
+ readonly expiresAt: Schema.Number;
37
+ }>]>;
38
+ export declare const VoiceGroup: HttpApiGroup.HttpApiGroup<"server.voice", HttpApiEndpoint.HttpApiEndpoint<"voice.session", "POST", "/api/experimental/voice/session", never, never, Schema.toCodecJson<Schema.Struct<{
39
+ readonly model: Schema.String;
40
+ readonly session: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
41
+ readonly transport: Schema.Union<readonly [Schema.Struct<{
42
+ readonly type: Schema.Literal<"webrtc">;
43
+ readonly sdp: Schema.String;
44
+ readonly dcid: Schema.optional<Schema.Number>;
45
+ }>, Schema.Struct<{
46
+ readonly type: Schema.Literal<"websocket">;
47
+ }>]>;
48
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
49
+ readonly data: Schema.Struct<{
50
+ readonly transport: Schema.Union<readonly [Schema.Struct<{
51
+ readonly type: Schema.Literal<"webrtc">;
52
+ readonly sdp: Schema.String;
53
+ }>, Schema.Struct<{
54
+ readonly type: Schema.Literal<"websocket">;
55
+ readonly url: Schema.String;
56
+ readonly token: Schema.String;
57
+ readonly expiresAt: Schema.Number;
58
+ }>]>;
59
+ }>;
60
+ }>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof ServiceUnavailableError>, never, never>, false>;
@@ -0,0 +1,51 @@
1
+ import { Schema } from "effect";
2
+ import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api";
3
+ import { InvalidRequestError, LocationNotFoundError, ServiceUnavailableError } from "../errors.js";
4
+ export const VoiceWebRTCTransportInput = Schema.Struct({
5
+ type: Schema.Literal("webrtc"),
6
+ sdp: Schema.String,
7
+ dcid: Schema.optional(Schema.Number),
8
+ }).annotate({ identifier: "VoiceWebRTCTransportInput" });
9
+ export const VoiceWebSocketTransportInput = Schema.Struct({
10
+ type: Schema.Literal("websocket"),
11
+ }).annotate({ identifier: "VoiceWebSocketTransportInput" });
12
+ export const VoiceTransportInput = Schema.Union([
13
+ VoiceWebRTCTransportInput,
14
+ VoiceWebSocketTransportInput,
15
+ ]).annotate({ identifier: "VoiceTransportInput" });
16
+ export const VoiceWebRTCTransport = Schema.Struct({
17
+ type: Schema.Literal("webrtc"),
18
+ sdp: Schema.String,
19
+ }).annotate({ identifier: "VoiceWebRTCTransport" });
20
+ export const VoiceWebSocketTransport = Schema.Struct({
21
+ type: Schema.Literal("websocket"),
22
+ url: Schema.String,
23
+ token: Schema.String,
24
+ expiresAt: Schema.Number,
25
+ }).annotate({ identifier: "VoiceWebSocketTransport" });
26
+ export const VoiceTransport = Schema.Union([
27
+ VoiceWebRTCTransport,
28
+ VoiceWebSocketTransport,
29
+ ]).annotate({ identifier: "VoiceTransport" });
30
+ export const VoiceGroup = HttpApiGroup.make("server.voice")
31
+ .add(HttpApiEndpoint.post("voice.session", "/api/experimental/voice/session", {
32
+ payload: Schema.Struct({
33
+ model: Schema.String,
34
+ session: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
35
+ transport: VoiceTransportInput,
36
+ }),
37
+ success: Schema.Struct({
38
+ data: Schema.Struct({
39
+ transport: VoiceTransport,
40
+ }),
41
+ }).annotate({ identifier: "VoiceSessionResponse" }),
42
+ error: [InvalidRequestError, ServiceUnavailableError, LocationNotFoundError],
43
+ }).annotateMerge(OpenApi.annotations({
44
+ identifier: "experimental.voice.session",
45
+ summary: "Create voice session",
46
+ description: "Create a server-brokered voice session using the server's configured provider credentials and return the WebRTC SDP answer or WebSocket ephemeral token.",
47
+ })))
48
+ .annotateMerge(OpenApi.annotations({
49
+ title: "voice",
50
+ description: "Experimental server-brokered voice session routes.",
51
+ }));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/protocol",
4
- "version": "2.0.30",
4
+ "version": "2.0.32",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -29,10 +29,11 @@
29
29
  "build": "bun run script/build.ts",
30
30
  "generate": "bun run script/generate-openapi.ts",
31
31
  "check:generated": "bun run script/generate-openapi.ts --check",
32
+ "test": "bun test --only-failures",
32
33
  "typecheck": "tsgo --noEmit"
33
34
  },
34
35
  "dependencies": {
35
- "@opencode/schema": "2.0.30",
36
+ "@opencode/schema": "2.0.32",
36
37
  "effect": "4.0.1"
37
38
  },
38
39
  "devDependencies": {