@opencode/protocol 2.0.3 → 2.0.5

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 +698 -40
  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 +1085 -793
  54. package/dist/groups/session.js +172 -94
  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,6 +1,7 @@
1
1
  import { Session } from "@opencode/schema/session";
2
2
  import { SessionMessage } from "@opencode/schema/session-message";
3
- import { Schema } from "effect";
3
+ import { Location } from "@opencode/schema/location";
4
+ import { Schema, Struct } from "effect";
4
5
  import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
5
6
  import { InvalidCursorError, SessionNotFoundError, UnknownError } from "../errors.js";
6
7
  export const SessionMessagesQuery = Schema.Struct({
@@ -28,12 +29,34 @@ export const SessionMessagesQuery = Schema.Struct({
28
29
  description: "Filter by message type before pagination. When omitted, all message types are returned. Pass the same type when following cursors.",
29
30
  }),
30
31
  }).annotate({ identifier: "SessionMessagesQuery" });
32
+ const PublicLocationSwitched = Schema.Struct({
33
+ ...Struct.omit(SessionMessage.LocationSwitched.fields, ["location", "previous"]),
34
+ location: Location.PublicRef,
35
+ previous: Schema.Struct({
36
+ location: Location.PublicRef,
37
+ projectID: SessionMessage.LocationSwitched.fields.projectID,
38
+ subpath: SessionMessage.LocationSwitched.fields.subpath,
39
+ }).pipe(Schema.optional),
40
+ }).annotate({ identifier: "Session.Message.LocationSwitched" });
41
+ export const PublicSessionMessage = Schema.Union([
42
+ SessionMessage.AgentSelected,
43
+ SessionMessage.ModelSelected,
44
+ PublicLocationSwitched,
45
+ SessionMessage.User,
46
+ SessionMessage.Synthetic,
47
+ SessionMessage.System,
48
+ SessionMessage.Skill,
49
+ SessionMessage.Shell,
50
+ SessionMessage.Assistant,
51
+ SessionMessage.Compaction,
52
+ SessionMessage.Idle,
53
+ ]).annotate({ identifier: "Session.Message.Info" });
31
54
  export const MessageGroup = HttpApiGroup.make("server.message")
