@zyro-sec/protocol 1.0.1 → 1.0.3

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.
Files changed (61) hide show
  1. package/openapi.json +33222 -33222
  2. package/package.json +6 -2
  3. package/script/build.ts +9 -9
  4. package/script/generate-openapi.ts +25 -25
  5. package/script/openapi-parameters.ts +30 -30
  6. package/script/openapi-stabilize.ts +102 -102
  7. package/script/pack.ts +5 -5
  8. package/src/api.ts +264 -264
  9. package/src/client.ts +127 -127
  10. package/src/errors.ts +398 -398
  11. package/src/groups/agent.ts +39 -39
  12. package/src/groups/artifact.ts +103 -103
  13. package/src/groups/automation.ts +75 -75
  14. package/src/groups/blob.ts +20 -20
  15. package/src/groups/command.ts +27 -27
  16. package/src/groups/config.ts +46 -46
  17. package/src/groups/credential.ts +72 -72
  18. package/src/groups/debug.ts +68 -68
  19. package/src/groups/event.ts +86 -86
  20. package/src/groups/experimental.ts +19 -19
  21. package/src/groups/form.ts +26 -26
  22. package/src/groups/fs.ts +136 -136
  23. package/src/groups/generate.ts +120 -120
  24. package/src/groups/integration.ts +230 -230
  25. package/src/groups/job.ts +57 -57
  26. package/src/groups/location.ts +66 -66
  27. package/src/groups/machine.ts +120 -120
  28. package/src/groups/mcp.ts +167 -167
  29. package/src/groups/media.ts +23 -23
  30. package/src/groups/message.ts +124 -124
  31. package/src/groups/migration.ts +28 -28
  32. package/src/groups/model.ts +52 -52
  33. package/src/groups/permission.ts +164 -164
  34. package/src/groups/persistent-pty.ts +153 -153
  35. package/src/groups/plugin.ts +80 -80
  36. package/src/groups/project.ts +51 -51
  37. package/src/groups/provider.ts +45 -45
  38. package/src/groups/pty.ts +153 -153
  39. package/src/groups/push.ts +94 -94
  40. package/src/groups/reference.ts +42 -42
  41. package/src/groups/rpc.ts +30 -30
  42. package/src/groups/server.ts +80 -80
  43. package/src/groups/session.ts +918 -918
  44. package/src/groups/shell.ts +88 -88
  45. package/src/groups/skill.ts +46 -46
  46. package/src/groups/usage.ts +30 -30
  47. package/src/groups/vcs.ts +131 -131
  48. package/src/groups/voice.ts +96 -96
  49. package/src/groups/websearch.ts +46 -46
  50. package/src/groups/worktree.ts +78 -78
  51. package/src/middleware/authorization.ts +6 -6
  52. package/src/middleware/schema-error.ts +7 -7
  53. package/src/simulation.ts +691 -691
  54. package/tsconfig.build.json +11 -11
  55. package/tsconfig.json +14 -14
  56. package/test/event.test.ts +0 -34
  57. package/test/experimental-identifiers.test.ts +0 -24
  58. package/test/openapi-parameters.test.ts +0 -43
  59. package/test/openapi-patterns.test.ts +0 -28
  60. package/test/openapi-stabilize.test.ts +0 -161
  61. package/test/session-cursor.test.ts +0 -7
