@opencode/protocol 2.3.0 → 2.3.2
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/client.d.ts +1 -0
- package/dist/client.js +31 -0
- package/dist/errors.d.ts +15 -3
- package/dist/errors.js +12 -2
- package/dist/groups/automation.d.ts +459 -0
- package/dist/groups/automation.js +55 -0
- package/dist/groups/blob.d.ts +7 -0
- package/dist/groups/blob.js +16 -0
- package/dist/groups/experimental.d.ts +410 -557
- package/dist/groups/experimental.js +3 -2
- package/dist/groups/generate.d.ts +95 -2
- package/dist/groups/generate.js +19 -1
- package/dist/groups/job.d.ts +14 -2
- package/dist/groups/job.js +1 -1
- package/package.json +2 -2
- package/dist/groups/schedule.d.ts +0 -675
- package/dist/groups/schedule.js +0 -51
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ArtifactEndpoints } from "./artifact.js";
|
|
2
|
+
import { BlobGetEndpoint } from "./blob.js";
|
|
3
|
+
import { AutomationEndpoints } from "./automation.js";
|
|
2
4
|
import { JobEndpoints } from "./job.js";
|
|
3
5
|
import { MediaGetEndpoint } from "./media.js";
|
|
4
6
|
import { PersistentPtyGroup } from "./persistent-pty.js";
|
|
5
|
-
import { ScheduleEndpoints } from "./schedule.js";
|
|
6
7
|
/** `server.experimental`: routes under /api/experimental, without compatibility guarantees. */
|
|
7
|
-
export const ExperimentalGroup = PersistentPtyGroup.add(MediaGetEndpoint, ...
|
|
8
|
+
export const ExperimentalGroup = PersistentPtyGroup.add(MediaGetEndpoint, BlobGetEndpoint, ...AutomationEndpoints, ...ArtifactEndpoints, ...JobEndpoints);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Generate } from "@opencode/schema/generate";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
import { HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
|
|
4
|
-
import { InvalidRequestError, LocationNotFoundError, ModelNotFoundError, ProviderNotFoundError, ProviderRequestError, ServiceUnavailableError, UnsupportedModelError } from "../errors.js";
|
|
4
|
+
import { ForbiddenError, VideoNotFoundError, InvalidRequestError, LocationNotFoundError, ModelNotFoundError, ProviderNotFoundError, ProviderRequestError, ServiceUnavailableError, UnsupportedModelError } from "../errors.js";
|
|
5
5
|
export declare const GenerateGroup: HttpApiGroup.HttpApiGroup<"server.generate", HttpApiEndpoint.HttpApiEndpoint<"generate.decisions", "POST", "/api/experimental/generate/decisions", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
6
6
|
readonly model: Schema.Struct<{
|
|
7
7
|
readonly id: Schema.brand<Schema.String, "Model.ID">;
|
|
@@ -232,4 +232,97 @@ export declare const GenerateGroup: HttpApiGroup.HttpApiGroup<"server.generate",
|
|
|
232
232
|
readonly data: Schema.Struct<{
|
|
233
233
|
readonly text: Schema.String;
|
|
234
234
|
}>;
|
|
235
|
-
}>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof ServiceUnavailableError | typeof ProviderNotFoundError | typeof ModelNotFoundError | typeof UnsupportedModelError | typeof ProviderRequestError>, never, never
|
|
235
|
+
}>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof ServiceUnavailableError | typeof ProviderNotFoundError | typeof ModelNotFoundError | typeof UnsupportedModelError | typeof ProviderRequestError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"generate.video.create", "POST", "/api/experimental/generate/video", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
236
|
+
readonly model: Schema.Struct<{
|
|
237
|
+
readonly id: Schema.brand<Schema.String, "Model.ID">;
|
|
238
|
+
readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
|
|
239
|
+
opencode: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
240
|
+
anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
241
|
+
openai: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
242
|
+
google: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
243
|
+
googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
244
|
+
githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
245
|
+
claudeAgent: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
246
|
+
amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
247
|
+
azure: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
248
|
+
openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
249
|
+
mistral: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
250
|
+
gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
251
|
+
};
|
|
252
|
+
readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
|
|
253
|
+
}> & {
|
|
254
|
+
parse: (input: string) => {
|
|
255
|
+
readonly id: string & import("effect/Brand").Brand<"Model.ID">;
|
|
256
|
+
readonly providerID: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
257
|
+
readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
readonly prompt: Schema.String;
|
|
261
|
+
readonly start: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
262
|
+
readonly data: Schema.String;
|
|
263
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
264
|
+
readonly mime: Schema.String;
|
|
265
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
266
|
+
readonly data: Schema.String;
|
|
267
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
268
|
+
readonly mime: Schema.String;
|
|
269
|
+
}>>, never, never>;
|
|
270
|
+
readonly end: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
271
|
+
readonly data: Schema.String;
|
|
272
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
273
|
+
readonly mime: Schema.String;
|
|
274
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
275
|
+
readonly data: Schema.String;
|
|
276
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
277
|
+
readonly mime: Schema.String;
|
|
278
|
+
}>>, never, never>;
|
|
279
|
+
readonly references: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
|
|
280
|
+
readonly data: Schema.String;
|
|
281
|
+
readonly mime: Schema.String;
|
|
282
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
283
|
+
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
284
|
+
readonly data: Schema.String;
|
|
285
|
+
readonly mime: Schema.String;
|
|
286
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
287
|
+
}>>>, never, never>;
|
|
288
|
+
readonly duration: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
289
|
+
readonly aspect: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Generate.VideoAspect, Generate.VideoAspect, never, never>>>, Schema.optionalKey<Schema.Codec<Generate.VideoAspect, Generate.VideoAspect, never, never>>, never, never>;
|
|
290
|
+
readonly resolution: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Generate.VideoResolution, Generate.VideoResolution, never, never>>>, Schema.optionalKey<Schema.Codec<Generate.VideoResolution, Generate.VideoResolution, never, never>>, never, never>;
|
|
291
|
+
readonly sound: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
292
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
293
|
+
readonly data: Schema.Struct<{
|
|
294
|
+
readonly id: Schema.brand<Schema.String, "Generate.VideoID"> & {
|
|
295
|
+
create: () => string & import("effect/Brand").Brand<"Generate.VideoID">;
|
|
296
|
+
};
|
|
297
|
+
readonly status: Schema.Literal<"running">;
|
|
298
|
+
}>;
|
|
299
|
+
}>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof ServiceUnavailableError | typeof ProviderNotFoundError | typeof ForbiddenError | typeof ModelNotFoundError | typeof UnsupportedModelError | typeof ProviderRequestError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"generate.video.get", "GET", "/api/experimental/generate/video/:id", Schema.toCodecStringTree<Schema.Struct<{
|
|
300
|
+
id: Schema.brand<Schema.String, "Generate.VideoID"> & {
|
|
301
|
+
create: () => string & import("effect/Brand").Brand<"Generate.VideoID">;
|
|
302
|
+
};
|
|
303
|
+
}>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
304
|
+
readonly data: Schema.Union<readonly [Schema.Struct<{
|
|
305
|
+
readonly id: Schema.brand<Schema.String, "Generate.VideoID"> & {
|
|
306
|
+
create: () => string & import("effect/Brand").Brand<"Generate.VideoID">;
|
|
307
|
+
};
|
|
308
|
+
readonly status: Schema.Literal<"running">;
|
|
309
|
+
}>, Schema.Struct<{
|
|
310
|
+
readonly id: Schema.brand<Schema.String, "Generate.VideoID"> & {
|
|
311
|
+
create: () => string & import("effect/Brand").Brand<"Generate.VideoID">;
|
|
312
|
+
};
|
|
313
|
+
readonly status: Schema.Literal<"completed">;
|
|
314
|
+
readonly blobs: Schema.$Array<Schema.Struct<{
|
|
315
|
+
readonly id: Schema.brand<Schema.String, "Blob.ID">;
|
|
316
|
+
readonly mime: Schema.String;
|
|
317
|
+
readonly bytes: Schema.Finite;
|
|
318
|
+
readonly expiresAt: Schema.Finite;
|
|
319
|
+
}>>;
|
|
320
|
+
}>, Schema.Struct<{
|
|
321
|
+
readonly id: Schema.brand<Schema.String, "Generate.VideoID"> & {
|
|
322
|
+
create: () => string & import("effect/Brand").Brand<"Generate.VideoID">;
|
|
323
|
+
};
|
|
324
|
+
readonly status: Schema.Literal<"error">;
|
|
325
|
+
readonly error: Schema.String;
|
|
326
|
+
readonly reason: Schema.Literals<readonly ["failed", "cancelled", "expired", "unknown"]>;
|
|
327
|
+
}>]>;
|
|
328
|
+
}>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof ForbiddenError | typeof VideoNotFoundError>, never, never>, false>;
|
package/dist/groups/generate.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Generate } from "@opencode/schema/generate";
|
|
|
2
2
|
import { Model } from "@opencode/schema/model";
|
|
3
3
|
import { Schema } from "effect";
|
|
4
4
|
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api";
|
|
5
|
-
import { InvalidRequestError, LocationNotFoundError, ModelNotFoundError, ProviderNotFoundError, ProviderRequestError, ServiceUnavailableError, UnsupportedModelError, } from "../errors.js";
|
|
5
|
+
import { ForbiddenError, VideoNotFoundError, InvalidRequestError, LocationNotFoundError, ModelNotFoundError, ProviderNotFoundError, ProviderRequestError, ServiceUnavailableError, UnsupportedModelError, } from "../errors.js";
|
|
6
6
|
const errors = [
|
|
7
7
|
InvalidRequestError,
|
|
8
8
|
ProviderNotFoundError,
|
|
@@ -43,6 +43,24 @@ export const GenerateGroup = HttpApiGroup.make("server.generate")
|
|
|
43
43
|
identifier: "experimental.generate.image",
|
|
44
44
|
summary: "Generate images",
|
|
45
45
|
description: "Generate or edit images with an image model using the server's base configuration and return them as base64. Stateless: nothing is stored.",
|
|
46
|
+
})))
|
|
47
|
+
.add(HttpApiEndpoint.post("generate.video.create", "/api/experimental/generate/video", {
|
|
48
|
+
payload: Generate.VideoRequest,
|
|
49
|
+
success: Schema.Struct({ data: Generate.VideoRunning }).annotate({ identifier: "GenerateVideoCreateResponse" }),
|
|
50
|
+
error: [...errors, ForbiddenError],
|
|
51
|
+
}).annotateMerge(OpenApi.annotations({
|
|
52
|
+
identifier: "experimental.generate.video.create",
|
|
53
|
+
summary: "Create a video generation",
|
|
54
|
+
description: "Submit a video job to a video model using the server's base configuration and return its ID once the provider accepted it. The server polls the job and stores the finished video as a blob for 7 days; read the job with GET /api/experimental/generate/video/:id and the video with GET /api/experimental/blob/:id. Behind the video_generate flag. Experimental: may change without compatibility guarantees.",
|
|
55
|
+
})))
|
|
56
|
+
.add(HttpApiEndpoint.get("generate.video.get", "/api/experimental/generate/video/:id", {
|
|
57
|
+
params: { id: Generate.VideoID },
|
|
58
|
+
success: Schema.Struct({ data: Generate.VideoJob }).annotate({ identifier: "GenerateVideoGetResponse" }),
|
|
59
|
+
error: [VideoNotFoundError, ForbiddenError, LocationNotFoundError],
|
|
60
|
+
}).annotateMerge(OpenApi.annotations({
|
|
61
|
+
identifier: "experimental.generate.video.get",
|
|
62
|
+
summary: "Read a video generation",
|
|
63
|
+
description: "Read a video job: running, completed with the video's blob, or error with a reason. Jobs are kept in memory, so a server restart forgets them; a finished video's blob stays readable. Behind the video_generate flag. Experimental: may change without compatibility guarantees.",
|
|
46
64
|
})))
|
|
47
65
|
.add(HttpApiEndpoint.post("generate.decisions", "/api/experimental/generate/decisions", {
|
|
48
66
|
payload: Generate.DecisionRequest,
|
package/dist/groups/job.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const ListQuery: Schema.Struct<{
|
|
|
5
5
|
readonly sessionID: Schema.optional<Schema.brand<Schema.String, "SessionID"> & {
|
|
6
6
|
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
7
7
|
}>;
|
|
8
|
-
readonly kind: Schema.optional<Schema.Literals<readonly ["shell", "subagent", "image"]>>;
|
|
8
|
+
readonly kind: Schema.optional<Schema.Literals<readonly ["shell", "subagent", "image", "codemode"]>>;
|
|
9
9
|
readonly status: Schema.optional<Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>>;
|
|
10
10
|
readonly descendants: Schema.optional<Schema.decodeTo<Schema.Boolean, Schema.Literals<readonly ["true", "false"]>, never, never>>;
|
|
11
11
|
}>;
|
|
@@ -15,7 +15,7 @@ export declare const JobEndpoints: readonly [HttpApiEndpoint.HttpApiEndpoint<"jo
|
|
|
15
15
|
readonly sessionID: Schema.optional<Schema.brand<Schema.String, "SessionID"> & {
|
|
16
16
|
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
17
17
|
}>;
|
|
18
|
-
readonly kind: Schema.optional<Schema.Literals<readonly ["shell", "subagent", "image"]>>;
|
|
18
|
+
readonly kind: Schema.optional<Schema.Literals<readonly ["shell", "subagent", "image", "codemode"]>>;
|
|
19
19
|
readonly status: Schema.optional<Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>>;
|
|
20
20
|
readonly descendants: Schema.optional<Schema.decodeTo<Schema.Boolean, Schema.Literals<readonly ["true", "false"]>, never, never>>;
|
|
21
21
|
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
@@ -64,5 +64,17 @@ export declare const JobEndpoints: readonly [HttpApiEndpoint.HttpApiEndpoint<"jo
|
|
|
64
64
|
readonly kind: Schema.tag<"image">;
|
|
65
65
|
readonly path: Schema.String;
|
|
66
66
|
readonly model: Schema.String;
|
|
67
|
+
}>, Schema.Struct<{
|
|
68
|
+
readonly id: Schema.String;
|
|
69
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
70
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
71
|
+
};
|
|
72
|
+
readonly status: Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
73
|
+
readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
74
|
+
readonly time: Schema.Struct<{
|
|
75
|
+
readonly started: Schema.Finite;
|
|
76
|
+
readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
77
|
+
}>;
|
|
78
|
+
readonly kind: Schema.tag<"codemode">;
|
|
67
79
|
}>]>>;
|
|
68
80
|
}>>, Schema.toCodecJson<typeof InvalidRequestError | typeof SessionNotFoundError>, never, never>];
|
package/dist/groups/job.js
CHANGED
|
@@ -12,7 +12,7 @@ export const ListQuery = Schema.Struct({
|
|
|
12
12
|
description: "Filter to background jobs owned by this session.",
|
|
13
13
|
}),
|
|
14
14
|
kind: Schema.optional(Job.Kind).annotate({
|
|
15
|
-
description: "Filter by background job kind
|
|
15
|
+
description: "Filter by background job kind.",
|
|
16
16
|
}),
|
|
17
17
|
status: Schema.optional(Job.Status).annotate({
|
|
18
18
|
description: "Filter by job status (running, completed, error, or cancelled).",
|
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.3.
|
|
4
|
+
"version": "2.3.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"typecheck:tsc": "tsc --noEmit"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@opencode/schema": "2.3.
|
|
38
|
+
"@opencode/schema": "2.3.2",
|
|
39
39
|
"effect": "4.1.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|