32
55
  .add(HttpApiEndpoint.get("session.messages", "/api/session/:sessionID/message", {
33
56
  params: { sessionID: Session.ID },
34
57
  query: SessionMessagesQuery,
35
58
  success: Schema.Struct({
36
- data: Schema.Array(SessionMessage.Info),
59
+ data: Schema.Array(PublicSessionMessage),
37
60
  cursor: Schema.Struct({
38
61
  previous: Schema.String.pipe(Schema.optional),
39
62
  next: Schema.String.pipe(Schema.optional),
@@ -41,7 +64,7 @@ export const MessageGroup = HttpApiGroup.make("server.message")
41
64
  }).annotate({ identifier: "SessionMessagesResponse" }),
42
65
  error: [InvalidCursorError, SessionNotFoundError, UnknownError],
43
66
  }).annotateMerge(OpenApi.annotations({
44
- identifier: "v2.message.list",
67
+ identifier: "session.message.list",
45
68
  summary: "Get session messages",
46
69
  description: "Retrieve projected messages for a session, optionally filtered by type. Items keep the requested order across pages; use cursor.next or cursor.previous to move through the ordered timeline, passing the same type filter on each page.",
47
70
  })))
@@ -14,7 +14,7 @@ export const MigrationGroup = HttpApiGroup.make("server.migration")
14
14
  .add(HttpApiEndpoint.get("migration.v1.status", "/api/experimental/migration/v1", {
15
15
  success: V1MigrationStatus,
16
16
  }).annotateMerge(OpenApi.annotations({
17
- identifier: "v2.experimental.migration.v1.status",
17
+ identifier: "experimental.migration.v1.status",
18
18
  summary: "Get V1 migration status",
19
19
  description: "Return the progress of the V1 to V2 session history migration.",
20
20
  })))
@@ -1,21 +1,20 @@
1
1
  import { Model } from "@opencode/schema/model";
2
- import { Location } from "@opencode/schema/location";
3
2
  import { Schema } from "effect";
4
3
  import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
5
4
  import { ServiceUnavailableError } from "../errors.js";
6
5
  export declare const ModelGroup: HttpApiGroup.HttpApiGroup<"server.model", HttpApiEndpoint.HttpApiEndpoint<"model.list", "GET", "/api/model", 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 capabilities: Schema.Struct<{
15
15
  readonly tools: Schema.Boolean;
16
16
  readonly input: Schema.$Array<Schema.String>;
17
17
  readonly output: Schema.$Array<Schema.String>;
18
- readonly responsesWebsockets: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
19
18
  }> & {
20
19
  default: () => {
21
20
  tools: true;
@@ -113,12 +112,14 @@ export declare const ModelGroup: HttpApiGroup.HttpApiGroup<"server.model", HttpA
113
112
  readonly maxTokensField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>>, Schema.optionalKey<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>, never, never>;
114
113
  readonly requireFinishReason: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
115
114
  readonly requireAssistantAfterTool: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
115
+ readonly supportsPromptCacheKey: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
116
116
  }>>>, Schema.optionalKey<Schema.Struct<{
117
117
  readonly reasoningField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>>, Schema.optionalKey<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>, never, never>;
118
118
  readonly requireReasoning: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
119
119
  readonly maxTokensField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>>, Schema.optionalKey<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>, never, never>;
120
120
  readonly requireFinishReason: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
121
121
  readonly requireAssistantAfterTool: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
122
+ readonly supportsPromptCacheKey: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
122
123
  }>>, never, never>;
123
124
  readonly package: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
124
125
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
@@ -132,7 +133,7 @@ export declare const ModelGroup: HttpApiGroup.HttpApiGroup<"server.model", HttpA
132
133
  readonly mode: Schema.Literal<"provider">;
133
134
  readonly threshold: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
134
135
  }>]>>, never, never>;
135
- readonly websocket: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
136
+ readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
136
137
  }> & {
137
138
  default: (providerID: import("@opencode/schema/provider").ID, id: Model.ID) => {
138
139
  id: string & import("effect/Brand").Brand<"Model.ID">;
@@ -160,16 +161,16 @@ export declare const ModelGroup: HttpApiGroup.HttpApiGroup<"server.model", HttpA
160
161
  }>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"model.default", "GET", "/api/model/default", never, Schema.toCodecStringTree<Schema.Struct<{
161
162
  readonly location: Schema.optional<Schema.Struct<{
162
163
  readonly directory: Schema.optional<Schema.String>;
163
- readonly workspace: Schema.optional<Schema.String>;
164
164
  }>>;
165
165
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
166
- readonly location: typeof Location.Info;
166
+ readonly location: Schema.Struct<{
167
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
168
+ }>;
167
169
  readonly data: Schema.UndefinedOr<Schema.Struct<{
168
170
  readonly capabilities: Schema.Struct<{
169
171
  readonly tools: Schema.Boolean;
170
172
  readonly input: Schema.$Array<Schema.String>;
171
173
  readonly output: Schema.$Array<Schema.String>;
172
- readonly responsesWebsockets: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
173
174
  }> & {
174
175
  default: () => {
175
176
  tools: true;
@@ -267,12 +268,14 @@ export declare const ModelGroup: HttpApiGroup.HttpApiGroup<"server.model", HttpA
267
268
  readonly maxTokensField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>>, Schema.optionalKey<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>, never, never>;
268
269
  readonly requireFinishReason: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
269
270
  readonly requireAssistantAfterTool: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
271
+ readonly supportsPromptCacheKey: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
270
272
  }>>>, Schema.optionalKey<Schema.Struct<{
271
273
  readonly reasoningField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>>, Schema.optionalKey<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>, never, never>;
272
274
  readonly requireReasoning: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
273
275
  readonly maxTokensField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>>, Schema.optionalKey<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>, never, never>;
274
276
  readonly requireFinishReason: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
275
277
  readonly requireAssistantAfterTool: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
278
+ readonly supportsPromptCacheKey: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
276
279
  }>>, never, never>;
277
280
  readonly package: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
278
281
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
@@ -286,7 +289,7 @@ export declare const ModelGroup: HttpApiGroup.HttpApiGroup<"server.model", HttpA
286
289
  readonly mode: Schema.Literal<"provider">;
287
290
  readonly threshold: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
288
291
  }>]>>, never, never>;
289
- readonly websocket: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
292
+ readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
290
293
  }> & {
291
294
  default: (providerID: import("@opencode/schema/provider").ID, id: Model.ID) => {
292
295
  id: string & import("effect/Brand").Brand<"Model.ID">;
@@ -12,7 +12,7 @@ export const ModelGroup = HttpApiGroup.make("server.model")
12
12
  })
13
13
  .annotateMerge(locationQueryOpenApi)
14
14
  .annotateMerge(OpenApi.annotations({
15
- identifier: "v2.model.list",
15
+ identifier: "model.list",
16
16
  summary: "List models",
17
17
  description: "Retrieve the current snapshot of available models ordered by release date. The snapshot may precede initial plugin settlement.",
18
18
  })))
