@opencode/protocol 0.0.0-dev-21603 → 0.0.0-dev-21612

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.
package/dist/api.d.ts CHANGED
@@ -27,20 +27,21 @@ import { Authorization } from "./middleware/authorization.js";
27
27
  import { makeLocationGroup } from "./groups/location.js";
28
28
  import { IntegrationGroup } from "./groups/integration.js";
29
29
  import { WebSearchGroup } from "./groups/websearch.js";
30
- import { McpGroup } from "./groups/mcp.js";
30
+ import { makeMcpGroup } from "./groups/mcp.js";
31
31
  import { CredentialGroup } from "./groups/credential.js";
32
32
  import { ProjectGroup } from "./groups/project.js";
33
33
  import { WorktreeGroup } from "./groups/worktree.js";
34
34
  import { VcsGroup } from "./groups/vcs.js";
35
35
  import { MigrationGroup } from "./groups/migration.js";
36
36
  import { ConfigGroup } from "./groups/config.js";
37
- type LocationGroups<LocationId extends HttpApiMiddleware.AnyId> = HttpApiGroup.AddMiddleware<typeof AgentGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof PluginGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ModelGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ProviderGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof IntegrationGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof WebSearchGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof McpGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ProjectGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof FileSystemGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof CommandGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof SkillGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof RpcGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ShellGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ReferenceGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof VcsGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ConfigGroup, LocationId>;
37
+ type LocationGroups<LocationId extends HttpApiMiddleware.AnyId> = HttpApiGroup.AddMiddleware<typeof AgentGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof PluginGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ModelGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ProviderGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof IntegrationGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof WebSearchGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ProjectGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof FileSystemGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof CommandGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof SkillGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof RpcGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ShellGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ReferenceGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof VcsGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ConfigGroup, LocationId>;
38
38
  type PtyGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService> = ReturnType<typeof makePtyGroup<LocationId, LocationService>>;
39
+ type McpGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService> = ReturnType<typeof makeMcpGroup<LocationId, LocationService>>;
39
40
  type SessionGroups<SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService> = ReturnType<typeof makeSessionGroup<SessionLocationId, SessionLocationService, FormLocationId, FormLocationService>> | typeof MessageGroup;
40
41
  type FormGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService> = ReturnType<typeof makeFormGroup<LocationId, LocationService>>;
41
42
  type LocationGroup<LocationId extends HttpApiMiddleware.AnyId, LocationService> = ReturnType<typeof makeLocationGroup<LocationId, LocationService>>;
42
43
  type MixedMiddlewareGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService> = ReturnType<typeof makePermissionGroup<LocationId, LocationService, SessionLocationId, SessionLocationService>>;
43
- type ApiGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, Event extends HttpApiGroup.Constraint> = typeof ServerGroup | typeof DebugGroup | typeof MigrationGroup | typeof WorktreeGroup | typeof GenerateGroup | typeof VoiceGroup | typeof PersistentPtyGroup | typeof CredentialGroup | LocationGroups<LocationId> | LocationGroup<LocationId, LocationService> | PtyGroups<LocationId, LocationService> | FormGroups<LocationId, LocationService> | SessionGroups<SessionLocationId, SessionLocationService, FormLocationId, FormLocationService> | MixedMiddlewareGroups<LocationId, LocationService, SessionLocationId, SessionLocationService> | Event;
44
+ type ApiGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, Event extends HttpApiGroup.Constraint> = typeof ServerGroup | typeof DebugGroup | typeof MigrationGroup | typeof WorktreeGroup | typeof GenerateGroup | typeof VoiceGroup | typeof PersistentPtyGroup | typeof CredentialGroup | LocationGroups<LocationId> | LocationGroup<LocationId, LocationService> | PtyGroups<LocationId, LocationService> | McpGroups<LocationId, LocationService> | FormGroups<LocationId, LocationService> | SessionGroups<SessionLocationId, SessionLocationService, FormLocationId, FormLocationService> | MixedMiddlewareGroups<LocationId, LocationService, SessionLocationId, SessionLocationService> | Event;
44
45
  type EventGroupFor<Definitions extends ReadonlyArray<Definition>> = ReturnType<typeof makeEventGroup<Definitions>>;
