@opencode-ai/protocol
Advanced tools
+17
-3
| import { Location } from "@opencode-ai/schema/location"; | ||
| import { Schema } from "effect"; | ||
| import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; | ||
| import { ServiceUnavailableError } from "../errors.js"; | ||
| export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEndpoint.HttpApiEndpoint<"vcs.get", "GET", "/api/vcs", never, Schema.toCodecStringTree<Schema.Struct<{ | ||
@@ -17,3 +18,3 @@ readonly location: Schema.optional<Schema.Struct<{ | ||
| }>; | ||
| }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.status", "GET", "/api/vcs/status", never, Schema.toCodecStringTree<Schema.Struct<{ | ||
| }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.base", "GET", "/api/vcs/base", never, Schema.toCodecStringTree<Schema.Struct<{ | ||
| readonly location: Schema.optional<Schema.Struct<{ | ||
@@ -25,2 +26,14 @@ readonly directory: Schema.optional<Schema.String>; | ||
| readonly location: typeof Location.Info; | ||
| readonly data: Schema.NullOr<Schema.Struct<{ | ||
| readonly name: Schema.String; | ||
| readonly ref: Schema.String; | ||
| readonly source: Schema.Literals<readonly ["reflog", "default"]>; | ||
| }>>; | ||
| }>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.status", "GET", "/api/vcs/status", never, Schema.toCodecStringTree<Schema.Struct<{ | ||
| readonly location: Schema.optional<Schema.Struct<{ | ||
| readonly directory: Schema.optional<Schema.String>; | ||
| readonly workspace: Schema.optional<Schema.String>; | ||
| }>>; | ||
| }>>, never, never, Schema.toCodecJson<Schema.Struct<{ | ||
| readonly location: typeof Location.Info; | ||
| readonly data: Schema.$Array<Schema.Struct<{ | ||
@@ -43,3 +56,4 @@ readonly file: Schema.String; | ||
| }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.diff", "GET", "/api/vcs/diff", never, Schema.toCodecStringTree<Schema.Struct<{ | ||
| readonly mode: Schema.Literals<readonly ["working", "branch"]>; | ||
| readonly mode: Schema.Literals<readonly ["working", "branch", "committed"]>; | ||
| readonly base: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>; | ||
| readonly context: Schema.optional<Schema.compose<Schema.Int, Schema.NumberFromString>>; | ||
@@ -59,2 +73,2 @@ readonly location: Schema.optional<Schema.Struct<{ | ||
| }>>; | ||
| }>>, never, never, never>, false>; | ||
| }>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never>, false>; |
+16
-2
| import { FileDiff } from "@opencode-ai/schema/file-diff"; | ||
| import { Location } from "@opencode-ai/schema/location"; | ||
| import { NonNegativeInt, PositiveInt } from "@opencode-ai/schema/schema"; | ||
| import { NonNegativeInt, PositiveInt, optional } from "@opencode-ai/schema/schema"; | ||
| import { Vcs } from "@opencode-ai/schema/vcs"; | ||
@@ -8,2 +8,3 @@ import { Schema } from "effect"; | ||
| import { LocationQuery, locationQueryOpenApi } from "./location.js"; | ||
| import { ServiceUnavailableError } from "../errors.js"; | ||
| const BranchesQuery = Schema.Struct({ | ||
@@ -17,2 +18,3 @@ ...LocationQuery.fields, | ||
| mode: Vcs.Mode, | ||
| base: optional(Schema.String), | ||
| context: Schema.NumberFromString.pipe(Schema.decodeTo(NonNegativeInt), Schema.optional), | ||
@@ -31,2 +33,13 @@ }); | ||
| }))) | ||
| .add(HttpApiEndpoint.get("vcs.base", "/api/vcs/base", { | ||
| query: LocationQuery, | ||
| success: Location.response(Schema.NullOr(Vcs.Base)), | ||
| error: ServiceUnavailableError, | ||
| }) | ||
| .annotateMerge(locationQueryOpenApi) | ||
| .annotateMerge(OpenApi.annotations({ | ||
| identifier: "v2.vcs.base", | ||
| summary: "VCS review base", | ||
| description: "Infer a local review base from named branch creation history, or the repository default only when currently on that branch. Returns null before the first commit or when the provider lacks base metadata; ambiguous Git history requires an explicit base on diff requests.", | ||
| }))) | ||
| .add(HttpApiEndpoint.get("vcs.status", "/api/vcs/status", { | ||
@@ -55,2 +68,3 @@ query: LocationQuery, | ||
| success: Location.response(Schema.Array(FileDiff.Info)), | ||
| error: ServiceUnavailableError, | ||
| }) | ||
@@ -61,3 +75,3 @@ .annotateMerge(locationQueryOpenApi) | ||
| summary: "VCS diff", | ||
| description: "Diff the working copy against HEAD (mode git) or the default-branch merge base (mode branch) for the requested location.", | ||
| description: "Diff HEAD to the working copy (working), the base merge-base to the working copy (branch), or the base merge-base to HEAD (committed). Omitting base preserves repository-default comparison; supplying it overrides the comparison without saving it.", | ||
| }))) | ||
@@ -64,0 +78,0 @@ .annotateMerge(OpenApi.annotations({ |
+2
-2
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "name": "@opencode-ai/protocol", | ||
| "version": "0.0.0-dev-18671", | ||
| "version": "0.0.0-dev-18672", | ||
| "type": "module", | ||
@@ -35,3 +35,3 @@ "license": "MIT", | ||
| "dependencies": { | ||
| "@opencode-ai/schema": "0.0.0-dev-18671", | ||
| "@opencode-ai/schema": "0.0.0-dev-18672", | ||
| "effect": "4.0.0-rc.112" | ||
@@ -38,0 +38,0 @@ }, |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
2087956
0.09%33497
0.08%+ Added
- Removed