@opencode/protocol 2.1.4 → 2.2.0
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 +4 -3
- package/dist/api.js +5 -3
- package/dist/client.d.ts +1 -0
- package/dist/client.js +9 -1
- package/dist/errors.d.ts +32 -0
- package/dist/errors.js +35 -0
- package/dist/groups/agent.d.ts +12 -2
- package/dist/groups/agent.js +2 -1
- package/dist/groups/event.d.ts +15 -2
- package/dist/groups/event.js +9 -0
- package/dist/groups/experimental.d.ts +238 -0
- package/dist/groups/experimental.js +4 -0
- package/dist/groups/fs.d.ts +15 -3
- package/dist/groups/fs.js +27 -1
- package/dist/groups/generate.d.ts +194 -3
- package/dist/groups/generate.js +41 -5
- package/dist/groups/mcp.d.ts +1 -0
- package/dist/groups/media.d.ts +8 -0
- package/dist/groups/media.js +18 -0
- package/dist/groups/message.d.ts +2240 -0
- package/dist/groups/message.js +29 -4
- package/dist/groups/model.d.ts +47 -0
- package/dist/groups/model.js +8 -2
- package/dist/groups/permission.d.ts +2 -2
- package/dist/groups/permission.js +4 -3
- package/dist/groups/plugin.d.ts +18 -2
- package/dist/groups/plugin.js +15 -1
- package/dist/groups/provider.d.ts +24 -0
- package/dist/groups/server.d.ts +2 -0
- package/dist/groups/server.js +2 -0
- package/dist/groups/session.d.ts +295 -11
- package/dist/groups/session.js +18 -34
- package/dist/groups/usage.d.ts +95 -0
- package/dist/groups/usage.js +22 -0
- package/dist/groups/vcs.d.ts +2 -0
- package/dist/groups/vcs.js +1 -0
- package/dist/groups/voice.d.ts +2 -18
- package/dist/groups/voice.js +3 -19
- package/package.json +3 -2
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 { ExperimentalGroup } from "./groups/experimental.js";
|
|
5
6
|
import { VoiceGroup } from "./groups/voice.js";
|
|
6
7
|
import { MessageGroup } from "./groups/message.js";
|
|
7
8
|
import { ModelGroup } from "./groups/model.js";
|
|
@@ -20,13 +21,13 @@ import { PluginGroup } from "./groups/plugin.js";
|
|
|
20
21
|
import { ServerGroup } from "./groups/server.js";
|
|
21
22
|
import { DebugGroup } from "./groups/debug.js";
|
|
22
23
|
import { makePtyGroup } from "./groups/pty.js";
|
|
23
|
-
import { PersistentPtyGroup } from "./groups/persistent-pty.js";
|
|
24
24
|
import { ShellGroup } from "./groups/shell.js";
|
|
25
25
|
import { ReferenceGroup } from "./groups/reference.js";
|
|
26
26
|
import { Authorization } from "./middleware/authorization.js";
|
|
27
27
|
import { makeLocationGroup } from "./groups/location.js";
|
|
28
28
|
import { IntegrationGroup } from "./groups/integration.js";
|
|
29
29
|
import { WebSearchGroup } from "./groups/websearch.js";
|
|
30
|
+
import { UsageGroup } from "./groups/usage.js";
|
|
30
31
|
import { makeMcpGroup } from "./groups/mcp.js";
|
|
31
32
|
import { CredentialGroup } from "./groups/credential.js";
|
|
32
33
|
import { ProjectGroup } from "./groups/project.js";
|
|
@@ -34,14 +35,14 @@ import { WorktreeGroup } from "./groups/worktree.js";
|
|
|
34
35
|
import { VcsGroup } from "./groups/vcs.js";
|
|
35
36
|
import { MigrationGroup } from "./groups/migration.js";
|
|
36
37
|
import { ConfigGroup } from "./groups/config.js";
|
|
37
|
-
type LocationGroups<LocationId extends HttpApiMiddleware.AnyId> = HttpApiGroup.AddMiddleware<typeof AgentGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof PluginGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ModelGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ProviderGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof IntegrationGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof WebSearchGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof
|
|
38
|
+
type LocationGroups<LocationId extends HttpApiMiddleware.AnyId> = HttpApiGroup.AddMiddleware<typeof AgentGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof PluginGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ModelGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ProviderGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof IntegrationGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof WebSearchGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof UsageGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof FileSystemGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof CommandGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof SkillGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof RpcGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ShellGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ReferenceGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof VcsGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ConfigGroup, LocationId>;
|
|
38
39
|
type PtyGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService> = ReturnType<typeof makePtyGroup<LocationId, LocationService>>;
|
|
39
40
|
type McpGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService> = ReturnType<typeof makeMcpGroup<LocationId, LocationService>>;
|
|
40
41
|
type SessionGroups<SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService> = ReturnType<typeof makeSessionGroup<SessionLocationId, SessionLocationService, FormLocationId, FormLocationService>> | typeof MessageGroup;
|
|
41
42
|
type FormGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService> = ReturnType<typeof makeFormGroup<LocationId, LocationService>>;
|
|
42
43
|
type LocationGroup<LocationId extends HttpApiMiddleware.AnyId, LocationService> = ReturnType<typeof makeLocationGroup<LocationId, LocationService>>;
|
|
43
44
|
type MixedMiddlewareGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService> = ReturnType<typeof makePermissionGroup<LocationId, LocationService, SessionLocationId, SessionLocationService>>;
|
|
44
|
-
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
|
|
45
|
+
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 ExperimentalGroup | typeof CredentialGroup | typeof ProjectGroup | LocationGroups<LocationId> | LocationGroup<LocationId, LocationService> | PtyGroups<LocationId, LocationService> | McpGroups<LocationId, LocationService> | FormGroups<LocationId, LocationService> | SessionGroups<SessionLocationId, SessionLocationService, FormLocationId, FormLocationService> | MixedMiddlewareGroups<LocationId, LocationService, SessionLocationId, SessionLocationService> | Event;
|
|
45
46
|
type EventGroupFor<Definitions extends ReadonlyArray<Definition>> = ReturnType<typeof makeEventGroup<Definitions>>;
|
|
46
47
|
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>>;
|
|
47
48
|
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 { ExperimentalGroup } from "./groups/experimental.js";
|
|
5
6
|
import { VoiceGroup } from "./groups/voice.js";
|
|
6
7
|
import { MessageGroup } from "./groups/message.js";
|
|
7
8
|
import { ModelGroup } from "./groups/model.js";
|
|
@@ -19,13 +20,13 @@ import { PluginGroup } from "./groups/plugin.js";
|
|
|
19
20
|
import { ServerGroup } from "./groups/server.js";
|
|
20
21
|
import { DebugGroup } from "./groups/debug.js";
|
|
21
22
|
import { makePtyGroup } from "./groups/pty.js";
|
|
22
|
-
import { PersistentPtyGroup } from "./groups/persistent-pty.js";
|
|
23
23
|
import { ShellGroup } from "./groups/shell.js";
|
|
24
24
|
import { ReferenceGroup } from "./groups/reference.js";
|
|
25
25
|
import { Authorization } from "./middleware/authorization.js";
|
|
26
26
|
import { makeLocationGroup } from "./groups/location.js";
|
|
27
27
|
import { IntegrationGroup } from "./groups/integration.js";
|
|
28
28
|
import { WebSearchGroup } from "./groups/websearch.js";
|
|
29
|
+
import { UsageGroup } from "./groups/usage.js";
|
|
29
30
|
import { makeMcpGroup } from "./groups/mcp.js";
|
|
30
31
|
import { CredentialGroup } from "./groups/credential.js";
|
|
31
32
|
import { ProjectGroup } from "./groups/project.js";
|
|
@@ -48,7 +49,7 @@ const makeApiFromGroup = (eventGroup, locationMiddleware, formLocationMiddleware
|
|
|
48
49
|
.add(IntegrationGroup.middleware(locationMiddleware))
|
|
49
50
|
.add(makeMcpGroup(locationMiddleware))
|
|
50
51
|
.add(CredentialGroup)
|
|
51
|
-
.add(ProjectGroup
|
|
52
|
+
.add(ProjectGroup)
|
|
52
53
|
.add(makeFormGroup(locationMiddleware))
|
|
53
54
|
.add(makePermissionGroup(locationMiddleware, sessionLocationMiddleware))
|
|
54
55
|
.add(FileSystemGroup.middleware(locationMiddleware))
|
|
@@ -57,7 +58,7 @@ const makeApiFromGroup = (eventGroup, locationMiddleware, formLocationMiddleware
|
|
|
57
58
|
.add(RpcGroup.middleware(locationMiddleware))
|
|
58
59
|
.add(eventGroup)
|
|
59
60
|
.add(makePtyGroup(locationMiddleware))
|
|
60
|
-
.add(
|
|
61
|
+
.add(ExperimentalGroup)
|
|
61
62
|
.add(ShellGroup.middleware(locationMiddleware))
|
|
62
63
|
.add(ReferenceGroup.middleware(locationMiddleware))
|
|
63
64
|
.add(WorktreeGroup)
|
|
@@ -65,6 +66,7 @@ const makeApiFromGroup = (eventGroup, locationMiddleware, formLocationMiddleware
|
|
|
65
66
|
.add(DebugGroup)
|
|
66
67
|
.add(MigrationGroup)
|
|
67
68
|
.add(WebSearchGroup.middleware(locationMiddleware))
|
|
69
|
+
.add(UsageGroup.middleware(locationMiddleware))
|
|
68
70
|
.add(ConfigGroup.middleware(locationMiddleware))
|
|
69
71
|
.annotateMerge(OpenApi.annotations({
|
|
70
72
|
title: "opencode HttpApi",
|
package/dist/client.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export declare const groupNames: {
|
|
|
40
40
|
readonly "server.provider": "provider";
|
|
41
41
|
readonly "server.integration": "integration";
|
|
42
42
|
readonly "server.websearch": "websearch";
|
|
43
|
+
readonly "server.usage": "usage";
|
|
43
44
|
readonly "server.credential": "credential";
|
|
44
45
|
readonly "server.form": "form";
|
|
45
46
|
readonly "server.permission": "permission";
|
package/dist/client.js
CHANGED
|
@@ -27,6 +27,7 @@ export const groupNames = {
|
|
|
27
27
|
"server.provider": "provider",
|
|
28
28
|
"server.integration": "integration",
|
|
29
29
|
"server.websearch": "websearch",
|
|
30
|
+
"server.usage": "usage",
|
|
30
31
|
"server.credential": "credential",
|
|
31
32
|
"server.form": "form",
|
|
32
33
|
"server.permission": "permission",
|
|
@@ -45,11 +46,18 @@ export const groupNames = {
|
|
|
45
46
|
"server.vcs": "vcs",
|
|
46
47
|
"server.config": "config",
|
|
47
48
|
};
|
|
48
|
-
export const promiseOmitEndpoints = new Set([
|
|
49
|
+
export const promiseOmitEndpoints = new Set([
|
|
50
|
+
"pty.connect",
|
|
51
|
+
"persistentPty.connect",
|
|
52
|
+
"mcp.client",
|
|
53
|
+
"generate.textLegacy",
|
|
54
|
+
]);
|
|
49
55
|
export const effectOmitEndpoints = new Set([
|
|
50
56
|
"fs.read",
|
|
51
57
|
"fs.write",
|
|
58
|
+
"media.get",
|
|
52
59
|
"pty.connect",
|
|
53
60
|
"persistentPty.connect",
|
|
54
61
|
"mcp.client",
|
|
62
|
+
"generate.textLegacy",
|
|
55
63
|
]);
|
package/dist/errors.d.ts
CHANGED
|
@@ -95,6 +95,12 @@ declare const FileNotFoundError_base: Schema.Class<FileNotFoundError, Schema.Tag
|
|
|
95
95
|
}>, import("effect/Cause").YieldableError>;
|
|
96
96
|
export declare class FileNotFoundError extends FileNotFoundError_base {
|
|
97
97
|
}
|
|
98
|
+
declare const PluginNotFoundError_base: Schema.Class<PluginNotFoundError, Schema.TaggedStruct<"PluginNotFoundError", {
|
|
99
|
+
readonly pluginID: Schema.String;
|
|
100
|
+
readonly message: Schema.String;
|
|
101
|
+
}>, import("effect/Cause").YieldableError>;
|
|
102
|
+
export declare class PluginNotFoundError extends PluginNotFoundError_base {
|
|
103
|
+
}
|
|
98
104
|
declare const AgentNotFoundError_base: Schema.Class<AgentNotFoundError, Schema.TaggedStruct<"AgentNotFoundError", {
|
|
99
105
|
readonly agentID: Schema.String;
|
|
100
106
|
readonly message: Schema.String;
|
|
@@ -190,4 +196,30 @@ declare const ShellNotFoundError_base: Schema.Class<ShellNotFoundError, Schema.T
|
|
|
190
196
|
}>, import("effect/Cause").YieldableError>;
|
|
191
197
|
export declare class ShellNotFoundError extends ShellNotFoundError_base {
|
|
192
198
|
}
|
|
199
|
+
declare const ModelNotFoundError_base: Schema.Class<ModelNotFoundError, Schema.TaggedStruct<"ModelNotFoundError", {
|
|
200
|
+
readonly providerID: Schema.String;
|
|
201
|
+
readonly modelID: Schema.String;
|
|
202
|
+
readonly message: Schema.String;
|
|
203
|
+
}>, import("effect/Cause").YieldableError>;
|
|
204
|
+
export declare class ModelNotFoundError extends ModelNotFoundError_base {
|
|
205
|
+
}
|
|
206
|
+
declare const UnsupportedModelError_base: Schema.Class<UnsupportedModelError, Schema.TaggedStruct<"UnsupportedModelError", {
|
|
207
|
+
readonly providerID: Schema.String;
|
|
208
|
+
readonly modelID: Schema.String;
|
|
209
|
+
readonly capability: Schema.String;
|
|
210
|
+
readonly message: Schema.String;
|
|
211
|
+
}>, import("effect/Cause").YieldableError>;
|
|
212
|
+
/** The model exists but cannot serve this request, such as a chat model asked for images. */
|
|
213
|
+
export declare class UnsupportedModelError extends UnsupportedModelError_base {
|
|
214
|
+
}
|
|
215
|
+
declare const ProviderRequestError_base: Schema.Class<ProviderRequestError, Schema.TaggedStruct<"ProviderRequestError", {
|
|
216
|
+
readonly providerID: Schema.String;
|
|
217
|
+
readonly reason: Schema.Literals<readonly ["authentication", "rate_limit", "content_filter", "invalid_request", "overloaded", "provider"]>;
|
|
218
|
+
readonly message: Schema.String;
|
|
219
|
+
readonly status: Schema.optional<Schema.Int>;
|
|
220
|
+
readonly retryAfterMs: Schema.optional<Schema.Int>;
|
|
221
|
+
}>, import("effect/Cause").YieldableError>;
|
|
222
|
+
/** The provider rejected or failed the request after the server sent it. */
|
|
223
|
+
export declare class ProviderRequestError extends ProviderRequestError_base {
|
|
224
|
+
}
|
|
193
225
|
export {};
|
package/dist/errors.js
CHANGED
|
@@ -75,6 +75,11 @@ export class FileNotFoundError extends Schema.TaggedError()("FileNotFoundError",
|
|
|
75
75
|
message: Schema.String,
|
|
76
76
|
}, { httpApiStatus: 404 }) {
|
|
77
77
|
}
|
|
78
|
+
export class PluginNotFoundError extends Schema.TaggedError()("PluginNotFoundError", {
|
|
79
|
+
pluginID: Schema.String,
|
|
80
|
+
message: Schema.String,
|
|
81
|
+
}, { httpApiStatus: 404 }) {
|
|
82
|
+
}
|
|
78
83
|
export class AgentNotFoundError extends Schema.TaggedError()("AgentNotFoundError", {
|
|
79
84
|
agentID: Schema.String,
|
|
80
85
|
message: Schema.String,
|
|
@@ -150,3 +155,33 @@ export class ShellNotFoundError extends Schema.TaggedError()("ShellNotFoundError
|
|
|
150
155
|
message: Schema.String,
|
|
151
156
|
}, { httpApiStatus: 404 }) {
|
|
152
157
|
}
|
|
158
|
+
export class ModelNotFoundError extends Schema.TaggedError()("ModelNotFoundError", {
|
|
159
|
+
providerID: Schema.String,
|
|
160
|
+
modelID: Schema.String,
|
|
161
|
+
message: Schema.String,
|
|
162
|
+
}, { httpApiStatus: 404 }) {
|
|
163
|
+
}
|
|
164
|
+
/** The model exists but cannot serve this request, such as a chat model asked for images. */
|
|
165
|
+
export class UnsupportedModelError extends Schema.TaggedError()("UnsupportedModelError", {
|
|
166
|
+
providerID: Schema.String,
|
|
167
|
+
modelID: Schema.String,
|
|
168
|
+
capability: Schema.String,
|
|
169
|
+
message: Schema.String,
|
|
170
|
+
}, { httpApiStatus: 422 }) {
|
|
171
|
+
}
|
|
172
|
+
/** The provider rejected or failed the request after the server sent it. */
|
|
173
|
+
export class ProviderRequestError extends Schema.TaggedError()("ProviderRequestError", {
|
|
174
|
+
providerID: Schema.String,
|
|
175
|
+
reason: Schema.Literals([
|
|
176
|
+
"authentication",
|
|
177
|
+
"rate_limit",
|
|
178
|
+
"content_filter",
|
|
179
|
+
"invalid_request",
|
|
180
|
+
"overloaded",
|
|
181
|
+
"provider",
|
|
182
|
+
]),
|
|
183
|
+
message: Schema.String,
|
|
184
|
+
status: Schema.optional(Schema.Int),
|
|
185
|
+
retryAfterMs: Schema.optional(Schema.Int),
|
|
186
|
+
}, { httpApiStatus: 502 }) {
|
|
187
|
+
}
|
package/dist/groups/agent.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Agent } from "@opencode/schema/agent";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
import { HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
|
|
4
|
-
import { AgentNotFoundError } from "../errors.js";
|
|
4
|
+
import { AgentNotFoundError, ServiceUnavailableError } from "../errors.js";
|
|
5
5
|
export declare const AgentGroup: HttpApiGroup.HttpApiGroup<"server.agent", HttpApiEndpoint.HttpApiEndpoint<"agent.get", "GET", "/api/agent/:agentID", Schema.toCodecStringTree<Schema.Struct<{
|
|
6
6
|
agentID: Schema.brand<Schema.String, "Agent.ID">;
|
|
7
7
|
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
@@ -74,6 +74,11 @@ export declare const AgentGroup: HttpApiGroup.HttpApiGroup<"server.agent", HttpA
|
|
|
74
74
|
}>, Schema.Struct<{
|
|
75
75
|
readonly type: Schema.Literal<"native">;
|
|
76
76
|
}>]>>, never, never>;
|
|
77
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
78
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
79
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
80
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
81
|
+
}>>, never, never>;
|
|
77
82
|
readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
|
|
78
83
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
79
84
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>;
|
|
@@ -183,6 +188,11 @@ export declare const AgentGroup: HttpApiGroup.HttpApiGroup<"server.agent", HttpA
|
|
|
183
188
|
}>, Schema.Struct<{
|
|
184
189
|
readonly type: Schema.Literal<"native">;
|
|
185
190
|
}>]>>, never, never>;
|
|
191
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
192
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
193
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
194
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
195
|
+
}>>, never, never>;
|
|
186
196
|
readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
|
|
187
197
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
188
198
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>;
|
|
@@ -222,4 +232,4 @@ export declare const AgentGroup: HttpApiGroup.HttpApiGroup<"server.agent", HttpA
|
|
|
222
232
|
})[];
|
|
223
233
|
};
|
|
224
234
|
}>;
|
|
225
|
-
}>>,
|
|
235
|
+
}>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never>, false>;
|
package/dist/groups/agent.js
CHANGED
|
@@ -3,11 +3,12 @@ import { Location } from "@opencode/schema/location";
|
|
|
3
3
|
import { Schema } from "effect";
|
|
4
4
|
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api";
|
|
5
5
|
import { LocationQuery, locationQueryOpenApi } from "./location.js";
|
|
6
|
-
import { AgentNotFoundError } from "../errors.js";
|
|
6
|
+
import { AgentNotFoundError, ServiceUnavailableError } from "../errors.js";
|
|
7
7
|
export const AgentGroup = HttpApiGroup.make("server.agent")
|
|
8
8
|
.add(HttpApiEndpoint.get("agent.list", "/api/agent", {
|
|
9
9
|
query: LocationQuery,
|
|
10
10
|
success: Location.response(Schema.Array(Agent.Info)),
|
|
11
|
+
error: ServiceUnavailableError,
|
|
11
12
|
})
|
|
12
13
|
.annotateMerge(locationQueryOpenApi)
|
|
13
14
|
.annotateMerge(OpenApi.annotations({
|
package/dist/groups/event.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Definition } from "@opencode/schema/event";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api";
|
|
4
|
-
export declare const makeEventGroup: <const Definitions extends ReadonlyArray<Definition>>(definitions: Definitions) => HttpApiGroup.HttpApiGroup<"server.event", HttpApiEndpoint.HttpApiEndpoint<"event.subscribe", "GET", "/api/event", never,
|
|
4
|
+
export declare const makeEventGroup: <const Definitions extends ReadonlyArray<Definition>>(definitions: Definitions) => HttpApiGroup.HttpApiGroup<"server.event", HttpApiEndpoint.HttpApiEndpoint<"event.subscribe", "GET", "/api/event", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
5
|
+
readonly types: Schema.optional<Schema.ArrayEnsure<Schema.Union<readonly [Schema.Literals<readonly Definitions[number]["type"][]>, Schema.TemplateLiteral<readonly ["rpc.", Schema.String]>]>>>;
|
|
6
|
+
}>>, never, never, HttpApiSchema.StreamSse<HttpApiSchema.SseEventFromData<Schema.Union<readonly [...Definitions, Schema.Struct<{
|
|
5
7
|
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
6
8
|
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
7
9
|
};
|
|
@@ -46,7 +48,9 @@ export declare const makeEventGroup: <const Definitions extends ReadonlyArray<De
|
|
|
46
48
|
readonly type: "server.connected";
|
|
47
49
|
readonly data: {};
|
|
48
50
|
}[]])[number]>, never, never, never>, false>;
|
|
49
|
-
export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpApiEndpoint.HttpApiEndpoint<"event.subscribe", "GET", "/api/event", never,
|
|
51
|
+
export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpApiEndpoint.HttpApiEndpoint<"event.subscribe", "GET", "/api/event", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
52
|
+
readonly types: Schema.optional<Schema.ArrayEnsure<Schema.Union<readonly [Schema.Literals<readonly ("agent.updated" | "command.updated" | "config.updated" | "credential.switched" | "credential.updated" | "filesystem.changed" | "form.cancelled" | "form.created" | "form.replied" | "installation.update-available" | "installation.updated" | "integration.updated" | "location.shutdown" | "mcp.resources.changed" | "mcp.status.changed" | "model.updated" | "models-dev.refreshed" | "permission.asked" | "permission.replied" | "persistent-pty.added" | "persistent-pty.removed" | "plugin.updated" | "project.updated" | "provider.updated" | "pty.created" | "pty.deleted" | "pty.exited" | "pty.updated" | "reference.updated" | "session.agent.selected" | "session.archived" | "session.compaction.delta" | "session.compaction.ended" | "session.compaction.failed" | "session.compaction.started" | "session.created" | "session.deleted" | "session.execution.failed" | "session.execution.interrupted" | "session.execution.started" | "session.execution.succeeded" | "session.forked" | "session.idle" | "session.inbox.cancelled" | "session.inbox.delivered" | "session.inbox.delivery.changed" | "session.inbox.enqueued" | "session.instructions.updated" | "session.metadata.updated" | "session.model.selected" | "session.moved" | "session.permissions" | "session.reasoning.delta" | "session.reasoning.ended" | "session.reasoning.started" | "session.renamed" | "session.retry.scheduled" | "session.revert.cleared" | "session.revert.committed" | "session.revert.staged" | "session.shell.ended" | "session.shell.started" | "session.skill.activated" | "session.status" | "session.step.ended" | "session.step.failed" | "session.step.started" | "session.step.streamed" | "session.synthetic" | "session.text.delta" | "session.text.ended" | "session.text.started" | "session.tool.called" | "session.tool.failed" | "session.tool.input.delta" | "session.tool.input.ended" | "session.tool.input.started" | "session.tool.progress" | "session.tool.success" | "session.unarchived" | "session.usage.updated" | "session.viewed" | "shell.created" | "shell.deleted" | "shell.exited" | "skill.updated" | "tui.command.execute" | "tui.prompt.append" | "tui.session.select" | "tui.toast.show" | "vcs.branch.updated" | "websearch.updated" | "worktree.resolved" | "worktree.updated")[]>, Schema.TemplateLiteral<readonly ["rpc.", Schema.String]>]>>>;
|
|
53
|
+
}>>, never, never, HttpApiSchema.StreamSse<HttpApiSchema.SseEventFromData<Schema.Union<readonly [Schema.Struct<{
|
|
50
54
|
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
51
55
|
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
52
56
|
};
|
|
@@ -4238,12 +4242,14 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
|
|
|
4238
4242
|
readonly additions: Schema.Int;
|
|
4239
4243
|
readonly deletions: Schema.Int;
|
|
4240
4244
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
4245
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
4241
4246
|
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
4242
4247
|
readonly file: Schema.String;
|
|
4243
4248
|
readonly patch: Schema.String;
|
|
4244
4249
|
readonly additions: Schema.Int;
|
|
4245
4250
|
readonly deletions: Schema.Int;
|
|
4246
4251
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
4252
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
4247
4253
|
}>>>, never, never>;
|
|
4248
4254
|
}>;
|
|
4249
4255
|
}>;
|
|
@@ -4271,12 +4277,14 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
|
|
|
4271
4277
|
readonly additions: Schema.Int;
|
|
4272
4278
|
readonly deletions: Schema.Int;
|
|
4273
4279
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
4280
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
4274
4281
|
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
4275
4282
|
readonly file: Schema.String;
|
|
4276
4283
|
readonly patch: Schema.String;
|
|
4277
4284
|
readonly additions: Schema.Int;
|
|
4278
4285
|
readonly deletions: Schema.Int;
|
|
4279
4286
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
4287
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
4280
4288
|
}>>>, never, never>;
|
|
4281
4289
|
}>;
|
|
4282
4290
|
}>;
|
|
@@ -7053,6 +7061,7 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
|
|
|
7053
7061
|
readonly additions: number;
|
|
7054
7062
|
readonly deletions: number;
|
|
7055
7063
|
readonly status: "added" | "deleted" | "modified";
|
|
7064
|
+
readonly more?: true | undefined;
|
|
7056
7065
|
}[] | undefined;
|
|
7057
7066
|
};
|
|
7058
7067
|
};
|
|
@@ -12794,12 +12803,14 @@ export declare const OpenCodeEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
12794
12803
|
readonly additions: Schema.Int;
|
|
12795
12804
|
readonly deletions: Schema.Int;
|
|
12796
12805
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
12806
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
12797
12807
|
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
12798
12808
|
readonly file: Schema.String;
|
|
12799
12809
|
readonly patch: Schema.String;
|
|
12800
12810
|
readonly additions: Schema.Int;
|
|
12801
12811
|
readonly deletions: Schema.Int;
|
|
12802
12812
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
12813
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
12803
12814
|
}>>>, never, never>;
|
|
12804
12815
|
}>;
|
|
12805
12816
|
}>;
|
|
@@ -12827,12 +12838,14 @@ export declare const OpenCodeEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
12827
12838
|
readonly additions: Schema.Int;
|
|
12828
12839
|
readonly deletions: Schema.Int;
|
|
12829
12840
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
12841
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
12830
12842
|
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
12831
12843
|
readonly file: Schema.String;
|
|
12832
12844
|
readonly patch: Schema.String;
|
|
12833
12845
|
readonly additions: Schema.Int;
|
|
12834
12846
|
readonly deletions: Schema.Int;
|
|
12835
12847
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
12848
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
12836
12849
|
}>>>, never, never>;
|
|
12837
12850
|
}>;
|
|
12838
12851
|
}>;
|
package/dist/groups/event.js
CHANGED
|
@@ -29,12 +29,21 @@ const schema = (definitions) => Schema.Union([
|
|
|
29
29
|
}).annotate({ identifier: "V2Event.server.connected" }),
|
|
30
30
|
]),
|
|
31
31
|
]).annotate({ identifier: "V2Event" });
|
|
32
|
+
const query = (definitions) => Schema.Struct({
|
|
33
|
+
types: Schema.optional(Schema.ArrayEnsure(Schema.Union([
|
|
34
|
+
Schema.Literals(definitions.map((definition) => definition.type)),
|
|
35
|
+
rpcEvent.fields.type,
|
|
36
|
+
]))).annotate({
|
|
37
|
+
description: "Only send events of these types, plus the initial server.connected event. When omitted, all events are sent.",
|
|
38
|
+
}),
|
|
39
|
+
}).annotate({ identifier: "EventSubscribeQuery" });
|
|
32
40
|
const make = (definitions) => {
|
|
33
41
|
const EventSchema = schema(definitions);
|
|
34
42
|
return {
|
|
35
43
|
schema: EventSchema,
|
|
36
44
|
group: HttpApiGroup.make("server.event")
|
|
37
45
|
.add(HttpApiEndpoint.get("event.subscribe", "/api/event", {
|
|
46
|
+
query: query(definitions),
|
|
38
47
|
success: HttpApiSchema.StreamSse({ data: EventSchema }),
|
|
39
48
|
}).annotateMerge(OpenApi.annotations({
|
|
40
49
|
identifier: "event.subscribe",
|