45
46
  export type Api<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, Event extends HttpApiGroup.Constraint> = HttpApi.HttpApi<"server", HttpApiGroup.AddMiddleware<HttpApiGroup.AddMiddleware<ApiGroups<LocationId, LocationService, FormLocationId, FormLocationService, SessionLocationId, SessionLocationService, Event>, Authorization>, SchemaErrorMiddleware>>;
46
47
  export declare const makeApi: <const Definitions extends ReadonlyArray<Definition>, LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService>(options: {
package/dist/api.js CHANGED
@@ -26,7 +26,7 @@ import { Authorization } from "./middleware/authorization.js";
26
26
  import { makeLocationGroup } from "./groups/location.js";
27
27
  import { IntegrationGroup } from "./groups/integration.js";
28
28
  import { WebSearchGroup } from "./groups/websearch.js";
29
- import { McpGroup } from "./groups/mcp.js";
29
+ import { makeMcpGroup } from "./groups/mcp.js";
30
30
  import { CredentialGroup } from "./groups/credential.js";
31
31
  import { ProjectGroup } from "./groups/project.js";
32
32
  import { WorktreeGroup } from "./groups/worktree.js";
@@ -46,7 +46,7 @@ const makeApiFromGroup = (eventGroup, locationMiddleware, formLocationMiddleware
46
46
  .add(VoiceGroup)
47
47
  .add(ProviderGroup.middleware(locationMiddleware))
48
48
  .add(IntegrationGroup.middleware(locationMiddleware))
49
- .add(McpGroup.middleware(locationMiddleware))
49
+ .add(makeMcpGroup(locationMiddleware))
50
50
  .add(CredentialGroup)
51
51
  .add(ProjectGroup.middleware(locationMiddleware))
52
52
  .add(makeFormGroup(locationMiddleware))
package/dist/client.js CHANGED
@@ -45,5 +45,11 @@ export const groupNames = {
45
45
  "server.vcs": "vcs",
46
46
  "server.config": "config",
47
47
  };
48
- export const promiseOmitEndpoints = new Set(["pty.connect", "persistentPty.connect"]);
49
- export const effectOmitEndpoints = new Set(["fs.read", "fs.write", "pty.connect", "persistentPty.connect"]);
48
+ export const promiseOmitEndpoints = new Set(["pty.connect", "persistentPty.connect", "mcp.client"]);
49
+ export const effectOmitEndpoints = new Set([
50
+ "fs.read",
51
+ "fs.write",
52
+ "pty.connect",
53
+ "persistentPty.connect",
54
+ "mcp.client",
55
+ ]);
@@ -1,28 +1,16 @@
1
1
  import { Mcp } from "@opencode/schema/mcp";
2
- import { Schema } from "effect";
3
- import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api";
4
- import { McpServerNotFoundError } from "../errors.js";
5
- export declare const McpGroup: HttpApiGroup.HttpApiGroup<"server.mcp", HttpApiEndpoint.HttpApiEndpoint<"mcp.add", "PUT", "/api/experimental/mcp/:server", Schema.toCodecStringTree<Schema.Struct<{
2
+ import { Context, Schema } from "effect";
3
+ import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema } from "effect/http-api";
4
+ import { ForbiddenError, LocationNotFoundError, McpServerNotFoundError } from "../errors.js";
5
+ export declare const MCP_CLIENT_PATH = "/api/experimental/client-mcp";
6
+ export declare function hasMcpClientTicketURL(url: URL): boolean;
7
+ export declare const makeMcpGroup: <LocationId extends HttpApiMiddleware.AnyId, LocationService>(locationMiddleware: Context.Key<LocationId, LocationService>) => HttpApiGroup.HttpApiGroup<"server.mcp", HttpApiEndpoint.HttpApiEndpoint<"mcp.remove", "DELETE", "/api/experimental/mcp/:server", Schema.toCodecStringTree<Schema.Struct<{
6
8
  server: Schema.String;
7
9
  }>>, Schema.toCodecStringTree<Schema.Struct<{
8
10
  readonly location: Schema.optional<Schema.Struct<{
9
11
  readonly directory: Schema.optional<Schema.String>;
10
12
  }>>;
11
- }>>, Schema.toCodecJson<Schema.Struct<{
12
- readonly config: Schema.toTaggedUnion<"type", readonly [typeof Mcp.LocalConfig, typeof Mcp.RemoteConfig]>;
13
- }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"mcp.connect", "POST", "/api/experimental/mcp/:server/connect", Schema.toCodecStringTree<Schema.Struct<{
14
- server: Schema.String;
15
- }>>, Schema.toCodecStringTree<Schema.Struct<{
16
- readonly location: Schema.optional<Schema.Struct<{
17
- readonly directory: Schema.optional<Schema.String>;
18
- }>>;
19
- }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof McpServerNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"mcp.disconnect", "POST", "/api/experimental/mcp/:server/disconnect", Schema.toCodecStringTree<Schema.Struct<{
20
- server: Schema.String;
21
- }>>, Schema.toCodecStringTree<Schema.Struct<{
22
- readonly location: Schema.optional<Schema.Struct<{
23
- readonly directory: Schema.optional<Schema.String>;
24
- }>>;
25
- }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof McpServerNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"mcp.list", "GET", "/api/mcp", never, Schema.toCodecStringTree<Schema.Struct<{
13
+ }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof McpServerNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"mcp.list", "GET", "/api/mcp", never, Schema.toCodecStringTree<Schema.Struct<{
26
14
  readonly location: Schema.optional<Schema.Struct<{
27
15
  readonly directory: Schema.optional<Schema.String>;
28
16
  }>>;
@@ -47,13 +35,7 @@ export declare const McpGroup: HttpApiGroup.HttpApiGroup<"server.mcp", HttpApiEn
47
35
  }>]>;
48
36
  readonly integrationID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Integration.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Integration.ID">>, never, never>;
49
37
  }>>;
50
- }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"mcp.remove", "DELETE", "/api/experimental/mcp/:server", Schema.toCodecStringTree<Schema.Struct<{
51
- server: Schema.String;
52
- }>>, Schema.toCodecStringTree<Schema.Struct<{
53
- readonly location: Schema.optional<Schema.Struct<{
54
- readonly directory: Schema.optional<Schema.String>;
55
- }>>;
56
- }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof McpServerNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"mcp.resource.catalog", "GET", "/api/mcp/resource", never, Schema.toCodecStringTree<Schema.Struct<{
38
+ }>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"mcp.resource.catalog", "GET", "/api/mcp/resource", never, Schema.toCodecStringTree<Schema.Struct<{
57
39
  readonly location: Schema.optional<Schema.Struct<{
58
40
  readonly directory: Schema.optional<Schema.String>;
59
41
  }>>;
@@ -77,4 +59,45 @@ export declare const McpGroup: HttpApiGroup.HttpApiGroup<"server.mcp", HttpApiEn
77
59
  readonly mimeType: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
78
60
  }>>;
