@opencode-ai/protocol 0.0.0-dev-18671 → 0.0.0-dev-18672

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.
@@ -1,6 +1,7 @@
1
1
  import { Location } from "@opencode-ai/schema/location";
2
2
  import { Schema } from "effect";
3
3
  import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
4
+ import { ServiceUnavailableError } from "../errors.js";
4
5
  export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEndpoint.HttpApiEndpoint<"vcs.get", "GET", "/api/vcs", never, Schema.toCodecStringTree<Schema.Struct<{
5
6
  readonly location: Schema.optional<Schema.Struct<{
6
7
  readonly directory: Schema.optional<Schema.String>;
@@ -14,7 +15,19 @@ export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEn
14
15
  readonly default: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
15
16
  }>;
16
17
  }>;
17
- }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.status", "GET", "/api/vcs/status", never, Schema.toCodecStringTree<Schema.Struct<{
18
+ }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.base", "GET", "/api/vcs/base", never, Schema.toCodecStringTree<Schema.Struct<{
19
+ readonly location: Schema.optional<Schema.Struct<{
20
+ readonly directory: Schema.optional<Schema.String>;
21
+ readonly workspace: Schema.optional<Schema.String>;
22
+ }>>;
23
+ }>>, never, never, Schema.toCodecJson<Schema.Struct<{
24
+ readonly location: typeof Location.Info;
25
+ readonly data: Schema.NullOr<Schema.Struct<{
26
+ readonly name: Schema.String;
27
+ readonly ref: Schema.String;
28
+ readonly source: Schema.Literals<readonly ["reflog", "default"]>;
29
+ }>>;
30
+ }>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.status", "GET", "/api/vcs/status", never, Schema.toCodecStringTree<Schema.Struct<{
18
31
  readonly location: Schema.optional<Schema.Struct<{
19
32
  readonly directory: Schema.optional<Schema.String>;
20
33
  readonly workspace: Schema.optional<Schema.String>;
@@ -38,7 +51,8 @@ export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEn
38
51
  readonly location: typeof Location.Info;
39
52
  readonly data: Schema.$Array<Schema.String>;
40
53
  }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.diff", "GET", "/api/vcs/diff", never, Schema.toCodecStringTree<Schema.Struct<{
41
- readonly mode: Schema.Literals<readonly ["working", "branch"]>;
54
+ readonly mode: Schema.Literals<readonly ["working", "branch", "committed"]>;
55
+ readonly base: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
42
56
  readonly context: Schema.optional<Schema.compose<Schema.Int, Schema.NumberFromString>>;
43
57
  readonly location: Schema.optional<Schema.Struct<{
44
58
  readonly directory: Schema.optional<Schema.String>;
@@ -53,4 +67,4 @@ export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEn
53
67
  readonly deletions: Schema.Int;
54
68
  readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
55
69
  }>>;
56
- }>>, never, never, never>, false>;
70
+ }>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never>, false>;
@@ -1,10 +1,11 @@
1
1
  import { FileDiff } from "@opencode-ai/schema/file-diff";
2
2
  import { Location } from "@opencode-ai/schema/location";
3
- import { NonNegativeInt, PositiveInt } from "@opencode-ai/schema/schema";
3
+ import { NonNegativeInt, PositiveInt, optional } from "@opencode-ai/schema/schema";
4
4
  import { Vcs } from "@opencode-ai/schema/vcs";
5
5
  import { Schema } from "effect";
6
6
  import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
7
7
  import { LocationQuery, locationQueryOpenApi } from "./location.js";
8
+ import { ServiceUnavailableError } from "../errors.js";
8
9
  const BranchesQuery = Schema.Struct({
9
10
  ...LocationQuery.fields,
10
11
  search: Schema.optional(Schema.String),
@@ -13,6 +14,7 @@ const BranchesQuery = Schema.Struct({
13
14
  const DiffQuery = Schema.Struct({
14
15
  ...LocationQuery.fields,
15
16
  mode: Vcs.Mode,
17
+ base: optional(Schema.String),
16
18
  context: Schema.NumberFromString.pipe(Schema.decodeTo(NonNegativeInt), Schema.optional),
17
19
  });
18
20
  export const VcsGroup = HttpApiGroup.make("server.vcs")
@@ -25,6 +27,17 @@ export const VcsGroup = HttpApiGroup.make("server.vcs")
25
27
  identifier: "v2.vcs.get",
26
28
  summary: "VCS info",
27
29
  description: "Get current and default branch information for the requested location.",
30
+ })))
31
+ .add(HttpApiEndpoint.get("vcs.base", "/api/vcs/base", {
32
+ query: LocationQuery,
33
+ success: Location.response(Schema.NullOr(Vcs.Base)),
34
+ error: ServiceUnavailableError,
35
+ })
36
+ .annotateMerge(locationQueryOpenApi)
37
+ .annotateMerge(OpenApi.annotations({
38
+ identifier: "v2.vcs.base",
39
+ summary: "VCS review base",
40
+ 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.",
28
41
  })))
29
42
  .add(HttpApiEndpoint.get("vcs.status", "/api/vcs/status", {
30
43
  query: LocationQuery,
@@ -49,12 +62,13 @@ export const VcsGroup = HttpApiGroup.make("server.vcs")
49
62
  .add(HttpApiEndpoint.get("vcs.diff", "/api/vcs/diff", {
50
63
  query: DiffQuery,
51
64
  success: Location.response(Schema.Array(FileDiff.Info)),
65
+ error: ServiceUnavailableError,
52
66
  })
53
67
  .annotateMerge(locationQueryOpenApi)
54
68
  .annotateMerge(OpenApi.annotations({
55
69
  identifier: "v2.vcs.diff",
56
70
  summary: "VCS diff",
57
- description: "Diff the working copy against HEAD (mode git) or the default-branch merge base (mode branch) for the requested location.",
71
+ 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.",
58
72
  })))
59
73
  .annotateMerge(OpenApi.annotations({
60
74
  title: "vcs",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode-ai/protocol",
4
- "version": "0.0.0-dev-18671",
4
+ "version": "0.0.0-dev-18672",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -32,7 +32,7 @@
32
32
  "typecheck": "tsgo --noEmit"
33
33
  },
34
34
  "dependencies": {
35
- "@opencode-ai/schema": "0.0.0-dev-18671",
35
+ "@opencode-ai/schema": "0.0.0-dev-18672",
36
36
  "effect": "4.0.0-rc.112"
37
37
  },
38
38
  "devDependencies": {