@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.
@@ -0,0 +1,8 @@
1
+ import { Schema } from "effect";
2
+ import { HttpApiEndpoint } from "effect/http-api";
3
+ import { FileNotFoundError, InvalidRequestError } from "../errors.js";
4
+ export declare const MediaHash: Schema.String;
5
+ /** Lives in the `server.experimental` group (see `groups/experimental.ts`). */
6
+ export declare const MediaGetEndpoint: HttpApiEndpoint.HttpApiEndpoint<"media.get", "GET", "/api/experimental/media/:hash", Schema.toCodecStringTree<Schema.Struct<{
7
+ hash: Schema.String;
8
+ }>>, never, never, never, Schema.toCodecJson<Schema.Uint8Array>, Schema.toCodecJson<typeof InvalidRequestError | typeof FileNotFoundError>, never, never>;
@@ -0,0 +1,18 @@
1
+ import { Schema } from "effect";
2
+ import { HttpApiEndpoint, HttpApiSchema, OpenApi } from "effect/http-api";
3
+ import { FileNotFoundError, InvalidRequestError } from "../errors.js";
4
+ export const MediaHash = Schema.String.check(Schema.isPattern(/^[0-9a-f]{64}$/u)).annotate({
5
+ identifier: "MediaHash",
6
+ });
7
+ /** Lives in the `server.experimental` group (see `groups/experimental.ts`). */
8
+ export const MediaGetEndpoint = HttpApiEndpoint.get("media.get", "/api/experimental/media/:hash", {
9
+ params: { hash: MediaHash },
10
+ success: Schema.Uint8Array.pipe(HttpApiSchema.asUint8Array()),
11
+ error: [FileNotFoundError, InvalidRequestError],
12
+ }).annotateMerge(OpenApi.annotations({
13
+ identifier: "experimental.media.get",
14
+ summary: "Read media blob",
15
+ description: "Read a content-addressed media blob by SHA-256 hash with immutable Cache-Control, ETag, and 304 Not Modified support. Only blobs a stored message or inbox item still references are served. Experimental: may change without compatibility guarantees.",
16
+ // The route shares the `server.experimental` group with the persistent PTY prototype; tag it on its own.
17
+ transform: (operation) => ({ ...operation, tags: ["experimental"] }),
18
+ }));