79
61
  }>;
80
- }>>, never, never, never>, false>;
62
+ }>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"mcp.connect", "POST", "/api/experimental/mcp/:server/connect", Schema.toCodecStringTree<Schema.Struct<{
63
+ server: Schema.String;
64
+ }>>, Schema.toCodecStringTree<Schema.Struct<{
65
+ readonly location: Schema.optional<Schema.Struct<{
66
+ readonly directory: Schema.optional<Schema.String>;
67
+ }>>;
68
+ }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof McpServerNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"mcp.disconnect", "POST", "/api/experimental/mcp/:server/disconnect", Schema.toCodecStringTree<Schema.Struct<{
69
+ server: Schema.String;
70
+ }>>, Schema.toCodecStringTree<Schema.Struct<{
71
+ readonly location: Schema.optional<Schema.Struct<{
72
+ readonly directory: Schema.optional<Schema.String>;
73
+ }>>;
74
+ }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof McpServerNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"mcp.clientToken", "POST", "/api/experimental/client-mcp/token", never, Schema.toCodecStringTree<Schema.Struct<{
75
+ readonly location: Schema.optional<Schema.Struct<{
76
+ readonly directory: Schema.optional<Schema.String>;
77
+ }>>;
78
+ readonly name: Schema.String;
79
+ }>>, never, Schema.toCodecStringTree<Schema.Struct<{
80
+ readonly "x-opencode-ticket": Schema.optional<Schema.String>;
81
+ }>>, Schema.toCodecJson<Schema.Struct<{
82
+ readonly location: Schema.Struct<{
83
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
84
+ }>;
85
+ readonly data: Schema.Struct<{
86
+ readonly ticket: Schema.String;
87
+ readonly expires_in: Schema.Int;
88
+ }>;
89
+ }>>, Schema.toCodecJson<typeof ForbiddenError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"mcp.add", "PUT", "/api/experimental/mcp/:server", Schema.toCodecStringTree<Schema.Struct<{
90
+ server: Schema.String;
91
+ }>>, Schema.toCodecStringTree<Schema.Struct<{
92
+ readonly location: Schema.optional<Schema.Struct<{
93
+ readonly directory: Schema.optional<Schema.String>;
94
+ }>>;
95
+ }>>, Schema.toCodecJson<Schema.Struct<{
96
+ readonly config: Schema.toTaggedUnion<"type", readonly [typeof Mcp.LocalConfig, typeof Mcp.RemoteConfig]>;
97
+ }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"mcp.client", "GET", "/api/experimental/client-mcp", never, Schema.toCodecStringTree<Schema.Struct<{
98
+ readonly location: Schema.optional<Schema.Struct<{
99
+ readonly directory: Schema.optional<Schema.String>;
100
+ }>>;
101
+ readonly name: Schema.String;
102
+ readonly ticket: Schema.optional<Schema.String>;
103
+ }>>, never, never, Schema.toCodecJson<Schema.Boolean>, Schema.toCodecJson<typeof LocationNotFoundError | typeof ForbiddenError>, never, never>, false>;
@@ -1,10 +1,20 @@
1
1
  import { Mcp } from "@opencode/schema/mcp";
