@opencode/protocol 2.0.2 → 2.0.4

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 (69) hide show
  1. package/dist/api.d.ts +4 -6
  2. package/dist/api.js +4 -8
  3. package/dist/client.d.ts +0 -2
  4. package/dist/client.js +0 -2
  5. package/dist/errors.d.ts +20 -0
  6. package/dist/errors.js +17 -0
  7. package/dist/groups/agent.d.ts +6 -5
  8. package/dist/groups/agent.js +2 -2
  9. package/dist/groups/command.d.ts +3 -3
  10. package/dist/groups/command.js +1 -1
  11. package/dist/groups/config.d.ts +5 -13
  12. package/dist/groups/config.js +11 -18
  13. package/dist/groups/credential.d.ts +3 -18
  14. package/dist/groups/credential.js +3 -10
  15. package/dist/groups/debug.d.ts +0 -8
  16. package/dist/groups/debug.js +3 -3
  17. package/dist/groups/event.d.ts +99 -74
  18. package/dist/groups/event.js +3 -3
  19. package/dist/groups/form.d.ts +6 -654
  20. package/dist/groups/form.js +6 -83
  21. package/dist/groups/fs.d.ts +6 -6
  22. package/dist/groups/fs.js +3 -3
  23. package/dist/groups/generate.d.ts +1 -1
  24. package/dist/groups/generate.js +2 -2
  25. package/dist/groups/integration.d.ts +27 -27
  26. package/dist/groups/integration.js +19 -16
  27. package/dist/groups/location.d.ts +10 -4
  28. package/dist/groups/location.js +2 -3
  29. package/dist/groups/mcp.d.ts +11 -13
  30. package/dist/groups/mcp.js +10 -10
  31. package/dist/groups/message.d.ts +710 -41
  32. package/dist/groups/message.js +26 -3
  33. package/dist/groups/migration.js +1 -1
  34. package/dist/groups/model.d.ts +12 -9
  35. package/dist/groups/model.js +2 -2
  36. package/dist/groups/permission.d.ts +9 -16
  37. package/dist/groups/permission.js +8 -20
  38. package/dist/groups/persistent-pty.js +1 -1
  39. package/dist/groups/plugin.d.ts +7 -12
  40. package/dist/groups/plugin.js +3 -13
  41. package/dist/groups/project.d.ts +1 -14
  42. package/dist/groups/project.js +2 -13
  43. package/dist/groups/provider.d.ts +8 -7
  44. package/dist/groups/provider.js +2 -2
  45. package/dist/groups/pty.d.ts +15 -12
  46. package/dist/groups/pty.js +8 -8
  47. package/dist/groups/reference.d.ts +8 -12
  48. package/dist/groups/reference.js +16 -3
  49. package/dist/groups/rpc.d.ts +0 -1
  50. package/dist/groups/rpc.js +1 -1
  51. package/dist/groups/server.d.ts +9 -1
  52. package/dist/groups/server.js +11 -5
  53. package/dist/groups/session.d.ts +1146 -787
  54. package/dist/groups/session.js +192 -93
  55. package/dist/groups/shell.d.ts +13 -43
  56. package/dist/groups/shell.js +6 -24
  57. package/dist/groups/skill.d.ts +4 -5
  58. package/dist/groups/skill.js +1 -1
  59. package/dist/groups/vcs.d.ts +17 -12
  60. package/dist/groups/vcs.js +6 -6
  61. package/dist/groups/websearch.d.ts +6 -5
  62. package/dist/groups/websearch.js +2 -2
  63. package/dist/groups/worktree.d.ts +17 -23
  64. package/dist/groups/worktree.js +21 -30
  65. package/package.json +2 -2
  66. package/dist/groups/health.d.ts +0 -15
  67. package/dist/groups/health.js +0 -20
  68. package/dist/groups/workspace.d.ts +0 -22
  69. package/dist/groups/workspace.js +0 -27
@@ -1,14 +1,14 @@
1
- import { Location } from "@opencode/schema/location";
2
1
  import { Schema } from "effect";
3
2
  import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
4
3
  import { ShellNotFoundError } from "../errors.js";