@@ -1,88 +1,88 @@
1
- import { Shell } from "@zyro-sec/schema/shell"
2
- import { Location } from "@zyro-sec/schema/location"
3
- import { Schema } from "effect"
4
- import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api"
5
- import { ShellNotFoundError } from "../errors.js"
6
- import { LocationQuery, locationQueryOpenApi } from "./location.js"
7
-
8
- export const ShellGroup = HttpApiGroup.make("server.shell")
9
- .add(
10
- HttpApiEndpoint.get("shell.list", "/api/shell", {
11
- query: LocationQuery,
12
- success: Location.response(Schema.Array(Shell.Info)),
13
- })
14
- .annotateMerge(locationQueryOpenApi)
15
- .annotateMerge(
16
- OpenApi.annotations({
17
- identifier: "shell.list",
18
- summary: "List running shell commands",
19
- description: "List currently running shell commands for a location. Exited commands are not included.",
20
- }),
21
- ),
22
- )
23
- .add(
24
- HttpApiEndpoint.post("shell.create", "/api/shell", {
25
- query: LocationQuery,
26
- payload: Shell.CreateInput,
27
- success: Location.response(Shell.Info),
28
- })
29
- .annotateMerge(locationQueryOpenApi)
30
- .annotateMerge(
31
- OpenApi.annotations({
32
- identifier: "shell.create",
33
- summary: "Run shell command",
34
- description:
35
- "Spawn one non-interactive shell command for a location. Combined stdout/stderr is captured to a file pageable via output.",
36
- }),
37
- ),
38
- )
39
- .add(
40
- HttpApiEndpoint.get("shell.get", "/api/shell/:id", {
41
- params: { id: Shell.ID },
42
- query: LocationQuery,
43
- success: Location.response(Shell.Info),
44
- error: ShellNotFoundError,
45
- })
46
- .annotateMerge(locationQueryOpenApi)
47
- .annotateMerge(
48
- OpenApi.annotations({
49
- identifier: "shell.get",
50
- summary: "Get shell command",
51
- description: "Get one shell command, including its status and exit code once exited.",
52
- }),
53
- ),
54
- )
55
- .add(
56
- HttpApiEndpoint.get("shell.output", "/api/shell/:id/output", {
57
- params: { id: Shell.ID },
58
- query: Schema.Struct({ ...LocationQuery.fields, ...Shell.OutputInput.fields }),
59
- success: Location.response(Shell.Output),
60
- error: ShellNotFoundError,
61
- })
62
- .annotateMerge(locationQueryOpenApi)
63
- .annotateMerge(
64
- OpenApi.annotations({
65
- identifier: "shell.output",
66
- summary: "Read shell output",
67
- description: "Page through captured combined output by absolute byte cursor.",
68
- }),
69
- ),
70
- )
71
- .add(
72
- HttpApiEndpoint.delete("shell.remove", "/api/shell/:id", {
73
- params: { id: Shell.ID },
74
- query: LocationQuery,
75
- success: HttpApiSchema.NoContent,
76
- })
77
- .annotateMerge(locationQueryOpenApi)
78
- .annotateMerge(
79
- OpenApi.annotations({
80
- identifier: "shell.remove",
81
- summary: "Remove shell command",
82
- description: "Terminate and remove one shell command and its retained output.",
83
- }),
84
- ),
85
- )
86
- .annotateMerge(
87
- OpenApi.annotations({ title: "shell", description: "Location-scoped shell command routes." }),
88
- )
1
+ import { Shell } from "@zyro-sec/schema/shell"
2
+ import { Location } from "@zyro-sec/schema/location"
3
+ import { Schema } from "effect"
4
+ import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api"
5
+ import { ShellNotFoundError } from "../errors.js"
6
+ import { LocationQuery, locationQueryOpenApi } from "./location.js"
7
+
8
+ export const ShellGroup = HttpApiGroup.make("server.shell")
9
+ .add(
10
+ HttpApiEndpoint.get("shell.list", "/api/shell", {
11
+ query: LocationQuery,
12
+ success: Location.response(Schema.Array(Shell.Info)),
13
+ })
14
+ .annotateMerge(locationQueryOpenApi)
15
+ .annotateMerge(
16
+ OpenApi.annotations({
17
+ identifier: "shell.list",
18
+ summary: "List running shell commands",
19
+ description: "List currently running shell commands for a location. Exited commands are not included.",
20
+ }),
21
+ ),
22
+ )
23
+ .add(
24
+ HttpApiEndpoint.post("shell.create", "/api/shell", {
25
+ query: LocationQuery,
26
+ payload: Shell.CreateInput,
27
+ success: Location.response(Shell.Info),
28
+ })
29
+ .annotateMerge(locationQueryOpenApi)
30
+ .annotateMerge(
31
+ OpenApi.annotations({
32
+ identifier: "shell.create",
33
+ summary: "Run shell command",
34
+ description:
35
+ "Spawn one non-interactive shell command for a location. Combined stdout/stderr is captured to a file pageable via output.",
36
+ }),
37
+ ),
38
+ )
39
+ .add(
40
+ HttpApiEndpoint.get("shell.get", "/api/shell/:id", {
41
+ params: { id: Shell.ID },
42
+ query: LocationQuery,
43
+ success: Location.response(Shell.Info),
44
+ error: ShellNotFoundError,
45
+ })
46
+ .annotateMerge(locationQueryOpenApi)
47
+ .annotateMerge(
48
+ OpenApi.annotations({
49
+ identifier: "shell.get",
50
+ summary: "Get shell command",
51
+ description: "Get one shell command, including its status and exit code once exited.",
52
+ }),
53
+ ),
54
+ )
55
+ .add(
56
+ HttpApiEndpoint.get("shell.output", "/api/shell/:id/output", {
57
+ params: { id: Shell.ID },
58
+ query: Schema.Struct({ ...LocationQuery.fields, ...Shell.OutputInput.fields }),
59
+ success: Location.response(Shell.Output),
60
+ error: ShellNotFoundError,
61
+ })
62
+ .annotateMerge(locationQueryOpenApi)
63
+ .annotateMerge(
64
+ OpenApi.annotations({
65
+ identifier: "shell.output",
66
+ summary: "Read shell output",
67
+ description: "Page through captured combined output by absolute byte cursor.",
68
+ }),
69
+ ),
70
+ )
71
+ .add(
72
+ HttpApiEndpoint.delete("shell.remove", "/api/shell/:id", {
73
+ params: { id: Shell.ID },
74
+ query: LocationQuery,
75
+ success: HttpApiSchema.NoContent,
76
+ })
77
+ .annotateMerge(locationQueryOpenApi)
78
+ .annotateMerge(
79
+ OpenApi.annotations({
80
+ identifier: "shell.remove",
81
+ summary: "Remove shell command",
82
+ description: "Terminate and remove one shell command and its retained output.",
83
+ }),
84
+ ),
85
+ )
86
+ .annotateMerge(
87
+ OpenApi.annotations({ title: "shell", description: "Location-scoped shell command routes." }),
88
+ )
@@ -1,46 +1,46 @@
1
- import { Skill } from "@zyro-sec/schema/skill"
2
- import { Location } from "@zyro-sec/schema/location"
3
- import { Schema } from "effect"
4
- import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api"
5
- import { FileNotFoundError, SkillLoadError, SkillNotFoundError } from "../errors.js"
6
- import { LocationQuery, locationQueryOpenApi } from "./location.js"
7
-
8
- export const SkillGroup = HttpApiGroup.make("server.skill")
9
- .add(
10
- HttpApiEndpoint.get("skill.list", "/api/skill", {
11
- query: LocationQuery,
12
- success: Location.response(Schema.Array(Skill.Info)),
13
- })
14
- .annotateMerge(locationQueryOpenApi)
15
- .annotateMerge(
16
- OpenApi.annotations({
17
- identifier: "skill.list",
18
- summary: "List skills",
19
- description: "Retrieve currently registered skills.",
20
- }),
21
- ),
22
- )
23
- .add(
24
- HttpApiEndpoint.get("skill.file", "/api/experimental/skill/:skillID/file/*", {
25
- params: { skillID: Skill.ID },
26
- query: LocationQuery,
27
- success: Schema.Uint8Array.pipe(HttpApiSchema.asUint8Array()),
28
- error: [SkillNotFoundError, FileNotFoundError, SkillLoadError],
29
- })
30
- .annotateMerge(locationQueryOpenApi)
31
- .annotateMerge(
32
- OpenApi.annotations({
33
- identifier: "experimental.skill.file",
34
- summary: "Read skill file",
35
- description:
36
- "Read one file of a skill, loading it when the skill serves it on demand. SKILL.md returns the body without frontmatter. Experimental: may change without compatibility guarantees.",
37
- transform: (operation) => ({ ...operation, tags: ["experimental"] }),
38
- }),
39
- ),
40
- )
41
- .annotateMerge(
42
- OpenApi.annotations({
43
- title: "skill",
44
- description: "Experimental skill routes.",
45
- }),
46
- )
1
+ import { Skill } from "@zyro-sec/schema/skill"
2
+ import { Location } from "@zyro-sec/schema/location"
3
+ import { Schema } from "effect"
4
+ import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api"
5
+ import { FileNotFoundError, SkillLoadError, SkillNotFoundError } from "../errors.js"
6
+ import { LocationQuery, locationQueryOpenApi } from "./location.js"
7
+
8
+ export const SkillGroup = HttpApiGroup.make("server.skill")
9
+ .add(
10
+ HttpApiEndpoint.get("skill.list", "/api/skill", {
11
+ query: LocationQuery,
12
+ success: Location.response(Schema.Array(Skill.Info)),
13
+ })
14
+ .annotateMerge(locationQueryOpenApi)
15
+ .annotateMerge(
16
+ OpenApi.annotations({
17
+ identifier: "skill.list",
18
+ summary: "List skills",
19
+ description: "Retrieve currently registered skills.",
20
+ }),
21
+ ),
22
+ )
23
+ .add(
24
+ HttpApiEndpoint.get("skill.file", "/api/experimental/skill/:skillID/file/*", {
25
+ params: { skillID: Skill.ID },
26
+ query: LocationQuery,
27
+ success: Schema.Uint8Array.pipe(HttpApiSchema.asUint8Array()),
28
+ error: [SkillNotFoundError, FileNotFoundError, SkillLoadError],
29
+ })
30
+ .annotateMerge(locationQueryOpenApi)
31
+ .annotateMerge(
32
+ OpenApi.annotations({
33
+ identifier: "experimental.skill.file",
34
+ summary: "Read skill file",
35
+ description:
36
+ "Read one file of a skill, loading it when the skill serves it on demand. SKILL.md returns the body without frontmatter. Experimental: may change without compatibility guarantees.",
37
+ transform: (operation) => ({ ...operation, tags: ["experimental"] }),
38
+ }),
39
+ ),
40
+ )
41
+ .annotateMerge(
42
+ OpenApi.annotations({
43
+ title: "skill",
44
+ description: "Experimental skill routes.",
45
+ }),
46
+ )
@@ -1,30 +1,30 @@
1
- import { Location } from "@zyro-sec/schema/location"
2
- import { UsageLimits } from "@zyro-sec/schema/usage-limits"
3
- import { Schema } from "effect"
4
- import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api"
5
- import { ServiceUnavailableError } from "../errors.js"
6
- import { LocationQuery, locationQueryOpenApi } from "./location.js"
7
-
8
- export const UsageGroup = HttpApiGroup.make("server.usage")
9
- .add(
10
- HttpApiEndpoint.get("usage.limits", "/api/experimental/usage/limits", {
11
- query: LocationQuery,
12
- success: Location.response(Schema.NullOr(UsageLimits.Info)),
13
- error: ServiceUnavailableError,
14
- })
15
- .annotateMerge(locationQueryOpenApi)
16
- .annotateMerge(
17
- OpenApi.annotations({
18
- identifier: "experimental.usage.limits",
19
- summary: "Get usage limits",
20
- description:
21
- "Return the OpenCode Go allowance and Console budgets of the OpenCode Console workspace the location is signed in to, or null when it isn't signed in.",
22
- }),
23
- ),
24
- )
25
- .annotateMerge(
26
- OpenApi.annotations({
27
- title: "usage",
28
- description: "Experimental usage limit routes.",
29
- }),
30
- )
1
+ import { Location } from "@zyro-sec/schema/location"
2
+ import { UsageLimits } from "@zyro-sec/schema/usage-limits"
3
+ import { Schema } from "effect"
4
+ import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api"
5
+ import { ServiceUnavailableError } from "../errors.js"
6
+ import { LocationQuery, locationQueryOpenApi } from "./location.js"
7
+
8
+ export const UsageGroup = HttpApiGroup.make("server.usage")
9
+ .add(
10
+ HttpApiEndpoint.get("usage.limits", "/api/experimental/usage/limits", {
11
+ query: LocationQuery,
12
+ success: Location.response(Schema.NullOr(UsageLimits.Info)),
13
+ error: ServiceUnavailableError,
14
+ })
15
+ .annotateMerge(locationQueryOpenApi)
16
+ .annotateMerge(
17
+ OpenApi.annotations({
18
+ identifier: "experimental.usage.limits",
19
+ summary: "Get usage limits",
20
+ description:
21
+ "Return the OpenCode Go allowance and Console budgets of the OpenCode Console workspace the location is signed in to, or null when it isn't signed in.",
22
+ }),
23
+ ),
24
+ )
25
+ .annotateMerge(
26
+ OpenApi.annotations({
27
+ title: "usage",
28
+ description: "Experimental usage limit routes.",
29
+ }),
30
+ )
package/src/groups/vcs.ts CHANGED
@@ -1,131 +1,131 @@
1
- import { FileDiff } from "@zyro-sec/schema/file-diff"
2
- import { Location } from "@zyro-sec/schema/location"
3
- import { NonNegativeInt, PositiveInt, optional } from "@zyro-sec/schema/schema"
4
- import { Vcs } from "@zyro-sec/schema/vcs"
5
- import { Schema } from "effect"
6
- import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api"
7
- import { LocationQuery, locationQueryOpenApi } from "./location.js"
8
- import { ConflictError, InvalidRequestError, ServiceUnavailableError } from "../errors.js"
9
-
10
- const InitQuery = Schema.Struct({
11
- ...LocationQuery.fields,
12
- provider: Schema.optional(Schema.String).annotateKey({ description: "VCS provider to initialize. Defaults to git." }),
13
- })
14
-
15
- export class VcsInitNotSupportedError extends Schema.TaggedError<VcsInitNotSupportedError>()(
16
- "VcsInitNotSupportedError",
17
- { providerID: Schema.String, message: Schema.String },
18
- { httpApiStatus: 501 },
19
- ) {}
20
-
21
- const BranchesQuery = Schema.Struct({
22
- ...LocationQuery.fields,
23
- search: Schema.optional(Schema.String),
24
- limit: Schema.NumberFromString.pipe(Schema.decodeTo(PositiveInt), Schema.optional),
25
- })
26
-
27
- const DiffQuery = Schema.Struct({
28
- ...LocationQuery.fields,
29
- mode: Vcs.Mode,
30
- base: optional(Schema.String),
31
- context: Schema.NumberFromString.pipe(Schema.decodeTo(NonNegativeInt), Schema.optional),
32
- untracked: optional(Vcs.Untracked),
33
- })
34
-
35
- export const VcsGroup = HttpApiGroup.make("server.vcs")
36
- .add(
37
- HttpApiEndpoint.post("vcs.init", "/api/vcs/init", {
38
- query: InitQuery,
39
- success: HttpApiSchema.NoContent,
40
- error: [ConflictError, InvalidRequestError, VcsInitNotSupportedError, ServiceUnavailableError],
41
- })
42
- .annotateMerge(locationQueryOpenApi)
43
- .annotateMerge(
44
- OpenApi.annotations({
45
- identifier: "vcs.init",
46
- summary: "Initialize VCS repository",
47
- description:
48
- "Initialize a repository using the selected VCS provider in a markerless project's directory and refresh its location services. Omitting provider defaults to git; built-in git and hg providers support initialization. An unknown provider returns 400; a registered provider without init returns 501.",
49
- }),
50
- ),
51
- )
52
- .add(
53
- HttpApiEndpoint.get("vcs.get", "/api/vcs", {
54
- query: LocationQuery,
55
- success: Location.response(Vcs.Info),
56
- })
57
- .annotateMerge(locationQueryOpenApi)
58
- .annotateMerge(
59
- OpenApi.annotations({
60
- identifier: "vcs.get",
61
- summary: "VCS info",
62
- description: "Get current and default branch information for the requested location.",
63
- }),
64
- ),
65
- )
66
- .add(
67
- HttpApiEndpoint.get("vcs.base", "/api/vcs/base", {
68
- query: LocationQuery,
69
- success: Location.response(Schema.NullOr(Vcs.Base)),
70
- error: ServiceUnavailableError,
71
- })
72
- .annotateMerge(locationQueryOpenApi)
73
- .annotateMerge(
74
- OpenApi.annotations({
75
- identifier: "vcs.base",
76
- summary: "VCS review base",
77
- description:
78
- "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.",
79
- }),
80
- ),
81
- )
82
- .add(
83
- HttpApiEndpoint.get("vcs.status", "/api/vcs/status", {
84
- query: LocationQuery,
85
- success: Location.response(Schema.Array(Vcs.FileStatus)),
86
- })
87
- .annotateMerge(locationQueryOpenApi)
88
- .annotateMerge(
89
- OpenApi.annotations({
90
- identifier: "vcs.status",
91
- summary: "VCS status",
92
- description: "List uncommitted working-copy changes relative to the requested location.",
93
- }),
94
- ),
95
- )
96
- .add(
97
- HttpApiEndpoint.get("vcs.branch.list", "/api/vcs/branch", {
98
- query: BranchesQuery,
99
- success: Location.response(Vcs.BranchList),
100
- })
101
- .annotateMerge(locationQueryOpenApi)
102
- .annotateMerge(
103
- OpenApi.annotations({
104
- identifier: "vcs.branch.list",
105
- summary: "VCS branches",
106
- description: "List local and remote branches available at the requested location.",
107
- }),
108
- ),
109
- )
110
- .add(
111
- HttpApiEndpoint.get("vcs.diff", "/api/vcs/diff", {
112
- query: DiffQuery,
113
- success: Location.response(Schema.Array(FileDiff.Info)),
114
- error: ServiceUnavailableError,
115
- })
116
- .annotateMerge(locationQueryOpenApi)
117
- .annotateMerge(
118
- OpenApi.annotations({
119
- identifier: "vcs.diff",
120
- summary: "VCS diff",
121
- description:
122
- "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.",
123
- }),
124
- ),
125
- )
126
- .annotateMerge(
127
- OpenApi.annotations({
128
- title: "vcs",
129
- description: "Location-scoped version control routes.",
130
- }),
131
- )
1
+ import { FileDiff } from "@zyro-sec/schema/file-diff"
2
+ import { Location } from "@zyro-sec/schema/location"
3
+ import { NonNegativeInt, PositiveInt, optional } from "@zyro-sec/schema/schema"
4
+ import { Vcs } from "@zyro-sec/schema/vcs"
5
+ import { Schema } from "effect"
6
+ import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api"
7
+ import { LocationQuery, locationQueryOpenApi } from "./location.js"
8
+ import { ConflictError, InvalidRequestError, ServiceUnavailableError } from "../errors.js"
9
+
10
+ const InitQuery = Schema.Struct({
11
+ ...LocationQuery.fields,
12
+ provider: Schema.optional(Schema.String).annotateKey({ description: "VCS provider to initialize. Defaults to git." }),
13
+ })
14
+
15
+ export class VcsInitNotSupportedError extends Schema.TaggedError<VcsInitNotSupportedError>()(
16
+ "VcsInitNotSupportedError",
17
+ { providerID: Schema.String, message: Schema.String },
18
+ { httpApiStatus: 501 },
19
+ ) {}
20
+
21
+ const BranchesQuery = Schema.Struct({
22
+ ...LocationQuery.fields,
23
+ search: Schema.optional(Schema.String),
24
+ limit: Schema.NumberFromString.pipe(Schema.decodeTo(PositiveInt), Schema.optional),
25
+ })
26
+
27
+ const DiffQuery = Schema.Struct({
28
+ ...LocationQuery.fields,
29
+ mode: Vcs.Mode,
30
+ base: optional(Schema.String),
31
+ context: Schema.NumberFromString.pipe(Schema.decodeTo(NonNegativeInt), Schema.optional),
32
+ untracked: optional(Vcs.Untracked),
33
+ })
34
+
35
+ export const VcsGroup = HttpApiGroup.make("server.vcs")
36
+ .add(
37
+ HttpApiEndpoint.post("vcs.init", "/api/vcs/init", {
38
+ query: InitQuery,
39
+ success: HttpApiSchema.NoContent,
40
+ error: [ConflictError, InvalidRequestError, VcsInitNotSupportedError, ServiceUnavailableError],
41
+ })
42
+ .annotateMerge(locationQueryOpenApi)
43
+ .annotateMerge(
44
+ OpenApi.annotations({
45
+ identifier: "vcs.init",
46
+ summary: "Initialize VCS repository",
47
+ description:
48
+ "Initialize a repository using the selected VCS provider in a markerless project's directory and refresh its location services. Omitting provider defaults to git; built-in git and hg providers support initialization. An unknown provider returns 400; a registered provider without init returns 501.",
49
+ }),
50
+ ),
51
+ )
52
+ .add(
53
+ HttpApiEndpoint.get("vcs.get", "/api/vcs", {
54
+ query: LocationQuery,
55
+ success: Location.response(Vcs.Info),
56
+ })
57
+ .annotateMerge(locationQueryOpenApi)
58
+ .annotateMerge(
59
+ OpenApi.annotations({
60
+ identifier: "vcs.get",
61
+ summary: "VCS info",
62
+ description: "Get current and default branch information for the requested location.",
63
+ }),
64
+ ),
65
+ )
66
+ .add(
67
+ HttpApiEndpoint.get("vcs.base", "/api/vcs/base", {
68
+ query: LocationQuery,
69
+ success: Location.response(Schema.NullOr(Vcs.Base)),
70
+ error: ServiceUnavailableError,
71
+ })
72
+ .annotateMerge(locationQueryOpenApi)
73
+ .annotateMerge(
74
+ OpenApi.annotations({
75
+ identifier: "vcs.base",
76
+ summary: "VCS review base",
77
+ description:
78
+ "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.",
79
+ }),
80
+ ),
81
+ )
82
+ .add(
83
+ HttpApiEndpoint.get("vcs.status", "/api/vcs/status", {
84
+ query: LocationQuery,
85
+ success: Location.response(Schema.Array(Vcs.FileStatus)),
86
+ })
87
+ .annotateMerge(locationQueryOpenApi)
88
+ .annotateMerge(
89
+ OpenApi.annotations({
90
+ identifier: "vcs.status",
91
+ summary: "VCS status",
92
+ description: "List uncommitted working-copy changes relative to the requested location.",
93
+ }),
94
+ ),
95
+ )
96
+ .add(
97
+ HttpApiEndpoint.get("vcs.branch.list", "/api/vcs/branch", {
98
+ query: BranchesQuery,
99
+ success: Location.response(Vcs.BranchList),
100
+ })
101
+ .annotateMerge(locationQueryOpenApi)
102
+ .annotateMerge(
103
+ OpenApi.annotations({
104
+ identifier: "vcs.branch.list",
105
+ summary: "VCS branches",
106
+ description: "List local and remote branches available at the requested location.",
107
+ }),
108
+ ),
109
+ )
110
+ .add(
111
+ HttpApiEndpoint.get("vcs.diff", "/api/vcs/diff", {
112
+ query: DiffQuery,
113
+ success: Location.response(Schema.Array(FileDiff.Info)),
114
+ error: ServiceUnavailableError,
115
+ })
116
+ .annotateMerge(locationQueryOpenApi)
117
+ .annotateMerge(
118
+ OpenApi.annotations({
119
+ identifier: "vcs.diff",
120
+ summary: "VCS diff",
121
+ description:
122
+ "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.",
123
+ }),
124
+ ),
125
+ )
126
+ .annotateMerge(
127
+ OpenApi.annotations({
128
+ title: "vcs",
129
+ description: "Location-scoped version control routes.",
130
+ }),
131
+ )