@opencode/protocol 2.1.2 → 2.1.3
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/groups/permission.d.ts +28 -28
- package/dist/groups/pty.d.ts +41 -41
- package/dist/groups/session.d.ts +1 -1
- package/dist/groups/voice.d.ts +35 -2
- package/dist/groups/voice.js +40 -2
- package/package.json +3 -3
|
@@ -1,33 +1,7 @@
|
|
|
1
1
|
import { Context, Schema } from "effect";
|
|
2
2
|
import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema } from "effect/http-api";
|
|
3
3
|
import { ConflictError, LocationNotFoundError, PermissionNotFoundError, PermissionSavedNotFoundError, SessionNotFoundError } from "../errors.js";
|
|
4
|
-
export declare const makePermissionGroup: <LocationId extends HttpApiMiddleware.AnyId, LocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService>(locationMiddleware: Context.Key<LocationId, LocationService>, sessionLocationMiddleware: Context.Key<SessionLocationId, SessionLocationService>) => HttpApiGroup.HttpApiGroup<"server.permission", HttpApiEndpoint.HttpApiEndpoint<"permission.
|
|
5
|
-
id: Schema.brand<Schema.String, "PermissionSaved.ID"> & {
|
|
6
|
-
create: () => string & import("effect/Brand").Brand<"PermissionSaved.ID">;
|
|
7
|
-
};
|
|
8
|
-
}>>, never, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"permission.saved.update", "PATCH", "/api/permission/saved/:id", Schema.toCodecStringTree<Schema.Struct<{
|
|
9
|
-
id: Schema.brand<Schema.String, "PermissionSaved.ID"> & {
|
|
10
|
-
create: () => string & import("effect/Brand").Brand<"PermissionSaved.ID">;
|
|
11
|
-
};
|
|
12
|
-
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
13
|
-
readonly action: Schema.optional<Schema.String>;
|
|
14
|
-
readonly resource: Schema.optional<Schema.String>;
|
|
15
|
-
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
16
|
-
readonly data: Schema.Struct<{
|
|
17
|
-
readonly id: Schema.brand<Schema.String, "PermissionSaved.ID"> & {
|
|
18
|
-
create: () => string & import("effect/Brand").Brand<"PermissionSaved.ID">;
|
|
19
|
-
};
|
|
20
|
-
readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
|
|
21
|
-
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
22
|
-
};
|
|
23
|
-
readonly action: Schema.String;
|
|
24
|
-
readonly resource: Schema.String;
|
|
25
|
-
readonly time: Schema.Struct<{
|
|
26
|
-
readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
27
|
-
readonly updated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
28
|
-
}>;
|
|
29
|
-
}>;
|
|
30
|
-
}>>, Schema.toCodecJson<typeof ConflictError | typeof PermissionSavedNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"permission.request.list", "GET", "/api/permission/request", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
4
|
+
export declare const makePermissionGroup: <LocationId extends HttpApiMiddleware.AnyId, LocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService>(locationMiddleware: Context.Key<LocationId, LocationService>, sessionLocationMiddleware: Context.Key<SessionLocationId, SessionLocationService>) => HttpApiGroup.HttpApiGroup<"server.permission", HttpApiEndpoint.HttpApiEndpoint<"permission.request.list", "GET", "/api/permission/request", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
31
5
|
readonly location: Schema.optional<Schema.Struct<{
|
|
32
6
|
readonly directory: Schema.optional<Schema.String>;
|
|
33
7
|
}>>;
|
|
@@ -77,7 +51,33 @@ export declare const makePermissionGroup: <LocationId extends HttpApiMiddleware.
|
|
|
77
51
|
readonly updated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
78
52
|
}>;
|
|
79
53
|
}>>;
|
|
80
|
-
}>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"
|
|
54
|
+
}>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"permission.saved.update", "PATCH", "/api/permission/saved/:id", Schema.toCodecStringTree<Schema.Struct<{
|
|
55
|
+
id: Schema.brand<Schema.String, "PermissionSaved.ID"> & {
|
|
56
|
+
create: () => string & import("effect/Brand").Brand<"PermissionSaved.ID">;
|
|
57
|
+
};
|
|
58
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
59
|
+
readonly action: Schema.optional<Schema.String>;
|
|
60
|
+
readonly resource: Schema.optional<Schema.String>;
|
|
61
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
62
|
+
readonly data: Schema.Struct<{
|
|
63
|
+
readonly id: Schema.brand<Schema.String, "PermissionSaved.ID"> & {
|
|
64
|
+
create: () => string & import("effect/Brand").Brand<"PermissionSaved.ID">;
|
|
65
|
+
};
|
|
66
|
+
readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
|
|
67
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
68
|
+
};
|
|
69
|
+
readonly action: Schema.String;
|
|
70
|
+
readonly resource: Schema.String;
|
|
71
|
+
readonly time: Schema.Struct<{
|
|
72
|
+
readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
73
|
+
readonly updated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
74
|
+
}>;
|
|
75
|
+
}>;
|
|
76
|
+
}>>, Schema.toCodecJson<typeof ConflictError | typeof PermissionSavedNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"permission.saved.remove", "DELETE", "/api/permission/saved/:id", Schema.toCodecStringTree<Schema.Struct<{
|
|
77
|
+
id: Schema.brand<Schema.String, "PermissionSaved.ID"> & {
|
|
78
|
+
create: () => string & import("effect/Brand").Brand<"PermissionSaved.ID">;
|
|
79
|
+
};
|
|
80
|
+
}>>, never, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"session.permission.create", "POST", "/api/session/:sessionID/permission", Schema.toCodecStringTree<Schema.Struct<{
|
|
81
81
|
sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
82
82
|
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
83
83
|
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
package/dist/groups/pty.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare const PTY_CONNECT_TOKEN_HEADER = "x-opencode-ticket";
|
|
|
6
6
|
export declare const PTY_CONNECT_TOKEN_HEADER_VALUE = "1";
|
|
7
7
|
export declare const PTY_CONNECT_PATH = "/api/pty/:ptyID/connect";
|
|
8
8
|
export declare function hasPtyConnectTicketURL(url: URL): boolean;
|
|
9
|
-
export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId, LocationService>(locationMiddleware: Context.Key<LocationId, LocationService>) => HttpApiGroup.HttpApiGroup<"server.pty", HttpApiEndpoint.HttpApiEndpoint<"pty.
|
|
9
|
+
export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId, LocationService>(locationMiddleware: Context.Key<LocationId, LocationService>) => HttpApiGroup.HttpApiGroup<"server.pty", HttpApiEndpoint.HttpApiEndpoint<"pty.connectToken", "POST", "/api/pty/:ptyID/connect-token", Schema.toCodecStringTree<Schema.Struct<{
|
|
10
10
|
ptyID: Schema.brand<Schema.String, "PtyID"> & {
|
|
11
11
|
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
12
12
|
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
@@ -15,28 +15,17 @@ export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId,
|
|
|
15
15
|
readonly location: Schema.optional<Schema.Struct<{
|
|
16
16
|
readonly directory: Schema.optional<Schema.String>;
|
|
17
17
|
}>>;
|
|
18
|
-
}>>, never,
|
|
19
|
-
readonly
|
|
20
|
-
|
|
21
|
-
}>>;
|
|
22
|
-
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
18
|
+
}>>, never, Schema.toCodecStringTree<Schema.Struct<{
|
|
19
|
+
readonly "x-opencode-ticket": Schema.optional<Schema.String>;
|
|
20
|
+
}>>, Schema.toCodecJson<Schema.Struct<{
|
|
23
21
|
readonly location: Schema.Struct<{
|
|
24
22
|
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
25
23
|
}>;
|
|
26
|
-
readonly data: Schema
|
|
27
|
-
readonly
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
readonly title: Schema.String;
|
|
32
|
-
readonly command: Schema.String;
|
|
33
|
-
readonly args: Schema.$Array<Schema.String>;
|
|
34
|
-
readonly cwd: Schema.String;
|
|
35
|
-
readonly status: Schema.Literals<readonly ["running", "exited"]>;
|
|
36
|
-
readonly pid: Schema.Int;
|
|
37
|
-
readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
38
|
-
}>>;
|
|
39
|
-
}>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.create", "POST", "/api/pty", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
24
|
+
readonly data: Schema.Struct<{
|
|
25
|
+
readonly ticket: Schema.String;
|
|
26
|
+
readonly expires_in: Schema.Int;
|
|
27
|
+
}>;
|
|
28
|
+
}>>, Schema.toCodecJson<typeof ForbiddenError | typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.create", "POST", "/api/pty", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
40
29
|
readonly location: Schema.optional<Schema.Struct<{
|
|
41
30
|
readonly directory: Schema.optional<Schema.String>;
|
|
42
31
|
}>>;
|
|
@@ -89,7 +78,37 @@ export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId,
|
|
|
89
78
|
readonly pid: Schema.Int;
|
|
90
79
|
readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
91
80
|
}>;
|
|
92
|
-
}>>, Schema.toCodecJson<typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.
|
|
81
|
+
}>>, Schema.toCodecJson<typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.list", "GET", "/api/pty", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
82
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
83
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
84
|
+
}>>;
|
|
85
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
86
|
+
readonly location: Schema.Struct<{
|
|
87
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
88
|
+
}>;
|
|
89
|
+
readonly data: Schema.$Array<Schema.Struct<{
|
|
90
|
+
readonly id: Schema.brand<Schema.String, "PtyID"> & {
|
|
91
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
92
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
93
|
+
};
|
|
94
|
+
readonly title: Schema.String;
|
|
95
|
+
readonly command: Schema.String;
|
|
96
|
+
readonly args: Schema.$Array<Schema.String>;
|
|
97
|
+
readonly cwd: Schema.String;
|
|
98
|
+
readonly status: Schema.Literals<readonly ["running", "exited"]>;
|
|
99
|
+
readonly pid: Schema.Int;
|
|
100
|
+
readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
101
|
+
}>>;
|
|
102
|
+
}>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.remove", "DELETE", "/api/pty/:ptyID", Schema.toCodecStringTree<Schema.Struct<{
|
|
103
|
+
ptyID: Schema.brand<Schema.String, "PtyID"> & {
|
|
104
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
105
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
106
|
+
};
|
|
107
|
+
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
108
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
109
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
110
|
+
}>>;
|
|
111
|
+
}>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.update", "PUT", "/api/pty/:ptyID", Schema.toCodecStringTree<Schema.Struct<{
|
|
93
112
|
ptyID: Schema.brand<Schema.String, "PtyID"> & {
|
|
94
113
|
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
95
114
|
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
@@ -124,26 +143,7 @@ export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId,
|
|
|
124
143
|
readonly pid: Schema.Int;
|
|
125
144
|
readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
126
145
|
}>;
|
|
127
|
-
}>>, Schema.toCodecJson<typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.
|
|
128
|
-
ptyID: Schema.brand<Schema.String, "PtyID"> & {
|
|
129
|
-
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
130
|
-
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
131
|
-
};
|
|
132
|
-
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
133
|
-
readonly location: Schema.optional<Schema.Struct<{
|
|
134
|
-
readonly directory: Schema.optional<Schema.String>;
|
|
135
|
-
}>>;
|
|
136
|
-
}>>, never, Schema.toCodecStringTree<Schema.Struct<{
|
|
137
|
-
readonly "x-opencode-ticket": Schema.optional<Schema.String>;
|
|
138
|
-
}>>, Schema.toCodecJson<Schema.Struct<{
|
|
139
|
-
readonly location: Schema.Struct<{
|
|
140
|
-
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
141
|
-
}>;
|
|
142
|
-
readonly data: Schema.Struct<{
|
|
143
|
-
readonly ticket: Schema.String;
|
|
144
|
-
readonly expires_in: Schema.Int;
|
|
145
|
-
}>;
|
|
146
|
-
}>>, Schema.toCodecJson<typeof ForbiddenError | typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.connect", "GET", "/api/pty/:ptyID/connect", Schema.toCodecStringTree<Schema.Struct<{
|
|
146
|
+
}>>, Schema.toCodecJson<typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.connect", "GET", "/api/pty/:ptyID/connect", Schema.toCodecStringTree<Schema.Struct<{
|
|
147
147
|
ptyID: Schema.brand<Schema.String, "PtyID"> & {
|
|
148
148
|
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
149
149
|
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
package/dist/groups/session.d.ts
CHANGED
|
@@ -4779,7 +4779,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
|
|
|
4779
4779
|
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
4780
4780
|
after: Schema.optional<Schema.compose<Schema.brand<Schema.Int, "Event.Seq">, Schema.NumberFromString>>;
|
|
4781
4781
|
follow: Schema.optional<Schema.decodeTo<Schema.Boolean, Schema.Literals<readonly ["true", "false"]>, never, never>>;
|
|
4782
|
-
}>>, never, never, HttpApiSchema.StreamSse<HttpApiSchema.SseEventFromData<Schema.Union<readonly [Schema.
|
|
4782
|
+
}>>, never, never, HttpApiSchema.StreamSse<HttpApiSchema.SseEventFromData<Schema.Union<readonly [Schema.toTaggedUnion<"type", readonly [...((Schema.Struct<{
|
|
4783
4783
|
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
4784
4784
|
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
4785
4785
|
};
|
package/dist/groups/voice.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import { HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api";
|
|
3
3
|
import { InvalidRequestError, LocationNotFoundError, ServiceUnavailableError } from "../errors.js";
|
|
4
|
+
export declare const VoiceTransportType: Schema.Literals<readonly ["webrtc", "websocket"]>;
|
|
5
|
+
export declare const VoiceModel: Schema.Struct<{
|
|
6
|
+
readonly model: Schema.String;
|
|
7
|
+
readonly provider: Schema.String;
|
|
8
|
+
readonly transports: Schema.$Array<Schema.Literals<readonly ["webrtc", "websocket"]>>;
|
|
9
|
+
readonly available: Schema.Boolean;
|
|
10
|
+
/** The integration whose connection starts its sessions: the provider's stored key, or `opencode` when the connected OpenCode Console hosts it. */
|
|
11
|
+
readonly integration: Schema.optional<Schema.String>;
|
|
12
|
+
/** The OpenCode Console workspace a hosted model's sessions bill to. */
|
|
13
|
+
readonly workspace: Schema.optional<Schema.String>;
|
|
14
|
+
}>;
|
|
4
15
|
export declare const VoiceWebRTCTransportInput: Schema.Struct<{
|
|
5
16
|
readonly type: Schema.Literal<"webrtc">;
|
|
6
17
|
readonly sdp: Schema.String;
|
|
@@ -35,7 +46,25 @@ export declare const VoiceTransport: Schema.Union<readonly [Schema.Struct<{
|
|
|
35
46
|
readonly token: Schema.String;
|
|
36
47
|
readonly expiresAt: Schema.Number;
|
|
37
48
|
}>]>;
|
|
38
|
-
export declare const VoiceGroup: HttpApiGroup.HttpApiGroup<"server.voice", HttpApiEndpoint.HttpApiEndpoint<"voice.
|
|
49
|
+
export declare const VoiceGroup: HttpApiGroup.HttpApiGroup<"server.voice", HttpApiEndpoint.HttpApiEndpoint<"voice.instructions", "POST", "/api/experimental/voice/session/:sessionID/instructions", Schema.toCodecStringTree<Schema.Struct<{
|
|
50
|
+
sessionID: Schema.String;
|
|
51
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
52
|
+
readonly instructions: Schema.String;
|
|
53
|
+
}>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"voice.models", "GET", "/api/experimental/voice/models", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
54
|
+
readonly data: Schema.Struct<{
|
|
55
|
+
readonly models: Schema.$Array<Schema.Struct<{
|
|
56
|
+
readonly model: Schema.String;
|
|
57
|
+
readonly provider: Schema.String;
|
|
58
|
+
readonly transports: Schema.$Array<Schema.Literals<readonly ["webrtc", "websocket"]>>;
|
|
59
|
+
readonly available: Schema.Boolean;
|
|
60
|
+
/** The integration whose connection starts its sessions: the provider's stored key, or `opencode` when the connected OpenCode Console hosts it. */
|
|
61
|
+
readonly integration: Schema.optional<Schema.String>;
|
|
62
|
+
/** The OpenCode Console workspace a hosted model's sessions bill to. */
|
|
63
|
+
readonly workspace: Schema.optional<Schema.String>;
|
|
64
|
+
}>>;
|
|
65
|
+
readonly default: Schema.optional<Schema.String>;
|
|
66
|
+
}>;
|
|
67
|
+
}>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"voice.session", "POST", "/api/experimental/voice/session", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
39
68
|
readonly model: Schema.String;
|
|
40
69
|
readonly session: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
41
70
|
readonly transport: Schema.Union<readonly [Schema.Struct<{
|
|
@@ -56,5 +85,9 @@ export declare const VoiceGroup: HttpApiGroup.HttpApiGroup<"server.voice", HttpA
|
|
|
56
85
|
readonly token: Schema.String;
|
|
57
86
|
readonly expiresAt: Schema.Number;
|
|
58
87
|
}>]>;
|
|
88
|
+
/** A hosted session's ID, for `voice.instructions`. */
|
|
89
|
+
readonly session: Schema.optional<Schema.Struct<{
|
|
90
|
+
readonly id: Schema.String;
|
|
91
|
+
}>>;
|
|
59
92
|
}>;
|
|
60
93
|
}>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof ServiceUnavailableError>, never, never>, false>;
|
package/dist/groups/voice.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
|
|
3
3
|
import { InvalidRequestError, LocationNotFoundError, ServiceUnavailableError } from "../errors.js";
|
|
4
|
+
export const VoiceTransportType = Schema.Literals(["webrtc", "websocket"]).annotate({
|
|
5
|
+
identifier: "VoiceTransportType",
|
|
6
|
+
});
|
|
7
|
+
export const VoiceModel = Schema.Struct({
|
|
8
|
+
model: Schema.String,
|
|
9
|
+
provider: Schema.String,
|
|
10
|
+
transports: Schema.Array(VoiceTransportType),
|
|
11
|
+
available: Schema.Boolean,
|
|
12
|
+
/** The integration whose connection starts its sessions: the provider's stored key, or `opencode` when the connected OpenCode Console hosts it. */
|
|
13
|
+
integration: Schema.optional(Schema.String),
|
|
14
|
+
/** The OpenCode Console workspace a hosted model's sessions bill to. */
|
|
15
|
+
workspace: Schema.optional(Schema.String),
|
|
16
|
+
}).annotate({ identifier: "VoiceModel" });
|
|
4
17
|
export const VoiceWebRTCTransportInput = Schema.Struct({
|
|
5
18
|
type: Schema.Literal("webrtc"),
|
|
6
19
|
sdp: Schema.String,
|
|
@@ -28,6 +41,19 @@ export const VoiceTransport = Schema.Union([
|
|
|
28
41
|
VoiceWebSocketTransport,
|
|
29
42
|
]).annotate({ identifier: "VoiceTransport" });
|
|
30
43
|
export const VoiceGroup = HttpApiGroup.make("server.voice")
|
|
44
|
+
.add(HttpApiEndpoint.get("voice.models", "/api/experimental/voice/models", {
|
|
45
|
+
success: Schema.Struct({
|
|
46
|
+
data: Schema.Struct({
|
|
47
|
+
models: Schema.Array(VoiceModel),
|
|
48
|
+
default: Schema.optional(Schema.String),
|
|
49
|
+
}),
|
|
50
|
+
}).annotate({ identifier: "VoiceModelsResponse" }),
|
|
51
|
+
error: [ServiceUnavailableError, LocationNotFoundError],
|
|
52
|
+
}).annotateMerge(OpenApi.annotations({
|
|
53
|
+
identifier: "experimental.voice.models",
|
|
54
|
+
summary: "List voice models",
|
|
55
|
+
description: "List supported voice models, their transports, whether the server has a usable API key for each provider or the connected OpenCode Console hosts the model, and the Console workspace a hosted model bills to.",
|
|
56
|
+
})))
|
|
31
57
|
.add(HttpApiEndpoint.post("voice.session", "/api/experimental/voice/session", {
|
|
32
58
|
payload: Schema.Struct({
|
|
33
59
|
model: Schema.String,
|
|
@@ -37,13 +63,25 @@ export const VoiceGroup = HttpApiGroup.make("server.voice")
|
|
|
37
63
|
success: Schema.Struct({
|
|
38
64
|
data: Schema.Struct({
|
|
39
65
|
transport: VoiceTransport,
|
|
66
|
+
/** A hosted session's ID, for `voice.instructions`. */
|
|
67
|
+
session: Schema.optional(Schema.Struct({ id: Schema.String })),
|
|
40
68
|
}),
|
|
41
69
|
}).annotate({ identifier: "VoiceSessionResponse" }),
|
|
42
70
|
error: [InvalidRequestError, ServiceUnavailableError, LocationNotFoundError],
|
|
43
71
|
}).annotateMerge(OpenApi.annotations({
|
|
44
72
|
identifier: "experimental.voice.session",
|
|
45
73
|
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.",
|
|
74
|
+
description: "Create a server-brokered voice session using the server's configured provider credentials, or the connected OpenCode Console when it hosts the model, and return the WebRTC SDP answer or WebSocket ephemeral token.",
|
|
75
|
+
})))
|
|
76
|
+
.add(HttpApiEndpoint.post("voice.instructions", "/api/experimental/voice/session/:sessionID/instructions", {
|
|
77
|
+
params: { sessionID: Schema.String },
|
|
78
|
+
payload: Schema.Struct({ instructions: Schema.String }),
|
|
79
|
+
success: HttpApiSchema.NoContent,
|
|
80
|
+
error: [InvalidRequestError, ServiceUnavailableError, LocationNotFoundError],
|
|
81
|
+
}).annotateMerge(OpenApi.annotations({
|
|
82
|
+
identifier: "experimental.voice.instructions",
|
|
83
|
+
summary: "Replace voice session instructions",
|
|
84
|
+
description: "Replace the backend instructions of a running session the connected OpenCode Console hosts, whose data channel can't change them.",
|
|
47
85
|
})))
|
|
48
86
|
.annotateMerge(OpenApi.annotations({
|
|
49
87
|
title: "voice",
|
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.1.
|
|
4
|
+
"version": "2.1.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"typecheck": "tsc --noEmit"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@opencode/schema": "2.1.
|
|
36
|
+
"@opencode/schema": "2.1.3",
|
|
37
37
|
"effect": "4.0.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@tsconfig/bun": "1.0.9",
|
|
41
|
-
"@types/bun": "1.4.
|
|
41
|
+
"@types/bun": "1.4.3",
|
|
42
42
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
43
43
|
"prettier": "3.6.2",
|
|
44
44
|
"typescript": "npm:@typescript/typescript6@6.0.2"
|