5
4
  export declare const ShellGroup: HttpApiGroup.HttpApiGroup<"server.shell", HttpApiEndpoint.HttpApiEndpoint<"shell.list", "GET", "/api/shell", never, Schema.toCodecStringTree<Schema.Struct<{
6
5
  readonly location: Schema.optional<Schema.Struct<{
7
6
  readonly directory: Schema.optional<Schema.String>;
8
- readonly workspace: Schema.optional<Schema.String>;
9
7
  }>>;
10
8
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
11
- readonly location: typeof Location.Info;
9
+ readonly location: Schema.Struct<{
10
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
11
+ }>;
12
12
  readonly data: Schema.$Array<Schema.Struct<{
13
13
  readonly id: Schema.brand<Schema.String, "Shell.ID"> & {
14
14
  create: () => string & import("effect/Brand").Brand<"Shell.ID">;
@@ -30,15 +30,16 @@ export declare const ShellGroup: HttpApiGroup.HttpApiGroup<"server.shell", HttpA
30
30
  }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"shell.create", "POST", "/api/shell", never, Schema.toCodecStringTree<Schema.Struct<{
31
31
  readonly location: Schema.optional<Schema.Struct<{
32
32
  readonly directory: Schema.optional<Schema.String>;
33
- readonly workspace: Schema.optional<Schema.String>;
34
33
  }>>;
35
34
  }>>, Schema.toCodecJson<Schema.Struct<{
36
35
  readonly command: Schema.String;
37
36
  readonly cwd: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
38
- readonly timeout: Schema.Int;
37
+ readonly timeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
39
38
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
40
39
  }>>, never, Schema.toCodecJson<Schema.Struct<{
41
- readonly location: typeof Location.Info;
40
+ readonly location: Schema.Struct<{
41
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
42
+ }>;
42
43
  readonly data: Schema.Struct<{
43
44
  readonly id: Schema.brand<Schema.String, "Shell.ID"> & {
44
45
  create: () => string & import("effect/Brand").Brand<"Shell.ID">;
@@ -65,42 +66,11 @@ export declare const ShellGroup: HttpApiGroup.HttpApiGroup<"server.shell", HttpA
65
66
  }>>, Schema.toCodecStringTree<Schema.Struct<{
66
67
  readonly location: Schema.optional<Schema.Struct<{
67
68
  readonly directory: Schema.optional<Schema.String>;
68
- readonly workspace: Schema.optional<Schema.String>;
69
69
  }>>;
70
70
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
71
- readonly location: typeof Location.Info;
72
- readonly data: Schema.Struct<{
73
- readonly id: Schema.brand<Schema.String, "Shell.ID"> & {
74
- create: () => string & import("effect/Brand").Brand<"Shell.ID">;
75
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Shell.ID">;
76
- };
77
- readonly status: Schema.Literals<readonly ["running", "exited", "timeout", "killed"]>;
78
- readonly command: Schema.String;
79
- readonly cwd: Schema.String;
80
- readonly shell: Schema.String;
81
- readonly file: Schema.String;
82
- readonly pid: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
83
- readonly exit: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
84
- readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
85
- readonly time: Schema.Struct<{
86
- readonly started: Schema.Finite;
87
- readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
88
- }>;
71
+ readonly location: Schema.Struct<{
72
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
89
73
  }>;
90
- }>>, Schema.toCodecJson<typeof ShellNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"shell.timeout", "PATCH", "/api/shell/:id/timeout", Schema.toCodecStringTree<Schema.Struct<{
91
- id: Schema.brand<Schema.String, "Shell.ID"> & {
92
- create: () => string & import("effect/Brand").Brand<"Shell.ID">;
93
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Shell.ID">;
94
- };
95
- }>>, Schema.toCodecStringTree<Schema.Struct<{
96
- readonly location: Schema.optional<Schema.Struct<{
97
- readonly directory: Schema.optional<Schema.String>;
98
- readonly workspace: Schema.optional<Schema.String>;
99
- }>>;
100
- }>>, Schema.toCodecJson<Schema.Struct<{
101
- readonly timeout: Schema.Int;
102
- }>>, never, Schema.toCodecJson<Schema.Struct<{
103
- readonly location: typeof Location.Info;
104
74
  readonly data: Schema.Struct<{
105
75
  readonly id: Schema.brand<Schema.String, "Shell.ID"> & {
106
76
  create: () => string & import("effect/Brand").Brand<"Shell.ID">;
@@ -129,10 +99,11 @@ export declare const ShellGroup: HttpApiGroup.HttpApiGroup<"server.shell", HttpA
129
99
  readonly limit: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
130
100
  readonly location: Schema.optional<Schema.Struct<{
131
101
  readonly directory: Schema.optional<Schema.String>;
132
- readonly workspace: Schema.optional<Schema.String>;
133
102
  }>>;
134
103
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
135
- readonly location: typeof Location.Info;
104
+ readonly location: Schema.Struct<{
105
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
106
+ }>;
136
107
  readonly data: Schema.Struct<{
137
108
  readonly output: Schema.String;
138
109
  readonly cursor: Schema.Int;
@@ -147,6 +118,5 @@ export declare const ShellGroup: HttpApiGroup.HttpApiGroup<"server.shell", HttpA
147
118
  }>>, Schema.toCodecStringTree<Schema.Struct<{
148
119
  readonly location: Schema.optional<Schema.Struct<{
149
120
  readonly directory: Schema.optional<Schema.String>;
150
- readonly workspace: Schema.optional<Schema.String>;
151
121
  }>>;
152
- }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof ShellNotFoundError>, never, never>, false>;
122
+ }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, never, never, never>, false>;
@@ -1,13 +1,9 @@
1
1
  import { Shell } from "@opencode/schema/shell";
2
2
  import { Location } from "@opencode/schema/location";
3
- import { NonNegativeInt } from "@opencode/schema/schema";
4
3
  import { Schema } from "effect";
5
4
  import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
6
5
  import { ShellNotFoundError } from "../errors.js";
7
6
  import { LocationQuery, locationQueryOpenApi } from "./location.js";
8
- const TimeoutInput = Schema.Struct({
9
- timeout: NonNegativeInt,
10
- });
11
7
  export const ShellGroup = HttpApiGroup.make("server.shell")
12
8
  .add(HttpApiEndpoint.get("shell.list", "/api/shell", {
13
9
  query: LocationQuery,
@@ -15,7 +11,7 @@ export const ShellGroup = HttpApiGroup.make("server.shell")
15
11
  })
16
12
  .annotateMerge(locationQueryOpenApi)
17
13
  .annotateMerge(OpenApi.annotations({
18
- identifier: "v2.shell.list",
14
+ identifier: "shell.list",
19
15
  summary: "List running shell commands",
20
16
  description: "List currently running shell commands for a location. Exited commands are not included.",
21
17
  })))
@@ -26,7 +22,7 @@ export const ShellGroup = HttpApiGroup.make("server.shell")
26
22
  })
27
23
  .annotateMerge(locationQueryOpenApi)
28
24
  .annotateMerge(OpenApi.annotations({
29
- identifier: "v2.shell.create",
25
+ identifier: "shell.create",
30
26
  summary: "Run shell command",
31
27
  description: "Spawn one non-interactive shell command for a location. Combined stdout/stderr is captured to a file pageable via output.",
32
28
  })))
@@ -38,22 +34,9 @@ export const ShellGroup = HttpApiGroup.make("server.shell")
38
34
  })
39
35
  .annotateMerge(locationQueryOpenApi)
40
36
  .annotateMerge(OpenApi.annotations({
41
- identifier: "v2.shell.get",
37
+ identifier: "shell.get",
42
38
  summary: "Get shell command",
43
39
  description: "Get one shell command, including its status and exit code once exited.",
44
- })))
45
- .add(HttpApiEndpoint.patch("shell.timeout", "/api/shell/:id/timeout", {
46
- params: { id: Shell.ID },
47
- query: LocationQuery,
48
- payload: TimeoutInput,
49
- success: Location.response(Shell.Info),
50
- error: ShellNotFoundError,
51
- })
52
- .annotateMerge(locationQueryOpenApi)
53
- .annotateMerge(OpenApi.annotations({
54
- identifier: "v2.shell.timeout",
55
- summary: "Update shell timeout",
56
- description: "Replace a running shell command's timeout from now, or clear it with zero.",
57
40
  })))
58
41
  .add(HttpApiEndpoint.get("shell.output", "/api/shell/:id/output", {
59
42
  params: { id: Shell.ID },
@@ -63,7 +46,7 @@ export const ShellGroup = HttpApiGroup.make("server.shell")
63
46
  })
64
47
  .annotateMerge(locationQueryOpenApi)
65
48
  .annotateMerge(OpenApi.annotations({
66
- identifier: "v2.shell.output",
49
+ identifier: "shell.output",
67
50
  summary: "Read shell output",
68
51
  description: "Page through captured combined output by absolute byte cursor.",
69
52
  })))
@@ -71,12 +54,11 @@ export const ShellGroup = HttpApiGroup.make("server.shell")
71
54
  params: { id: Shell.ID },
72
55
  query: LocationQuery,
73
56
  success: HttpApiSchema.NoContent,
74
- error: ShellNotFoundError,
75
57
  })
