@opencode/protocol 0.0.0-dev-1301 → 0.0.0-dev-1302

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 CHANGED
@@ -62,6 +62,7 @@ export declare const groupNames: {
62
62
  export declare const clientNamespace: (endpoint: {
63
63
  readonly path: string;
64
64
  }) => "experimental" | undefined;
65
+ export declare const deprecatedClientPaths: Set<string>;
65
66
  export declare const promiseOmitEndpoints: Set<string>;
66
67
  export declare const effectOmitEndpoints: Set<string>;
67
68
  export {};
package/dist/client.js CHANGED
@@ -50,6 +50,36 @@ export const groupNames = {
50
50
  // `client.experimental` instead of beside stable methods. The URL decides rather than the OpenAPI
51
51
  // id, because the URL is what callers depend on and an id can miss its `experimental.` prefix.
52
52
  export const clientNamespace = (endpoint) => endpoint.path === "/api/experimental" || endpoint.path.startsWith("/api/experimental/") ? "experimental" : undefined;
53
+ // The client paths that shipped before experimental methods moved under `client.experimental`. Each keeps a
54
+ // deprecated alias until the next minor. Frozen: endpoints added since never had another path.
55
+ export const deprecatedClientPaths = new Set([
56
+ "config.update",
57
+ "file.unwatch",
58
+ "file.watch",
59
+ "file.write",
60
+ "generate.decisions",
61
+ "generate.image",
62
+ "generate.text",
63
+ "integration.wellknown.add",
64
+ "mcp.add",
65
+ "mcp.client.token",
66
+ "mcp.connect",
67
+ "mcp.disconnect",
68
+ "mcp.remove",
69
+ "migration.v1.status",
70
+ "session.export",
71
+ "session.import",
72
+ "session.instructions.entry.list",
73
+ "session.instructions.entry.put",
74
+ "session.instructions.entry.remove",
75
+ "session.log",
76
+ "session.skill",
77
+ "session.stats",
78
+ "session.wait",
79
+ "usage.limits",
80
+ "voice.models",
81
+ "voice.session",
82
+ ]);
53
83
  export const promiseOmitEndpoints = new Set([
54
84
  "pty.connect",
55
85
  "persistentPty.connect",
@@ -60,6 +90,7 @@ export const effectOmitEndpoints = new Set([
60
90
  "fs.read",
61
91
  "fs.write",
62
92
  "media.get",
93
+ "blob.get",
63
94
  "artifacts.view",
64
95
  "pty.connect",
65
96
  "persistentPty.connect",
package/dist/errors.d.ts CHANGED
@@ -234,6 +234,18 @@ declare const ScheduleNotFoundError_base: Schema.Class<ScheduleNotFoundError, Sc
234
234
  }>, import("effect/Cause").YieldableError>;
235
235
  export declare class ScheduleNotFoundError extends ScheduleNotFoundError_base {
236
236
  }
237
+ declare const VideoNotFoundError_base: Schema.Class<VideoNotFoundError, Schema.TaggedStruct<"VideoNotFoundError", {
238
+ readonly videoID: Schema.String;
239
+ readonly message: Schema.String;
240
+ }>, import("effect/Cause").YieldableError>;
241
+ export declare class VideoNotFoundError extends VideoNotFoundError_base {
242
+ }
243
+ declare const BlobNotFoundError_base: Schema.Class<BlobNotFoundError, Schema.TaggedStruct<"BlobNotFoundError", {
244
+ readonly blobID: Schema.String;
245
+ readonly message: Schema.String;
246
+ }>, import("effect/Cause").YieldableError>;
247
+ export declare class BlobNotFoundError extends BlobNotFoundError_base {
248
+ }
237
249
  declare const ArtifactNotFoundError_base: Schema.Class<ArtifactNotFoundError, Schema.TaggedStruct<"ArtifactNotFoundError", {
238
250
  readonly artifactID: Schema.String;
239
251
  readonly message: Schema.String;
package/dist/errors.js CHANGED
@@ -195,6 +195,16 @@ export class ScheduleNotFoundError extends Schema.TaggedError()("ScheduleNotFoun
195
195
  message: Schema.String,
196
196
  }, { httpApiStatus: 404 }) {
197
197
  }
198
+ export class VideoNotFoundError extends Schema.TaggedError()("VideoNotFoundError", {
199
+ videoID: Schema.String,
200
+ message: Schema.String,
201
+ }, { httpApiStatus: 404 }) {
202
+ }
203
+ export class BlobNotFoundError extends Schema.TaggedError()("BlobNotFoundError", {
204
+ blobID: Schema.String,
205
+ message: Schema.String,
206
+ }, { httpApiStatus: 404 }) {
207
+ }
198
208
  export class ArtifactNotFoundError extends Schema.TaggedError()("ArtifactNotFoundError", {
199
209
  artifactID: Schema.String,
200
210
  message: Schema.String,
@@ -0,0 +1,7 @@
1
+ import { Schema } from "effect";
2
+ import { HttpApiEndpoint } from "effect/http-api";
3
+ import { BlobNotFoundError } from "../errors.js";
4
+ /** Lives in the `server.experimental` group (see `groups/experimental.ts`). */
5
+ export declare const BlobGetEndpoint: HttpApiEndpoint.HttpApiEndpoint<"blob.get", "GET", "/api/experimental/blob/:id", Schema.toCodecStringTree<Schema.Struct<{
6
+ id: Schema.brand<Schema.String, "Blob.ID">;
7
+ }>>, never, never, never, Schema.toCodecJson<Schema.Uint8Array>, Schema.toCodecJson<typeof BlobNotFoundError>, never, never>;
@@ -0,0 +1,16 @@
1
+ import { BlobStore } from "@opencode/schema/blob-store";
2
+ import { Schema } from "effect";
3
+ import { HttpApiEndpoint, HttpApiSchema, OpenApi } from "effect/http-api";
4
+ import { BlobNotFoundError } from "../errors.js";
5
+ /** Lives in the `server.experimental` group (see `groups/experimental.ts`). */
6
+ export const BlobGetEndpoint = HttpApiEndpoint.get("blob.get", "/api/experimental/blob/:id", {
7
+ params: { id: BlobStore.ID },
8
+ success: Schema.Uint8Array.pipe(HttpApiSchema.asUint8Array()),
9
+ error: [BlobNotFoundError],
10
+ }).annotateMerge(OpenApi.annotations({
11
+ identifier: "experimental.blob.get",
12
+ summary: "Read a blob",
13
+ description: "Stream a stored blob's bytes, such as a generated video, with single byte Range, ETag and 304 Not Modified support. Blobs are deleted 7 days after they're written. Experimental: may change without compatibility guarantees.",
14
+ // The route shares the `server.experimental` group with the persistent PTY prototype; tag it on its own.
15
+ transform: (operation) => ({ ...operation, tags: ["experimental"] }),
16
+ }));
@@ -167,7 +167,9 @@ export declare const ExperimentalGroup: import("effect/http-api/HttpApiGroup").H
167
167
  readonly location: import("effect/Schema").optional<import("effect/Schema").Struct<{
168
168
  readonly directory: import("effect/Schema").optional<import("effect/Schema").String>;
169
169
  }>>;
170
- }>>, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Uint8Array>, import("effect/Schema").toCodecJson<typeof import("../errors.js").LocationNotFoundError | typeof import("../errors.js").InvalidRequestError | typeof import("../errors.js").ServiceUnavailableError | typeof import("../errors.js").FileNotFoundError | typeof import("../errors.js").ForbiddenError | typeof import("../errors.js").ArtifactNotFoundError>, never, never> | import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"job.list", "GET", "/api/experimental/job", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
170
+ }>>, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Uint8Array>, import("effect/Schema").toCodecJson<typeof import("../errors.js").LocationNotFoundError | typeof import("../errors.js").InvalidRequestError | typeof import("../errors.js").ServiceUnavailableError | typeof import("../errors.js").FileNotFoundError | typeof import("../errors.js").ForbiddenError | typeof import("../errors.js").ArtifactNotFoundError>, never, never> | import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"blob.get", "GET", "/api/experimental/blob/:id", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
171
+ id: import("effect/Schema").brand<import("effect/Schema").String, "Blob.ID">;
172
+ }>>, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Uint8Array>, import("effect/Schema").toCodecJson<typeof import("../errors.js").BlobNotFoundError>, never, never> | import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"job.list", "GET", "/api/experimental/job", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
171
173
  readonly sessionID: import("effect/Schema").optional<import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
172
174
  create: () => string & import("effect/Brand").Brand<"SessionID">;
173
175
  }>;
@@ -1,7 +1,8 @@
1
1
  import { ArtifactEndpoints } from "./artifact.js";
2
+ import { BlobGetEndpoint } from "./blob.js";
2
3
  import { JobEndpoints } from "./job.js";
3
4
  import { MediaGetEndpoint } from "./media.js";
4
5
  import { PersistentPtyGroup } from "./persistent-pty.js";
5
6
  import { ScheduleEndpoints } from "./schedule.js";
6
7
  /** `server.experimental`: routes under /api/experimental, without compatibility guarantees. */
7
- export const ExperimentalGroup = PersistentPtyGroup.add(MediaGetEndpoint, ...ScheduleEndpoints, ...ArtifactEndpoints, ...JobEndpoints);
8
+ export const ExperimentalGroup = PersistentPtyGroup.add(MediaGetEndpoint, BlobGetEndpoint, ...ScheduleEndpoints, ...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>, false>;
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>;
@@ -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/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": "0.0.0-dev-1301",
4
+ "version": "0.0.0-dev-1302",
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": "0.0.0-dev-1301",
38
+ "@opencode/schema": "0.0.0-dev-1302",
39
39
  "effect": "4.1.0"
40
40
  },
41
41
  "devDependencies": {