2
2
  import { Location } from "@opencode/schema/location";
3
- import { Schema } from "effect";
4
- import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
5
- import { McpServerNotFoundError } from "../errors.js";
3
+ import { PtyTicket } from "@opencode/schema/pty-ticket";
4
+ import { Context, Schema } from "effect";
5
+ import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, OpenApi } from "effect/http-api";
6
+ import { ForbiddenError, LocationNotFoundError, McpServerNotFoundError } from "../errors.js";
6
7
  import { LocationQuery, locationQueryOpenApi } from "./location.js";
7
- export const McpGroup = HttpApiGroup.make("server.mcp")
8
+ import { PTY_CONNECT_TICKET_QUERY, PTY_CONNECT_TOKEN_HEADER } from "./pty.js";
9
+ export const MCP_CLIENT_PATH = "/api/experimental/client-mcp";
10
+ export function hasMcpClientTicketURL(url) {
11
+ return url.pathname === MCP_CLIENT_PATH && !!url.searchParams.get(PTY_CONNECT_TICKET_QUERY);
12
+ }
13
+ const McpClientQuery = Schema.Struct({
14
+ ...LocationQuery.fields,
15
+ name: Schema.String.check(Schema.isPattern(/^[a-zA-Z0-9_-]+$/)),
16
+ });
17
+ export const makeMcpGroup = (locationMiddleware) => HttpApiGroup.make("server.mcp")
8
18
  .add(HttpApiEndpoint.get("mcp.list", "/api/mcp", {
9
19
  query: LocationQuery,
10
20
  success: Location.response(Schema.Array(Mcp.Server)),
@@ -74,5 +84,31 @@ export const McpGroup = HttpApiGroup.make("server.mcp")
74
84
  identifier: "mcp.resource.catalog",
75
85
  summary: "List MCP resources",
76
86
  description: "Retrieve resources and resource templates from connected MCP servers.",
87
+ })))
88
+ .add(HttpApiEndpoint.post("mcp.clientToken", `${MCP_CLIENT_PATH}/token`, {
89
+ query: McpClientQuery,
90
+ headers: Schema.Struct({ [PTY_CONNECT_TOKEN_HEADER]: Schema.optional(Schema.String) }),
91
+ success: Location.response(PtyTicket.ConnectToken),
92
+ error: ForbiddenError,
93
+ })
94
+ .annotateMerge(locationQueryOpenApi)
95
+ .annotateMerge(OpenApi.annotations({
96
+ identifier: "experimental.mcp.client.token",
97
+ summary: "Create client MCP WebSocket token",
98
+ description: "Create a short-lived single-use ticket for opening a client MCP WebSocket connection from a browser.",
99
+ })))
100
+ // The client handler checks origin and ticket before it boots the location itself.
101
+ .middleware(locationMiddleware)
102
+ .add(HttpApiEndpoint.get("mcp.client", MCP_CLIENT_PATH, {
103
+ query: Schema.Struct({ ...McpClientQuery.fields, [PTY_CONNECT_TICKET_QUERY]: Schema.optional(Schema.String) }),
104
+ success: Schema.Boolean,
105
+ error: [ForbiddenError, LocationNotFoundError],
106
+ })
107
+ .annotateMerge(locationQueryOpenApi)
108
+ .annotateMerge(OpenApi.annotations({
109
+ identifier: "experimental.mcp.client",
110
+ summary: "Attach client MCP server",
111
+ description: "Upgrade to a WebSocket over which the client hosts an MCP server named after `name`; its tools stay available while the socket is open. One JSON-RPC message per text frame. Experimental: may change without compatibility guarantees.",
112
+ transform: (operation) => ({ ...operation, "x-websocket": true }),
77
113
  })))