76
58
  .annotateMerge(locationQueryOpenApi)
77
59
  .annotateMerge(OpenApi.annotations({
78
- identifier: "v2.shell.remove",
60
+ identifier: "shell.remove",
79
61
  summary: "Remove shell command",
80
62
  description: "Terminate and remove one shell command and its retained output.",
81
63
  })))
82
- .annotateMerge(OpenApi.annotations({ title: "shell", description: "Experimental location-scoped shell command routes." }));
64
+ .annotateMerge(OpenApi.annotations({ title: "shell", description: "Location-scoped shell command routes." }));
@@ -1,20 +1,19 @@
1
- import { Location } from "@opencode/schema/location";
2
1
  import { Schema } from "effect";
3
2
  import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
4
3
  export declare const SkillGroup: HttpApiGroup.HttpApiGroup<"server.skill", HttpApiEndpoint.HttpApiEndpoint<"skill.list", "GET", "/api/skill", never, Schema.toCodecStringTree<Schema.Struct<{
5
4
  readonly location: Schema.optional<Schema.Struct<{
6
5
  readonly directory: Schema.optional<Schema.String>;
7
- readonly workspace: Schema.optional<Schema.String>;
8
6
  }>>;
9
7
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
10
- readonly location: typeof Location.Info;
8
+ readonly location: Schema.Struct<{
9
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
10
+ }>;
11
11
  readonly data: Schema.$Array<Schema.Struct<{
12
12
  readonly id: Schema.brand<Schema.String, "Skill.ID">;
13
13
  readonly name: Schema.brand<Schema.String, "Skill.Name">;
14
14
  readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
15
- readonly slash: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
16
15
  readonly autoinvoke: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
17
- readonly location: Schema.brand<Schema.String, "AbsolutePath">;
16
+ readonly path: Schema.brand<Schema.String, "AbsolutePath">;
18
17
  readonly content: Schema.String;
19
18
  }>>;
20
19
  }>>, never, never, never>, false>;