@@ -23,7 +23,7 @@ export const ModelGroup = HttpApiGroup.make("server.model")
23
23
  })
24
24
  .annotateMerge(locationQueryOpenApi)
25
25
  .annotateMerge(OpenApi.annotations({
26
- identifier: "v2.model.default",
26
+ identifier: "model.default",
27
27
  summary: "Get default model",
28
28
  description: "Retrieve the model used when a session has no explicit model selection.",
29
29
  })))
@@ -1,14 +1,14 @@
1
- import { Location } from "@opencode/schema/location";
2
1
  import { Context, Schema } from "effect";
3
2
  import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema } from "effect/unstable/httpapi";
4
3
  import { PermissionNotFoundError, SessionNotFoundError } from "../errors.js";
5
4
  export declare const makePermissionGroup: <LocationId extends HttpApiMiddleware.AnyId, LocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService>(locationMiddleware: Context.Key<LocationId, LocationService>, sessionLocationMiddleware: Context.Key<SessionLocationId, SessionLocationService>) => HttpApiGroup.HttpApiGroup<"server.permission", HttpApiEndpoint.HttpApiEndpoint<"permission.request.list", "GET", "/api/permission/request", 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 sessionID: Schema.brand<Schema.String, "SessionID"> & {
14
14
  create: () => string & import("effect/Brand").Brand<"SessionID">;
@@ -46,6 +46,10 @@ export declare const makePermissionGroup: <LocationId extends HttpApiMiddleware.
46
46
  };
47
47
  readonly action: Schema.String;
48
48
  readonly resource: Schema.String;
49
+ readonly time: Schema.Struct<{
50
+ readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
51
+ readonly updated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
52
+ }>;
49
53
  }>>;
50
54
  }>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"permission.saved.remove", "DELETE", "/api/permission/saved/:id", Schema.toCodecStringTree<Schema.Struct<{
51
55
  id: Schema.brand<Schema.String, "PermissionSaved.ID"> & {
@@ -151,17 +155,6 @@ export declare const makePermissionGroup: <LocationId extends HttpApiMiddleware.
151
155
  create: (id?: string) => string & import("effect/Brand").Brand<"Permission.ID">;
152
156
  };
153
157
  }>>, never, Schema.toCodecJson<Schema.Struct<{
154
- readonly reply: Schema.Literals<readonly ["once", "always", "reject"]>;
158
+ readonly decision: Schema.Literals<readonly ["once", "always", "reject"]>;
155
159
  readonly message: Schema.optional<Schema.String>;
156
- }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof SessionNotFoundError | typeof PermissionNotFoundError>, SessionLocationId, HttpApiMiddleware.Requires<SessionLocationId>> | HttpApiEndpoint.HttpApiEndpoint<"session.permission.rules", "PUT", "/api/session/:sessionID/permission/rules", Schema.toCodecStringTree<Schema.Struct<{
157
- sessionID: Schema.brand<Schema.String, "SessionID"> & {
158
- create: () => string & import("effect/Brand").Brand<"SessionID">;
159
- descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
160
- };
161
- }>>, never, Schema.toCodecJson<Schema.Struct<{
162
- readonly permissions: Schema.$Array<Schema.Struct<{
163
- readonly action: Schema.String;
164
- readonly resource: Schema.String;
165
- readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
166
- }>>;
167
- }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof SessionNotFoundError>, SessionLocationId, HttpApiMiddleware.Requires<SessionLocationId>>, false>;
160
+ }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof SessionNotFoundError | typeof PermissionNotFoundError>, SessionLocationId, HttpApiMiddleware.Requires<SessionLocationId>>, false>;
@@ -15,7 +15,7 @@ export const makePermissionGroup = (locationMiddleware, sessionLocationMiddlewar
15
15
  })