78
114
  .annotateMerge(OpenApi.annotations({ title: "mcp", description: "MCP server and resource routes." }));
@@ -51,7 +51,11 @@ export declare const makePermissionGroup: <LocationId extends HttpApiMiddleware.
51
51
  readonly updated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
52
52
  }>;
53
53
  }>>;
54
- }>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"permission.saved.update", "PATCH", "/api/permission/saved/:id", Schema.toCodecStringTree<Schema.Struct<{
54
+ }>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"permission.saved.remove", "DELETE", "/api/permission/saved/:id", Schema.toCodecStringTree<Schema.Struct<{
55
+ id: Schema.brand<Schema.String, "PermissionSaved.ID"> & {
56
+ create: () => string & import("effect/Brand").Brand<"PermissionSaved.ID">;
57
+ };
58
+ }>>, never, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"permission.saved.update", "PATCH", "/api/permission/saved/:id", Schema.toCodecStringTree<Schema.Struct<{
55
59
  id: Schema.brand<Schema.String, "PermissionSaved.ID"> & {
56
60
  create: () => string & import("effect/Brand").Brand<"PermissionSaved.ID">;
57
61
  };
@@ -73,11 +77,7 @@ export declare const makePermissionGroup: <LocationId extends HttpApiMiddleware.
73
77
  readonly updated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
74
78
  }>;
75
79
  }>;