@@ -10,7 +10,7 @@ export const SkillGroup = HttpApiGroup.make("server.skill")
10
10
  })
11
11
  .annotateMerge(locationQueryOpenApi)
12
12
  .annotateMerge(OpenApi.annotations({
13
- identifier: "v2.skill.list",
13
+ identifier: "skill.list",
14
14
  summary: "List skills",
15
15
  description: "Retrieve currently registered skills.",
16
16
  })))
@@ -1,15 +1,16 @@
1
- import { Location } from "@opencode/schema/location";
2
1
  import { Schema } from "effect";
3
2
  import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
4
3
  import { ServiceUnavailableError } from "../errors.js";
5
4
  export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEndpoint.HttpApiEndpoint<"vcs.get", "GET", "/api/vcs", never, Schema.toCodecStringTree<Schema.Struct<{
6
5
  readonly location: Schema.optional<Schema.Struct<{
7
6
  readonly directory: Schema.optional<Schema.String>;
8
- readonly workspace: Schema.optional<Schema.String>;
9
7
  }>>;
10
8
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
11
- readonly location: typeof Location.Info;
9
+ readonly location: Schema.Struct<{
10
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
11
+ }>;
12
12
  readonly data: Schema.Struct<{
13
+ readonly provider: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
13
14
  readonly branch: Schema.Struct<{
14
15
  readonly current: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
15
16
  readonly default: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
@@ -18,10 +19,11 @@ export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEn
18
19
  }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.base", "GET", "/api/vcs/base", never, Schema.toCodecStringTree<Schema.Struct<{
19
20
  readonly location: Schema.optional<Schema.Struct<{
20
21
  readonly directory: Schema.optional<Schema.String>;
21
- readonly workspace: Schema.optional<Schema.String>;
22
22
  }>>;
23
23
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
24
- readonly location: typeof Location.Info;
24
+ readonly location: Schema.Struct<{
25
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
26
+ }>;
25
27
  readonly data: Schema.NullOr<Schema.Struct<{
26
28
  readonly name: Schema.String;
27
29
  readonly ref: Schema.String;
@@ -30,25 +32,27 @@ export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEn
30
32
  }>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.status", "GET", "/api/vcs/status", never, Schema.toCodecStringTree<Schema.Struct<{
31
33
  readonly location: Schema.optional<Schema.Struct<{
32
34
  readonly directory: Schema.optional<Schema.String>;
33
- readonly workspace: Schema.optional<Schema.String>;
34
35
  }>>;
35
36
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
36
- readonly location: typeof Location.Info;
37
+ readonly location: Schema.Struct<{
38
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
39
+ }>;
37
40
  readonly data: Schema.$Array<Schema.Struct<{
38
41
  readonly file: Schema.String;
39
42
  readonly additions: Schema.Int;
40
43
  readonly deletions: Schema.Int;
41
44
  readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
42
45
  }>>;
43
- }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.branches", "GET", "/api/vcs/branches", never, Schema.toCodecStringTree<Schema.Struct<{
46
+ }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.branch.list", "GET", "/api/vcs/branch", never, Schema.toCodecStringTree<Schema.Struct<{
44
47
  readonly search: Schema.optional<Schema.String>;
45
48
  readonly limit: Schema.optional<Schema.compose<Schema.Int, Schema.NumberFromString>>;
46
49
  readonly location: Schema.optional<Schema.Struct<{
47
50
  readonly directory: Schema.optional<Schema.String>;
48
- readonly workspace: Schema.optional<Schema.String>;
49
51
  }>>;