16
16
  .annotateMerge(locationQueryOpenApi)
17
17
  .annotateMerge(OpenApi.annotations({
18
- identifier: "v2.permission.request.list",
18
+ identifier: "permission.request.list",
19
19
  summary: "List pending permission requests",
20
20
  description: "Retrieve pending permission requests for a location.",
21
21
  })))
@@ -23,7 +23,7 @@ export const makePermissionGroup = (locationMiddleware, sessionLocationMiddlewar
23
23
  query: Schema.Struct({ projectID: Project.ID.pipe(Schema.optional) }),
24
24
  success: Schema.Struct({ data: Schema.Array(PermissionSaved.Info) }),
25
25
  }).annotateMerge(OpenApi.annotations({
26
- identifier: "v2.permission.saved.list",
26
+ identifier: "permission.saved.list",
27
27
  summary: "List saved permissions",
28
28
  description: "Retrieve saved permissions, optionally filtered by project.",
29
29
  })))
@@ -31,7 +31,7 @@ export const makePermissionGroup = (locationMiddleware, sessionLocationMiddlewar
31
31
  params: { id: PermissionSaved.ID },
32
32
  success: HttpApiSchema.NoContent,
33
33
  }).annotateMerge(OpenApi.annotations({
34
- identifier: "v2.permission.saved.remove",
34
+ identifier: "permission.saved.remove",
35
35
  summary: "Remove saved permission",
36
36
  description: "Remove a saved permission by ID.",
37
37
  })))
@@ -55,7 +55,7 @@ export const makePermissionGroup = (locationMiddleware, sessionLocationMiddlewar
55
55
  })
56
56
  .middleware(sessionLocationMiddleware)
57
57
  .annotateMerge(OpenApi.annotations({
58
- identifier: "v2.session.permission.create",
58
+ identifier: "session.permission.create",
59
59
  summary: "Create permission request",
60
60
  description: "Evaluate and, when approval is required, create a permission request for a session.",
61
61
  })))
@@ -64,7 +64,7 @@ export const makePermissionGroup = (locationMiddleware, sessionLocationMiddlewar
64
64
  success: Schema.Struct({ data: Schema.Array(Permission.Request) }),
65
65
  error: SessionNotFoundError,
66
66
  }).annotateMerge(OpenApi.annotations({
67
- identifier: "v2.session.permission.list",
67
+ identifier: "session.permission.list",
68
68
  summary: "List session permission requests",
69
69
  description: "Retrieve pending permission requests owned by a session.",
70
70
  })))
@@ -75,14 +75,14 @@ export const makePermissionGroup = (locationMiddleware, sessionLocationMiddlewar
75
75
  })
76
76
  .middleware(sessionLocationMiddleware)
77
77
  .annotateMerge(OpenApi.annotations({
78
- identifier: "v2.session.permission.get",
78
+ identifier: "session.permission.get",
79
79
  summary: "Get permission request",
80
80
  description: "Retrieve a pending permission request owned by a session.",
81
81
  })))