76
- }>>, Schema.toCodecJson<typeof ConflictError | typeof PermissionSavedNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"permission.saved.remove", "DELETE", "/api/permission/saved/:id", Schema.toCodecStringTree<Schema.Struct<{
77
- id: Schema.brand<Schema.String, "PermissionSaved.ID"> & {
78
- create: () => string & import("effect/Brand").Brand<"PermissionSaved.ID">;
79
- };
80
- }>>, never, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"session.permission.create", "POST", "/api/session/:sessionID/permission", Schema.toCodecStringTree<Schema.Struct<{
80
+ }>>, Schema.toCodecJson<typeof ConflictError | typeof PermissionSavedNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"session.permission.create", "POST", "/api/session/:sessionID/permission", Schema.toCodecStringTree<Schema.Struct<{
81
81
  sessionID: Schema.brand<Schema.String, "SessionID"> & {
82
82
  create: () => string & import("effect/Brand").Brand<"SessionID">;
83
83
  descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
@@ -6,7 +6,7 @@ export declare const PTY_CONNECT_TOKEN_HEADER = "x-opencode-ticket";
6
6
  export declare const PTY_CONNECT_TOKEN_HEADER_VALUE = "1";
7
7
  export declare const PTY_CONNECT_PATH = "/api/pty/:ptyID/connect";
8
8
  export declare function hasPtyConnectTicketURL(url: URL): boolean;
9
- export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId, LocationService>(locationMiddleware: Context.Key<LocationId, LocationService>) => HttpApiGroup.HttpApiGroup<"server.pty", HttpApiEndpoint.HttpApiEndpoint<"pty.connectToken", "POST", "/api/pty/:ptyID/connect-token", Schema.toCodecStringTree<Schema.Struct<{
9
+ export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId, LocationService>(locationMiddleware: Context.Key<LocationId, LocationService>) => HttpApiGroup.HttpApiGroup<"server.pty", HttpApiEndpoint.HttpApiEndpoint<"pty.remove", "DELETE", "/api/pty/:ptyID", Schema.toCodecStringTree<Schema.Struct<{
10
10
  ptyID: Schema.brand<Schema.String, "PtyID"> & {
11
11
  create: () => string & import("effect/Brand").Brand<"PtyID">;
12
12
  ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
@@ -15,31 +15,15 @@ export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId,
15
15
  readonly location: Schema.optional<Schema.Struct<{
16
16
  readonly directory: Schema.optional<Schema.String>;
17
17
  }>>;
18
- }>>, never, Schema.toCodecStringTree<Schema.Struct<{
19
- readonly "x-opencode-ticket": Schema.optional<Schema.String>;
20
- }>>, Schema.toCodecJson<Schema.Struct<{
21
- readonly location: Schema.Struct<{
22
- readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
23
- }>;
24
- readonly data: Schema.Struct<{
25
- readonly ticket: Schema.String;
26
- readonly expires_in: Schema.Int;
27
- }>;
28
- }>>, Schema.toCodecJson<typeof ForbiddenError | typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.create", "POST", "/api/pty", never, Schema.toCodecStringTree<Schema.Struct<{
18
+ }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.list", "GET", "/api/pty", never, Schema.toCodecStringTree<Schema.Struct<{
29
19
  readonly location: Schema.optional<Schema.Struct<{
30
20
  readonly directory: Schema.optional<Schema.String>;
31
21
  }>>;
32
- }>>, Schema.toCodecJson<Schema.Struct<{
33
- readonly command: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
34
- readonly args: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
35
- readonly cwd: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
36
- readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
37
- readonly env: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
38
- }>>, never, Schema.toCodecJson<Schema.Struct<{
22
+ }>>, never, never, Schema.toCodecJson<Schema.Struct<{
39
23
  readonly location: Schema.Struct<{
40
24
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
41
25
  }>;
42
- readonly data: Schema.Struct<{
26
+ readonly data: Schema.$Array<Schema.Struct<{
43
27
  readonly id: Schema.brand<Schema.String, "PtyID"> & {
44
28
  create: () => string & import("effect/Brand").Brand<"PtyID">;
45
29
  ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
@@ -51,7 +35,7 @@ export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId,
51
35
  readonly status: Schema.Literals<readonly ["running", "exited"]>;
52
36
  readonly pid: Schema.Int;
53
37
  readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
54
- }>;
38
+ }>>;
55
39
  }>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.get", "GET", "/api/pty/:ptyID", Schema.toCodecStringTree<Schema.Struct<{
56
40
  ptyID: Schema.brand<Schema.String, "PtyID"> & {
57
41
  create: () => string & import("effect/Brand").Brand<"PtyID">;
@@ -78,15 +62,21 @@ export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId,
78
62
  readonly pid: Schema.Int;
79
63
  readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
80
64
  }>;
81
- }>>, Schema.toCodecJson<typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.list", "GET", "/api/pty", never, Schema.toCodecStringTree<Schema.Struct<{
65
+ }>>, Schema.toCodecJson<typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.create", "POST", "/api/pty", never, Schema.toCodecStringTree<Schema.Struct<{
82
66
  readonly location: Schema.optional<Schema.Struct<{
83
67
  readonly directory: Schema.optional<Schema.String>;
84
68
  }>>;
85
- }>>, never, never, Schema.toCodecJson<Schema.Struct<{
69
+ }>>, Schema.toCodecJson<Schema.Struct<{
70
+ readonly command: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
71
+ readonly args: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
72
+ readonly cwd: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
73
+ readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
74
+ readonly env: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
75
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
86
76
  readonly location: Schema.Struct<{
87
77
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
88
78
  }>;
89
- readonly data: Schema.$Array<Schema.Struct<{
79
+ readonly data: Schema.Struct<{
90
80
  readonly id: Schema.brand<Schema.String, "PtyID"> & {
91
81
  create: () => string & import("effect/Brand").Brand<"PtyID">;
92
82
  ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
@@ -98,8 +88,8 @@ export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId,
98
88
  readonly status: Schema.Literals<readonly ["running", "exited"]>;
99
89
  readonly pid: Schema.Int;
100
90
  readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
101
- }>>;
102
- }>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.remove", "DELETE", "/api/pty/:ptyID", Schema.toCodecStringTree<Schema.Struct<{
91
+ }>;
92
+ }>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.connectToken", "POST", "/api/pty/:ptyID/connect-token", Schema.toCodecStringTree<Schema.Struct<{
103
93
  ptyID: Schema.brand<Schema.String, "PtyID"> & {
104
94
  create: () => string & import("effect/Brand").Brand<"PtyID">;
105
95
  ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
@@ -108,7 +98,17 @@ export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId,
108
98
  readonly location: Schema.optional<Schema.Struct<{
109
99
  readonly directory: Schema.optional<Schema.String>;
110
100
  }>>;
111
- }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.update", "PUT", "/api/pty/:ptyID", Schema.toCodecStringTree<Schema.Struct<{
101
+ }>>, never, Schema.toCodecStringTree<Schema.Struct<{
102
+ readonly "x-opencode-ticket": Schema.optional<Schema.String>;
103
+ }>>, Schema.toCodecJson<Schema.Struct<{
104
+ readonly location: Schema.Struct<{
105
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
106
+ }>;
107
+ readonly data: Schema.Struct<{
108
+ readonly ticket: Schema.String;
109
+ readonly expires_in: Schema.Int;
110
+ }>;
111
+ }>>, Schema.toCodecJson<typeof ForbiddenError | typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.update", "PUT", "/api/pty/:ptyID", Schema.toCodecStringTree<Schema.Struct<{
112
112
  ptyID: Schema.brand<Schema.String, "PtyID"> & {
113
113
  create: () => string & import("effect/Brand").Brand<"PtyID">;
114
114
  ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
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": "0.0.0-dev-21603",
4
+ "version": "0.0.0-dev-21612",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -33,7 +33,7 @@
33
33
  "typecheck": "tsc --noEmit"
34
34
  },
35
35
  "dependencies": {
36
- "@opencode/schema": "0.0.0-dev-21603",
36
+ "@opencode/schema": "0.0.0-dev-21612",
37
37
  "effect": "4.0.1"
38
38
  },
39
39
  "devDependencies": {