50
52
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
51
- readonly location: typeof Location.Info;
53
+ readonly location: Schema.Struct<{
54
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
55
+ }>;
52
56
  readonly data: Schema.$Array<Schema.String>;
53
57
  }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.diff", "GET", "/api/vcs/diff", never, Schema.toCodecStringTree<Schema.Struct<{
54
58
  readonly mode: Schema.Literals<readonly ["working", "branch", "committed"]>;
@@ -56,10 +60,11 @@ export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEn
56
60
  readonly context: Schema.optional<Schema.compose<Schema.Int, Schema.NumberFromString>>;
57
61
  readonly location: Schema.optional<Schema.Struct<{
58
62
  readonly directory: Schema.optional<Schema.String>;
59
- readonly workspace: Schema.optional<Schema.String>;
60
63
  }>>;
61
64
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
62
- readonly location: typeof Location.Info;
65
+ readonly location: Schema.Struct<{
66
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
67
+ }>;
63
68
  readonly data: Schema.$Array<Schema.Struct<{
64
69
  readonly file: Schema.String;
65
70
  readonly patch: Schema.String;
@@ -24,7 +24,7 @@ export const VcsGroup = HttpApiGroup.make("server.vcs")
24
24
  })
25
25
  .annotateMerge(locationQueryOpenApi)
26
26
  .annotateMerge(OpenApi.annotations({
27
- identifier: "v2.vcs.get",
27
+ identifier: "vcs.get",
28
28
  summary: "VCS info",
29
29
  description: "Get current and default branch information for the requested location.",
30
30
  })))
@@ -35,7 +35,7 @@ export const VcsGroup = HttpApiGroup.make("server.vcs")
35
35
  })
36
36
  .annotateMerge(locationQueryOpenApi)
37
37
  .annotateMerge(OpenApi.annotations({
38
- identifier: "v2.vcs.base",
38
+ identifier: "vcs.base",
39
39
  summary: "VCS review base",
40
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.",
41
41
  })))
@@ -45,17 +45,17 @@ export const VcsGroup = HttpApiGroup.make("server.vcs")
45
45
  })
46
46
  .annotateMerge(locationQueryOpenApi)
47
47
  .annotateMerge(OpenApi.annotations({
48
- identifier: "v2.vcs.status",
48
+ identifier: "vcs.status",
49
49
  summary: "VCS status",
50
50
  description: "List uncommitted working-copy changes relative to the requested location.",
51
51
  })))
52
- .add(HttpApiEndpoint.get("vcs.branches", "/api/vcs/branches", {
52
+ .add(HttpApiEndpoint.get("vcs.branch.list", "/api/vcs/branch", {
53
53
  query: BranchesQuery,
54
54
  success: Location.response(Vcs.BranchList),
55
55
  })
56
56
  .annotateMerge(locationQueryOpenApi)
57
57
  .annotateMerge(OpenApi.annotations({
58
- identifier: "v2.vcs.branches",
58
+ identifier: "vcs.branch.list",
59
59
  summary: "VCS branches",
60
60
  description: "List local and remote branches available at the requested location.",
61
61
  })))
@@ -66,7 +66,7 @@ export const VcsGroup = HttpApiGroup.make("server.vcs")
66
66
  })
67
67
  .annotateMerge(locationQueryOpenApi)
68
68
  .annotateMerge(OpenApi.annotations({
69
- identifier: "v2.vcs.diff",
69
+ identifier: "vcs.diff",
70
70
  summary: "VCS diff",
71
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.",
72
72
  })))
@@ -1,4 +1,3 @@
1
- import { Location } from "@opencode/schema/location";
2
1
  import { WebSearch } from "@opencode/schema/websearch";
3
2
  import { Schema } from "effect";
4
3
  import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