82
82
  .add(HttpApiEndpoint.post("session.permission.reply", "/api/session/:sessionID/permission/:requestID/reply", {
83
83
  params: { sessionID: Session.ID, requestID: Permission.ID },
84
84
  payload: Schema.Struct({
85
- reply: Permission.Reply,
85
+ decision: Permission.Reply,
86
86
  message: Schema.String.pipe(Schema.optional),
87
87
  }),
88
88
  success: HttpApiSchema.NoContent,
@@ -90,20 +90,8 @@ export const makePermissionGroup = (locationMiddleware, sessionLocationMiddlewar
90
90
  })
91
91
  .middleware(sessionLocationMiddleware)
92
92
  .annotateMerge(OpenApi.annotations({
93
- identifier: "v2.session.permission.reply",
93
+ identifier: "session.permission.reply",
94
94
  summary: "Reply to pending permission request",
95
95
  description: "Respond to a pending permission request owned by a session.",
96
- })))
97
- .add(HttpApiEndpoint.put("session.permission.rules", "/api/session/:sessionID/permission/rules", {
98
- params: { sessionID: Session.ID },
99
- payload: Schema.Struct({ permissions: Permission.Ruleset }),
100
- success: HttpApiSchema.NoContent,
101
- error: SessionNotFoundError,
102
- })
103
- .middleware(sessionLocationMiddleware)
104
- .annotateMerge(OpenApi.annotations({
105
- identifier: "v2.session.permission.rules",
106
- summary: "Replace session permission rules",
107
- description: "Replace the session-scoped permission rules. Rules are evaluated after the agent's rules, and the last matching rule wins.",
108
96
  })))
109
97
  .annotateMerge(OpenApi.annotations({ title: "permission", description: "Experimental permission routes." }));
@@ -76,7 +76,7 @@ export const PersistentPtyGroup = HttpApiGroup.make("server.experimental")
76
76
  success: Schema.Boolean,
77
77
  error: [ForbiddenError, PtyNotFoundError, ServiceUnavailableError],
78
78
  }).annotateMerge(OpenApi.annotations({
79
- identifier: "v2.persistentPty.connect",
79
+ identifier: "persistentPty.connect",
80
80
  summary: "Connect to a persistent PTY",
81
81
  description: "Stream persistent PTY output through the OpenCode server.",
82
82
  transform: (operation) => ({
@@ -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 { InvalidRequestError, ServiceUnavailableError } from "../errors.js";
5
4
  export declare const PluginGroup: HttpApiGroup.HttpApiGroup<"server.plugin", HttpApiEndpoint.HttpApiEndpoint<"plugin.list", "GET", "/api/plugin", 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.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Plugin.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Plugin.ID">>, never, never>;
14
14
  readonly source: Schema.Union<readonly [Schema.Struct<{
@@ -38,20 +38,16 @@ export declare const PluginGroup: HttpApiGroup.HttpApiGroup<"server.plugin", Htt
38
38
  readonly ref: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
39
39
  }>]>;
40
40
  }>>;
41
- }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"plugin.awaitActivation", "POST", "/api/plugin/await-activation", never, Schema.toCodecStringTree<Schema.Struct<{
41
+ }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"plugin.check", "POST", "/api/plugin/check", never, Schema.toCodecStringTree<Schema.Struct<{
42
42
  readonly location: Schema.optional<Schema.Struct<{
43
43
  readonly directory: Schema.optional<Schema.String>;
44
- readonly workspace: Schema.optional<Schema.String>;
45
- }>>;
46
- }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"plugin.check", "POST", "/api/plugin/check", never, Schema.toCodecStringTree<Schema.Struct<{
47
- readonly location: Schema.optional<Schema.Struct<{
48
- readonly directory: Schema.optional<Schema.String>;
49
- readonly workspace: Schema.optional<Schema.String>;
50
44
  }>>;
51
45
  }>>, Schema.toCodecJson<Schema.Struct<{
52
46
  readonly target: Schema.optional<Schema.String>;
53
47
  }>>, never, Schema.toCodecJson<Schema.Struct<{
54
- readonly location: typeof Location.Info;
48
+ readonly location: Schema.Struct<{
49
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
50
+ }>;
55
51
  readonly data: Schema.$Array<Schema.Struct<{
56
52
  readonly id: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Plugin.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Plugin.ID">>, never, never>;
57
53
  readonly source: Schema.Union<readonly [Schema.Struct<{
@@ -84,7 +80,6 @@ export declare const PluginGroup: HttpApiGroup.HttpApiGroup<"server.plugin", Htt
84
80
  }>>, Schema.toCodecJson<typeof InvalidRequestError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"plugin.update", "POST", "/api/plugin/update", never, Schema.toCodecStringTree<Schema.Struct<{
85
81
  readonly location: Schema.optional<Schema.Struct<{
86
82
  readonly directory: Schema.optional<Schema.String>;
87
- readonly workspace: Schema.optional<Schema.String>;
88
83
  }>>;
89
84
  }>>, Schema.toCodecJson<Schema.Struct<{
90
85
  readonly targets: Schema.$Array<Schema.String>;
@@ -11,19 +11,9 @@ export const PluginGroup = HttpApiGroup.make("server.plugin")
11
11
  })
12
12
  .annotateMerge(locationQueryOpenApi)
13
13
  .annotateMerge(OpenApi.annotations({
14
- identifier: "v2.plugin.list",
14
+ identifier: "plugin.list",
15
15
  summary: "List plugins",
16
16
  description: "Retrieve enabled server plugins and their current status.",
17
- })))
18
- .add(HttpApiEndpoint.post("plugin.awaitActivation", "/api/plugin/await-activation", {
19
- query: LocationQuery,
20
- success: HttpApiSchema.NoContent,
21
- })
22
- .annotateMerge(locationQueryOpenApi)
23
- .annotateMerge(OpenApi.annotations({
24
- identifier: "v2.plugin.awaitActivation",
25
- summary: "Wait for plugin activation",
26
- description: "Wait for configured plugin activation at a Location to settle, including missing-package installs. Completion does not imply every plugin succeeded or background resource discovery finished. Cancelling this wait does not cancel activation.",
27
17
  })))
28
18
  .add(HttpApiEndpoint.post("plugin.check", "/api/plugin/check", {
29
19
  query: LocationQuery,
@@ -33,7 +23,7 @@ export const PluginGroup = HttpApiGroup.make("server.plugin")
33
23
  })
34
24
  .annotateMerge(locationQueryOpenApi)
35
25
  .annotateMerge(OpenApi.annotations({
36
- identifier: "v2.plugin.check",
26
+ identifier: "plugin.check",
37
27
  summary: "Check plugin updates",
38
28
  description: "Check one or all package plugins for available updates.",
39
29
  })))
@@ -45,7 +35,7 @@ export const PluginGroup = HttpApiGroup.make("server.plugin")
45
35
  })
46
36
  .annotateMerge(locationQueryOpenApi)
47
37
  .annotateMerge(OpenApi.annotations({
48
- identifier: "v2.plugin.update",
38
+ identifier: "plugin.update",
49
39
  summary: "Update plugins",
50
40
  description: "Update package plugins concurrently and notify active locations to reload them. Responds once every update has finished; fails when any update fails.",
51
41
  })))
@@ -25,7 +25,6 @@ export declare const ProjectGroup: HttpApiGroup.HttpApiGroup<"server.project", H
25
25
  readonly time: Schema.Struct<{
26
26
  readonly created: Schema.Int;
27
27
  readonly updated: Schema.Int;
28
- readonly initialized: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
29
28
  }>;
30
29
  readonly sandboxes: Schema.$Array<Schema.String>;
31
30
  }>>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"project.update", "PATCH", "/api/project/:projectID", Schema.toCodecStringTree<Schema.Struct<{
@@ -73,18 +72,6 @@ export declare const ProjectGroup: HttpApiGroup.HttpApiGroup<"server.project", H
73
72
  readonly time: Schema.Struct<{
74
73
  readonly created: Schema.Int;
75
74
  readonly updated: Schema.Int;
76
- readonly initialized: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
77
75
  }>;
78
76
  readonly sandboxes: Schema.$Array<Schema.String>;
79
- }>>, Schema.toCodecJson<typeof ProjectNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"project.current", "GET", "/api/project/current", never, Schema.toCodecStringTree<Schema.Struct<{
80
- readonly location: Schema.optional<Schema.Struct<{
81
- readonly directory: Schema.optional<Schema.String>;
82
- readonly workspace: Schema.optional<Schema.String>;
83
- }>>;
84
- }>>, never, never, Schema.toCodecJson<Schema.Struct<{
85
- readonly id: Schema.brand<Schema.String, "Project.ID"> & {
86
- global: string & import("effect/Brand").Brand<"Project.ID">;
87
- };
88
- readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
89
- readonly canonical: Schema.brand<Schema.String, "AbsolutePath">;
90
- }>>, never, never, never>, false>;
77
+ }>>, Schema.toCodecJson<typeof ProjectNotFoundError>, never, never>, false>;
@@ -1,7 +1,6 @@
1
1
  import { Project } from "@opencode/schema/project";