@@ -6,10 +5,11 @@ import { InvalidRequestError, ServiceUnavailableError } from "../errors.js";
6
5
  export declare const WebSearchGroup: HttpApiGroup.HttpApiGroup<"server.websearch", HttpApiEndpoint.HttpApiEndpoint<"websearch.providers", "GET", "/api/websearch/provider", never, Schema.toCodecStringTree<Schema.Struct<{
7
6
  readonly location: Schema.optional<Schema.Struct<{
8
7
  readonly directory: Schema.optional<Schema.String>;
9
- readonly workspace: Schema.optional<Schema.String>;
10
8
  }>>;
11
9
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
12
- readonly location: typeof Location.Info;
10
+ readonly location: Schema.Struct<{
11
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
12
+ }>;
13
13
  readonly data: Schema.$Array<Schema.Struct<{
14
14
  readonly id: Schema.brand<Schema.String, "WebSearch.ID">;
15
15
  readonly name: Schema.String;
@@ -17,12 +17,13 @@ export declare const WebSearchGroup: HttpApiGroup.HttpApiGroup<"server.websearch
17
17
  }>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"websearch.query", "POST", "/api/websearch", never, Schema.toCodecStringTree<Schema.Struct<{
18
18
  readonly location: Schema.optional<Schema.Struct<{
19
19
  readonly directory: Schema.optional<Schema.String>;
20
- readonly workspace: Schema.optional<Schema.String>;
21
20
  }>>;
22
21
  }>>, Schema.toCodecJson<Schema.Struct<{
23
22
  readonly query: Schema.String;
24
23
  readonly providerID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WebSearch.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "WebSearch.ID">>, never, never>;
25
24
  }>>, never, Schema.toCodecJson<Schema.Struct<{
26
- readonly location: typeof Location.Info;
25
+ readonly location: Schema.Struct<{
26
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
27
+ }>;
27
28
  readonly data: typeof WebSearch.Response;
28
29
  }>>, Schema.toCodecJson<typeof InvalidRequestError | typeof ServiceUnavailableError>, never, never>, false>;
@@ -12,7 +12,7 @@ export const WebSearchGroup = HttpApiGroup.make("server.websearch")
12
12
  })
13
13
  .annotateMerge(locationQueryOpenApi)
14
14
  .annotateMerge(OpenApi.annotations({
15
- identifier: "v2.websearch.providers",
15
+ identifier: "websearch.providers",
16
16
  summary: "List web search providers",
17
17
  description: "Return the registered web search providers.",
18
18
  })))
@@ -24,7 +24,7 @@ export const WebSearchGroup = HttpApiGroup.make("server.websearch")
24
24
  })
25
25
  .annotateMerge(locationQueryOpenApi)
26
26
  .annotateMerge(OpenApi.annotations({
27
- identifier: "v2.websearch.query",
27
+ identifier: "websearch.query",
28
28
  summary: "Search the web",
29
29
  description: "Run one web search through the selected provider. Specify a provider to override the configured default.",
30
30
  })))
@@ -1,5 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
3
+ import { ProjectNotFoundError } from "../errors.js";
3
4
  declare const WorktreeError_base: Schema.Class<WorktreeError, Schema.Struct<{
4
5
  readonly name: Schema.Literal<"WorktreeError">;
5
6
  readonly data: Schema.Struct<{
@@ -10,38 +11,31 @@ declare const WorktreeError_base: Schema.Class<WorktreeError, Schema.Struct<{
10
11
  export declare class WorktreeError extends WorktreeError_base {
11
12
  }
12
13
  export declare const WorktreeGroup: HttpApiGroup.HttpApiGroup<"server.worktree", HttpApiEndpoint.HttpApiEndpoint<"worktree.list", "GET", "/api/worktree", never, Schema.toCodecStringTree<Schema.Struct<{
13
- readonly location: Schema.optional<Schema.Struct<{
14
- readonly directory: Schema.optional<Schema.String>;
15
- readonly workspace: Schema.optional<Schema.String>;
16
- }>>;
14
+ readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
15
+ global: string & import("effect/Brand").Brand<"Project.ID">;
16
+ };
17
17
  }>>, never, never, Schema.toCodecJson<Schema.$Array<Schema.Struct<{
18
18
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
19
19
  readonly strategy: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
20
- }>>>, Schema.toCodecJson<typeof WorktreeError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"worktree.create", "POST", "/api/worktree", never, Schema.toCodecStringTree<Schema.Struct<{
21
- readonly location: Schema.optional<Schema.Struct<{
22
- readonly directory: Schema.optional<Schema.String>;
23
- readonly workspace: Schema.optional<Schema.String>;
24
- }>>;
25
- }>>, Schema.toCodecJson<Schema.Struct<{
26
- readonly strategy: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.Trim, "Worktree.StrategyID">>>, Schema.optionalKey<Schema.brand<Schema.Trim, "Worktree.StrategyID">>, never, never>;
20
+ }>>>, Schema.toCodecJson<typeof ProjectNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"worktree.create", "POST", "/api/worktree", never, never, Schema.toCodecJson<Schema.Struct<{
21
+ readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
22
+ global: string & import("effect/Brand").Brand<"Project.ID">;
23
+ };
27
24
  readonly from: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "AbsolutePath">>>, Schema.optionalKey<Schema.brand<Schema.String, "AbsolutePath">>, never, never>;
28
25
  readonly branch: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Trim>>, Schema.optionalKey<Schema.Trim>, never, never>;
29
26
  readonly directory: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "AbsolutePath">>>, Schema.optionalKey<Schema.brand<Schema.String, "AbsolutePath">>, never, never>;
30
27
  readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
31
28
  }>>, never, Schema.toCodecJson<Schema.Struct<{
32
29
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
33
- }>>, Schema.toCodecJson<typeof WorktreeError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"worktree.remove", "DELETE", "/api/worktree", never, Schema.toCodecStringTree<Schema.Struct<{
34
- readonly location: Schema.optional<Schema.Struct<{
35
- readonly directory: Schema.optional<Schema.String>;
36
- readonly workspace: Schema.optional<Schema.String>;
37
- }>>;
38
- }>>, Schema.toCodecJson<Schema.Struct<{
30
+ }>>, Schema.toCodecJson<typeof ProjectNotFoundError | typeof WorktreeError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"worktree.remove", "DELETE", "/api/worktree", never, never, Schema.toCodecJson<Schema.Struct<{
31
+ readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
32
+ global: string & import("effect/Brand").Brand<"Project.ID">;
33
+ };
39
34
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
40
35
  readonly force: Schema.Boolean;
41
- }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof WorktreeError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"worktree.refresh", "POST", "/api/worktree/refresh", never, Schema.toCodecStringTree<Schema.Struct<{
42
- readonly location: Schema.optional<Schema.Struct<{
43
- readonly directory: Schema.optional<Schema.String>;
44
- readonly workspace: Schema.optional<Schema.String>;
45
- }>>;
46
- }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof WorktreeError>, never, never>, false>;
36
+ }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof ProjectNotFoundError | typeof WorktreeError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"worktree.refresh", "POST", "/api/worktree/refresh", never, never, Schema.toCodecJson<Schema.Struct<{
37
+ readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
38
+ global: string & import("effect/Brand").Brand<"Project.ID">;
39
+ };
40
+ }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof ProjectNotFoundError | typeof WorktreeError>, never, never>, false>;
47
41
  export {};
@@ -1,7 +1,8 @@
1
1
  import { Worktree } from "@opencode/schema/worktree";
2
2
  import { Schema } from "effect";
3
3
  import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
4
- import { LocationQuery, locationQueryOpenApi } from "./location.js";
4
+ import { Project } from "@opencode/schema/project";
5
+ import { ProjectNotFoundError } from "../errors.js";
5
6
  const root = "/api/worktree";
6
7
  export class WorktreeError extends Schema.Error("WorktreeError")({
7
8
  name: Schema.Literal("WorktreeError"),
@@ -13,49 +14,39 @@ export class WorktreeError extends Schema.Error("WorktreeError")({
13
14
  }
14
15
  export const WorktreeGroup = HttpApiGroup.make("server.worktree")
15
16
  .add(HttpApiEndpoint.get("worktree.list", root, {
16
- query: LocationQuery,
17
+ query: Schema.Struct({ projectID: Project.ID }),
17
18
  success: Worktree.List,
18
- error: WorktreeError,
19
- })
20
- .annotateMerge(locationQueryOpenApi)
21
- .annotateMerge(OpenApi.annotations({
22
- identifier: "v2.worktree.list",
19
+ error: ProjectNotFoundError,
20
+ }).annotateMerge(OpenApi.annotations({
21
+ identifier: "worktree.list",
23
22
  summary: "List worktrees",
24
- description: "Discover worktrees through the requested location's strategies and return its project's inventory.",
23
+ description: "Return the project's saved worktree inventory without loading configuration or running discovery.",
25
24
  })))
26
25
  .add(HttpApiEndpoint.post("worktree.create", root, {
27
- query: LocationQuery,
28
26
  payload: Worktree.CreateInput,
29
27
  success: Worktree.Info,
30
- error: WorktreeError,
31
- })
32
- .annotateMerge(locationQueryOpenApi)
33
- .annotateMerge(OpenApi.annotations({
34
- identifier: "v2.worktree.create",
28
+ error: [WorktreeError, ProjectNotFoundError],
29
+ }).annotateMerge(OpenApi.annotations({
30
+ identifier: "worktree.create",
35
31
  summary: "Create worktree",
36
- description: "Create a local worktree using the location's registered strategy and directory defaults, then run the project's setup script.",
32
+ description: "Load the project's canonical configuration, create a local worktree using its selected strategy, then run the project's setup script.",
37
33
  })))
38
34
  .add(HttpApiEndpoint.delete("worktree.remove", root, {
39
- query: LocationQuery,
40
35
  payload: Worktree.RemoveInput,
41
36
  success: HttpApiSchema.NoContent,
42
- error: WorktreeError,
43
- })
44
- .annotateMerge(locationQueryOpenApi)
45
- .annotateMerge(OpenApi.annotations({
46
- identifier: "v2.worktree.remove",
37
+ error: [WorktreeError, ProjectNotFoundError],
38
+ }).annotateMerge(OpenApi.annotations({
39
+ identifier: "worktree.remove",
47
40
  summary: "Remove worktree",
48
- description: "Remove a managed worktree from the requested location's project using its recorded strategy.",
41
+ description: "Load the project's canonical configuration and remove a saved worktree using its recorded strategy.",
49
42
  })))
50
43
  .add(HttpApiEndpoint.post("worktree.refresh", `${root}/refresh`, {
51
- query: LocationQuery,
44
+ payload: Schema.Struct({ projectID: Project.ID }),
52
45
  success: HttpApiSchema.NoContent,
53
- error: WorktreeError,
54
- })
55
- .annotateMerge(locationQueryOpenApi)
56
- .annotateMerge(OpenApi.annotations({
57
- identifier: "v2.worktree.refresh",
46
+ error: [WorktreeError, ProjectNotFoundError],
47
+ }).annotateMerge(OpenApi.annotations({
48
+ identifier: "worktree.refresh",
58
49
  summary: "Refresh worktrees",
59
- description: "Discover worktrees from the requested location and reconcile the shared project inventory.",
50
+ description: "Load the project's canonical configuration, discover worktrees across known checkout roots using all available strategies, and reconcile saved state.",
60
51
  })))
61
- .annotateMerge(OpenApi.annotations({ title: "worktree", description: "Location-scoped worktree management routes." }));
52
+ .annotateMerge(OpenApi.annotations({ title: "worktree", description: "Project-based worktree management routes." }));
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": "2.0.2",
4
+ "version": "2.0.4",
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/schema": "2.0.2",
35
+ "@opencode/schema": "2.0.4",
36
36
  "effect": "4.0.0-rc.112"
37
37
  },
38
38
  "devDependencies": {
@@ -1,15 +0,0 @@
1
- import { Schema } from "effect";
2
- import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
3
- export declare namespace ServiceStatus {
4
- const Health: Schema.Struct<{
5
- readonly healthy: Schema.Literal<true>;
6
- readonly version: Schema.String;
7
- readonly pid: Schema.Int;
8
- }>;
9
- type Health = typeof Health.Type;
10
- }
11
- export declare const HealthGroup: HttpApiGroup.HttpApiGroup<"server.health", HttpApiEndpoint.HttpApiEndpoint<"health.get", "GET", "/api/health", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
12
- readonly healthy: Schema.Literal<true>;
13
- readonly version: Schema.String;
14
- readonly pid: Schema.Int;
15
- }>>, never, never, never>, false>;
@@ -1,20 +0,0 @@
1
- import { Schema } from "effect";
2
- import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
3
- export var ServiceStatus;
4
- (function (ServiceStatus) {
5
- ServiceStatus.Health = Schema.Struct({
6
- healthy: Schema.Literal(true),
7
- version: Schema.String,
8
- // 0 means the runtime has no OS process identity (e.g. workerd).
9
- pid: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
10
- }).annotate({ identifier: "ServiceHealth" });
11
- })(ServiceStatus || (ServiceStatus = {}));
12
- export const HealthGroup = HttpApiGroup.make("server.health")
13
- .add(HttpApiEndpoint.get("health.get", "/api/health", {
14
- success: ServiceStatus.Health,
15
- }).annotateMerge(OpenApi.annotations({
16
- identifier: "v2.health.get",
17
- summary: "Check server health",
18
- description: "Report the owning server process and its application status.",
19
- })))
20
- .annotateMerge(OpenApi.annotations({ title: "health" }));
@@ -1,22 +0,0 @@
1
- import { Schema } from "effect";
2
- import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
3
- import { ConflictError, ProviderNotFoundError, UnknownError } from "../errors.js";
4
- export declare const WorkspaceGroup: HttpApiGroup.HttpApiGroup<"server.workspace", HttpApiEndpoint.HttpApiEndpoint<"workspace.create", "POST", "/api/workspace", never, never, Schema.toCodecJson<Schema.Struct<{
5
- readonly id: Schema.optional<Schema.brand<Schema.String, "Workspace.ID"> & {
6
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
7
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
8
- }>;
9
- readonly provider: Schema.String;
10
- }>>, never, Schema.toCodecJson<Schema.Struct<{
11
- readonly data: Schema.brand<Schema.String, "Workspace.ID"> & {
12
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
13
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
14
- };
15
- }>>, Schema.toCodecJson<typeof ConflictError | typeof ProviderNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"workspace.destroy", "DELETE", "/api/workspace/:workspaceID", Schema.toCodecStringTree<Schema.Struct<{
16
- workspaceID: Schema.brand<Schema.String, "Workspace.ID"> & {
17
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
18
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
19
- };
20
- }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
21
- readonly destroyed: Schema.Boolean;
22
- }>>, Schema.toCodecJson<typeof UnknownError>, never, never>, false>;