2
2
  import { Schema, Struct } from "effect";
3
3
  import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
4
- import { LocationQuery, locationQueryOpenApi } from "./location.js";
5
4
  import { ProjectNotFoundError } from "../errors.js";
6
5
  const root = "/api/project";
7
6
  const UpdatePayload = Schema.Struct(Struct.omit(Project.UpdateInput.fields, ["projectID"]));
@@ -9,7 +8,7 @@ export const ProjectGroup = HttpApiGroup.make("server.project")
9
8
  .add(HttpApiEndpoint.get("project.list", root, {
10
9
  success: Schema.Array(Project.Info),
11
10
  }).annotateMerge(OpenApi.annotations({
12
- identifier: "v2.project.list",
11
+ identifier: "project.list",
13
12
  summary: "List projects",
14
13
  description: "List known projects.",
15
14
  })))
@@ -19,19 +18,9 @@ export const ProjectGroup = HttpApiGroup.make("server.project")
19
18
  success: Project.Info,
20
19
  error: ProjectNotFoundError,
21
20
  }).annotateMerge(OpenApi.annotations({
22
- identifier: "v2.project.update",
21
+ identifier: "project.update",
23
22
  summary: "Update project",
24
23
  description: "Update the project canonical directory, display metadata, and workspace commands.",
25
- })))
26
- .add(HttpApiEndpoint.get("project.current", `${root}/current`, {
27
- query: LocationQuery,
28
- success: Project.Current,
29
- })
30
- .annotateMerge(locationQueryOpenApi)
31
- .annotateMerge(OpenApi.annotations({
32
- identifier: "v2.project.current",
33
- summary: "Get current project",
34
- description: "Resolve the project for the requested location.",
35
24
  })))
36
25
  .annotateMerge(OpenApi.annotations({
37
26
  title: "project",
@@ -1,15 +1,15 @@
1
1
  import { Provider } from "@opencode/schema/provider";
2
- import { Location } from "@opencode/schema/location";
3
2
  import { Schema } from "effect";
4
3
  import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
5
4
  import { ProviderNotFoundError, ServiceUnavailableError } from "../errors.js";
6
5
  export declare const ProviderGroup: HttpApiGroup.HttpApiGroup<"server.provider", HttpApiEndpoint.HttpApiEndpoint<"provider.list", "GET", "/api/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 settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
15
15
  readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
@@ -67,7 +67,7 @@ export declare const ProviderGroup: HttpApiGroup.HttpApiGroup<"server.provider",
67
67
  readonly mode: Schema.Literal<"provider">;
68
68
  readonly threshold: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
69
69
  }>]>>, never, never>;
70
- readonly websocket: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
70
+ readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
71
71
  }> & {
72
72
  empty: (id: Provider.ID) => Provider.Info;
73
73
  }>;
@@ -88,10 +88,11 @@ export declare const ProviderGroup: HttpApiGroup.HttpApiGroup<"server.provider",
88
88
  }>>, Schema.toCodecStringTree<Schema.Struct<{
89
89
  readonly location: Schema.optional<Schema.Struct<{
90
90
  readonly directory: Schema.optional<Schema.String>;
91
- readonly workspace: Schema.optional<Schema.String>;
92
91
  }>>;
93
92
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
94
- readonly location: typeof Location.Info;
93
+ readonly location: Schema.Struct<{
94
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
95
+ }>;
95
96
  readonly data: Schema.Struct<{
96
97
  readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
97
98
  readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
@@ -149,7 +150,7 @@ export declare const ProviderGroup: HttpApiGroup.HttpApiGroup<"server.provider",
149
150
  readonly mode: Schema.Literal<"provider">;
150
151
  readonly threshold: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
151
152
  }>]>>, never, never>;
152
- readonly websocket: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
153
+ readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
153
154
  }> & {
154
155
  empty: (id: Provider.ID) => Provider.Info;
155
156
  };
@@ -12,7 +12,7 @@ export const ProviderGroup = HttpApiGroup.make("server.provider")
12
12
  })
13
13
  .annotateMerge(locationQueryOpenApi)
14
14
  .annotateMerge(OpenApi.annotations({
15
- identifier: "v2.provider.list",
15
+ identifier: "provider.list",
16
16
  summary: "List providers",
17
17
  description: "Retrieve active AI providers so clients can show provider availability and configuration.",
18
18
  })))
@@ -24,7 +24,7 @@ export const ProviderGroup = HttpApiGroup.make("server.provider")
24
24
  })
25
25
  .annotateMerge(locationQueryOpenApi)
26
26
  .annotateMerge(OpenApi.annotations({
27
- identifier: "v2.provider.get",
27
+ identifier: "provider.get",
28
28
  summary: "Get provider",
29
29
  description: "Retrieve a single AI provider so clients can inspect its availability and endpoint settings.",
30
30
  })))