@opencode-ai/protocol 0.0.0-next-14854 → 0.0.0-reserved.0

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 (63) hide show
  1. package/README.md +3 -0
  2. package/index.js +1 -0
  3. package/package.json +3 -23
  4. package/dist/api.d.ts +0 -49
  5. package/dist/api.js +0 -65
  6. package/dist/client.d.ts +0 -75
  7. package/dist/client.js +0 -61
  8. package/dist/errors.d.ts +0 -127
  9. package/dist/errors.js +0 -99
  10. package/dist/groups/agent.d.ts +0 -95
  11. package/dist/groups/agent.js +0 -15
  12. package/dist/groups/command.d.ts +0 -51
  13. package/dist/groups/command.js +0 -20
  14. package/dist/groups/credential.d.ts +0 -23
  15. package/dist/groups/credential.js +0 -28
  16. package/dist/groups/event.d.ts +0 -17224
  17. package/dist/groups/event.js +0 -49
  18. package/dist/groups/form.d.ts +0 -789
  19. package/dist/groups/form.js +0 -99
  20. package/dist/groups/fs.d.ts +0 -35
  21. package/dist/groups/fs.js +0 -51
  22. package/dist/groups/generate.d.ts +0 -32
  23. package/dist/groups/generate.js +0 -27
  24. package/dist/groups/health.d.ts +0 -5
  25. package/dist/groups/health.js +0 -9
  26. package/dist/groups/integration.d.ts +0 -105
  27. package/dist/groups/integration.js +0 -98
  28. package/dist/groups/location.d.ts +0 -16
  29. package/dist/groups/location.js +0 -32
  30. package/dist/groups/mcp.d.ts +0 -30
  31. package/dist/groups/mcp.js +0 -17
  32. package/dist/groups/message.d.ts +0 -446
  33. package/dist/groups/message.js +0 -42
  34. package/dist/groups/model.d.ts +0 -312
  35. package/dist/groups/model.js +0 -33
  36. package/dist/groups/permission.d.ts +0 -153
  37. package/dist/groups/permission.js +0 -99
  38. package/dist/groups/plugin.d.ts +0 -14
  39. package/dist/groups/plugin.js +0 -20
  40. package/dist/groups/project-copy.d.ts +0 -49
  41. package/dist/groups/project-copy.js +0 -44
  42. package/dist/groups/project.d.ts +0 -24
  43. package/dist/groups/project.js +0 -30
  44. package/dist/groups/provider.d.ts +0 -164
  45. package/dist/groups/provider.js +0 -34
  46. package/dist/groups/pty.d.ts +0 -145
  47. package/dist/groups/pty.js +0 -111
  48. package/dist/groups/question.d.ts +0 -92
  49. package/dist/groups/question.js +0 -56
  50. package/dist/groups/reference.d.ts +0 -13
  51. package/dist/groups/reference.js +0 -20
  52. package/dist/groups/session.d.ts +0 -5457
  53. package/dist/groups/session.js +0 -423
  54. package/dist/groups/shell.d.ts +0 -120
  55. package/dist/groups/shell.js +0 -65
  56. package/dist/groups/skill.d.ts +0 -19
  57. package/dist/groups/skill.js +0 -20
  58. package/dist/groups/vcs.d.ts +0 -33
  59. package/dist/groups/vcs.js +0 -37
  60. package/dist/middleware/authorization.d.ts +0 -13
  61. package/dist/middleware/authorization.js +0 -6
  62. package/dist/middleware/schema-error.d.ts +0 -13
  63. package/dist/middleware/schema-error.js +0 -4
@@ -1,49 +0,0 @@
1
- import { Schema } from "effect";
2
- import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
3
- declare const ProjectCopyError_base: Schema.Class<ProjectCopyError, Schema.Struct<{
4
- readonly name: Schema.Literal<"ProjectCopyError">;
5
- readonly data: Schema.Struct<{
6
- readonly message: Schema.String;
7
- readonly forceRequired: Schema.optional<Schema.Boolean>;
8
- }>;
9
- }>, import("effect/Cause").YieldableError>;
10
- export declare class ProjectCopyError extends ProjectCopyError_base {
11
- }
12
- export declare const ProjectCopyGroup: HttpApiGroup.HttpApiGroup<"server.projectCopy", HttpApiEndpoint.HttpApiEndpoint<"projectCopy.create", "POST", "/experimental/project/:projectID/copy", HttpApiEndpoint.StringTree<Schema.Struct<{
13
- projectID: Schema.brand<Schema.String, "Project.ID"> & {
14
- global: string & import("effect/Brand").Brand<"Project.ID">;
15
- };
16
- }>>, HttpApiEndpoint.StringTree<Schema.Struct<{
17
- readonly location: Schema.optional<Schema.Struct<{
18
- readonly directory: Schema.optional<Schema.String>;
19
- readonly workspace: Schema.optional<Schema.String>;
20
- }>>;
21
- }>>, HttpApiEndpoint.Json<Schema.Struct<{
22
- readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
23
- readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
24
- readonly strategy: Schema.brand<Schema.Trim, "ProjectCopy.StrategyID">;
25
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
26
- readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
27
- }>>, HttpApiEndpoint.Json<typeof ProjectCopyError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"projectCopy.remove", "DELETE", "/experimental/project/:projectID/copy", HttpApiEndpoint.StringTree<Schema.Struct<{
28
- projectID: Schema.brand<Schema.String, "Project.ID"> & {
29
- global: string & import("effect/Brand").Brand<"Project.ID">;
30
- };
31
- }>>, HttpApiEndpoint.StringTree<Schema.Struct<{
32
- readonly location: Schema.optional<Schema.Struct<{
33
- readonly directory: Schema.optional<Schema.String>;
34
- readonly workspace: Schema.optional<Schema.String>;
35
- }>>;
36
- }>>, HttpApiEndpoint.Json<Schema.Struct<{
37
- readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
38
- readonly force: Schema.Boolean;
39
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<HttpApiSchema.NoContent>, HttpApiEndpoint.Json<typeof ProjectCopyError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"projectCopy.refresh", "POST", "/experimental/project/:projectID/copy/refresh", HttpApiEndpoint.StringTree<Schema.Struct<{
40
- projectID: Schema.brand<Schema.String, "Project.ID"> & {
41
- global: string & import("effect/Brand").Brand<"Project.ID">;
42
- };
43
- }>>, HttpApiEndpoint.StringTree<Schema.Struct<{
44
- readonly location: Schema.optional<Schema.Struct<{
45
- readonly directory: Schema.optional<Schema.String>;
46
- readonly workspace: Schema.optional<Schema.String>;
47
- }>>;
48
- }>>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<HttpApiSchema.NoContent>, HttpApiEndpoint.Json<typeof ProjectCopyError>, never, never>, false>;
49
- export {};
@@ -1,44 +0,0 @@
1
- import { ProjectCopy } from "@opencode-ai/schema/project-copy";
2
- import { Project } from "@opencode-ai/schema/project";
3
- import { Schema, Struct } from "effect";
4
- import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
5
- import { LocationQuery, locationQueryOpenApi } from "./location.js";
6
- const root = "/experimental/project/:projectID/copy";
7
- export class ProjectCopyError extends Schema.ErrorClass("ProjectCopyError")({
8
- name: Schema.Literal("ProjectCopyError"),
9
- data: Schema.Struct({
10
- message: Schema.String,
11
- forceRequired: Schema.optional(Schema.Boolean),
12
- }),
13
- }, { httpApiStatus: 400 }) {
14
- }
15
- const CreatePayload = Schema.Struct(Struct.omit(ProjectCopy.CreateInput.fields, ["projectID", "sourceDirectory"]));
16
- const RemovePayload = Schema.Struct(Struct.omit(ProjectCopy.RemoveInput.fields, ["projectID"]));
17
- export const ProjectCopyGroup = HttpApiGroup.make("server.projectCopy")
18
- .add(HttpApiEndpoint.post("projectCopy.create", root, {
19
- params: { projectID: Project.ID },
20
- query: LocationQuery,
21
- payload: CreatePayload,
22
- success: ProjectCopy.Copy,
23
- error: ProjectCopyError,
24
- })
25
- .annotateMerge(locationQueryOpenApi)
26
- .annotateMerge(OpenApi.annotations({ identifier: "v2.projectCopy.create" })))
27
- .add(HttpApiEndpoint.delete("projectCopy.remove", root, {
28
- params: { projectID: Project.ID },
29
- query: LocationQuery,
30
- payload: RemovePayload,
31
- success: HttpApiSchema.NoContent,
32
- error: ProjectCopyError,
33
- })
34
- .annotateMerge(locationQueryOpenApi)
35
- .annotateMerge(OpenApi.annotations({ identifier: "v2.projectCopy.remove" })))
36
- .add(HttpApiEndpoint.post("projectCopy.refresh", `${root}/refresh`, {
37
- params: { projectID: Project.ID },
38
- query: LocationQuery,
39
- success: HttpApiSchema.NoContent,
40
- error: ProjectCopyError,
41
- })
42
- .annotateMerge(locationQueryOpenApi)
43
- .annotateMerge(OpenApi.annotations({ identifier: "v2.projectCopy.refresh" })))
44
- .annotateMerge(OpenApi.annotations({ title: "projectCopy", description: "Project copy management routes." }));
@@ -1,24 +0,0 @@
1
- import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
2
- export declare const ProjectGroup: HttpApiGroup.HttpApiGroup<"server.project", HttpApiEndpoint.HttpApiEndpoint<"project.current", "GET", "/api/project/current", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
3
- readonly location: import("effect/Schema").optional<import("effect/Schema").Struct<{
4
- readonly directory: import("effect/Schema").optional<import("effect/Schema").String>;
5
- readonly workspace: import("effect/Schema").optional<import("effect/Schema").String>;
6
- }>>;
7
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
8
- readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Project.ID"> & {
9
- global: string & import("effect/Brand").Brand<"Project.ID">;
10
- };
11
- readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
12
- }>>, HttpApiEndpoint.Json<never>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"project.directories", "GET", "/api/project/:projectID/directories", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
13
- projectID: import("effect/Schema").brand<import("effect/Schema").String, "Project.ID"> & {
14
- global: string & import("effect/Brand").Brand<"Project.ID">;
15
- };
16
- }>>, HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
17
- readonly location: import("effect/Schema").optional<import("effect/Schema").Struct<{
18
- readonly directory: import("effect/Schema").optional<import("effect/Schema").String>;
19
- readonly workspace: import("effect/Schema").optional<import("effect/Schema").String>;
20
- }>>;
21
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").$Array<import("effect/Schema").Struct<{
22
- readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
23
- readonly strategy: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
24
- }>>>, HttpApiEndpoint.Json<never>, never, never>, false>;
@@ -1,30 +0,0 @@
1
- import { Project } from "@opencode-ai/schema/project";
2
- import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
3
- import { LocationQuery, locationQueryOpenApi } from "./location.js";
4
- const root = "/api/project";
5
- export const ProjectGroup = HttpApiGroup.make("server.project")
6
- .add(HttpApiEndpoint.get("project.current", `${root}/current`, {
7
- query: LocationQuery,
8
- success: Project.Current,
9
- })
10
- .annotateMerge(locationQueryOpenApi)
11
- .annotateMerge(OpenApi.annotations({
12
- identifier: "v2.project.current",
13
- summary: "Get current project",
14
- description: "Resolve the project for the requested location.",
15
- })))
16
- .add(HttpApiEndpoint.get("project.directories", `${root}/:projectID/directories`, {
17
- params: { projectID: Project.ID },
18
- query: LocationQuery,
19
- success: Project.Directories,
20
- })
21
- .annotateMerge(locationQueryOpenApi)
22
- .annotateMerge(OpenApi.annotations({
23
- identifier: "v2.project.directories",
24
- summary: "List project directories",
25
- description: "List known local absolute directories for a project.",
26
- })))
27
- .annotateMerge(OpenApi.annotations({
28
- title: "projects",
29
- description: "Location-scoped project routes.",
30
- }));
@@ -1,164 +0,0 @@
1
- import { Provider } from "@opencode-ai/schema/provider";
2
- import { Location } from "@opencode-ai/schema/location";
3
- import { Schema } from "effect";
4
- import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
5
- import { ProviderNotFoundError, ServiceUnavailableError } from "../errors.js";
6
- export declare const ProviderGroup: HttpApiGroup.HttpApiGroup<"server.provider", HttpApiEndpoint.HttpApiEndpoint<"provider.list", "GET", "/api/provider", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<Schema.Struct<{
7
- readonly location: Schema.optional<Schema.Struct<{
8
- readonly directory: Schema.optional<Schema.String>;
9
- readonly workspace: Schema.optional<Schema.String>;
10
- }>>;
11
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
12
- readonly location: typeof Location.Info;
13
- readonly data: Schema.$Array<Schema.Struct<{
14
- readonly id: Schema.brand<Schema.String, "ProviderV2.ID"> & {
15
- opencode: string & import("effect/Brand").Brand<"ProviderV2.ID">;
16
- anthropic: string & import("effect/Brand").Brand<"ProviderV2.ID">;
17
- openai: string & import("effect/Brand").Brand<"ProviderV2.ID">;
18
- google: string & import("effect/Brand").Brand<"ProviderV2.ID">;
19
- googleVertex: string & import("effect/Brand").Brand<"ProviderV2.ID">;
20
- githubCopilot: string & import("effect/Brand").Brand<"ProviderV2.ID">;
21
- amazonBedrock: string & import("effect/Brand").Brand<"ProviderV2.ID">;
22
- azure: string & import("effect/Brand").Brand<"ProviderV2.ID">;
23
- openrouter: string & import("effect/Brand").Brand<"ProviderV2.ID">;
24
- mistral: string & import("effect/Brand").Brand<"ProviderV2.ID">;
25
- gitlab: string & import("effect/Brand").Brand<"ProviderV2.ID">;
26
- };
27
- readonly integrationID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Integration.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Integration.ID">>, never, never>;
28
- readonly name: Schema.String;
29
- readonly disabled: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
30
- readonly api: Schema.Union<readonly [Schema.Struct<{
31
- readonly type: Schema.Literal<"aisdk">;
32
- readonly package: Schema.String;
33
- readonly url: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
34
- readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
35
- }>, Schema.Struct<{
36
- readonly type: Schema.Literal<"native">;
37
- readonly url: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
38
- readonly settings: Schema.$Record<Schema.String, Schema.Unknown>;
39
- }>]>;
40
- readonly request: Schema.Struct<{
41
- readonly settings: Schema.withConstructorDefault<Schema.$Record<Schema.String, Schema.Unknown>>;
42
- readonly headers: Schema.$Record<Schema.String, Schema.String>;
43
- readonly body: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
44
- }>;
45
- }> & {
46
- empty: (id: Provider.ID) => {
47
- readonly id: string & import("effect/Brand").Brand<"ProviderV2.ID">;
48
- readonly name: string;
49
- readonly api: {
50
- readonly type: "aisdk";
51
- readonly package: string;
52
- readonly url?: string | undefined;
53
- readonly settings?: {
54
- readonly [x: string]: unknown;
55
- } | undefined;
56
- } | {
57
- readonly type: "native";
58
- readonly settings: {
59
- readonly [x: string]: unknown;
60
- };
61
- readonly url?: string | undefined;
62
- };
63
- readonly request: {
64
- readonly settings: {
65
- readonly [x: string]: unknown;
66
- };
67
- readonly headers: {
68
- readonly [x: string]: string;
69
- };
70
- readonly body: {
71
- readonly [x: string]: Schema.Json;
72
- };
73
- };
74
- readonly integrationID?: (string & import("effect/Brand").Brand<"Integration.ID">) | undefined;
75
- readonly disabled?: boolean | undefined;
76
- };
77
- }>;
78
- }>>, HttpApiEndpoint.Json<typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"provider.get", "GET", "/api/provider/:providerID", HttpApiEndpoint.StringTree<Schema.Struct<{
79
- providerID: Schema.brand<Schema.String, "ProviderV2.ID"> & {
80
- opencode: string & import("effect/Brand").Brand<"ProviderV2.ID">;
81
- anthropic: string & import("effect/Brand").Brand<"ProviderV2.ID">;
82
- openai: string & import("effect/Brand").Brand<"ProviderV2.ID">;
83
- google: string & import("effect/Brand").Brand<"ProviderV2.ID">;
84
- googleVertex: string & import("effect/Brand").Brand<"ProviderV2.ID">;
85
- githubCopilot: string & import("effect/Brand").Brand<"ProviderV2.ID">;
86
- amazonBedrock: string & import("effect/Brand").Brand<"ProviderV2.ID">;
87
- azure: string & import("effect/Brand").Brand<"ProviderV2.ID">;
88
- openrouter: string & import("effect/Brand").Brand<"ProviderV2.ID">;
89
- mistral: string & import("effect/Brand").Brand<"ProviderV2.ID">;
90
- gitlab: string & import("effect/Brand").Brand<"ProviderV2.ID">;
91
- };
92
- }>>, HttpApiEndpoint.StringTree<Schema.Struct<{
93
- readonly location: Schema.optional<Schema.Struct<{
94
- readonly directory: Schema.optional<Schema.String>;
95
- readonly workspace: Schema.optional<Schema.String>;
96
- }>>;
97
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
98
- readonly location: typeof Location.Info;
99
- readonly data: Schema.Struct<{
100
- readonly id: Schema.brand<Schema.String, "ProviderV2.ID"> & {
101
- opencode: string & import("effect/Brand").Brand<"ProviderV2.ID">;
102
- anthropic: string & import("effect/Brand").Brand<"ProviderV2.ID">;
103
- openai: string & import("effect/Brand").Brand<"ProviderV2.ID">;
104
- google: string & import("effect/Brand").Brand<"ProviderV2.ID">;
105
- googleVertex: string & import("effect/Brand").Brand<"ProviderV2.ID">;
106
- githubCopilot: string & import("effect/Brand").Brand<"ProviderV2.ID">;
107
- amazonBedrock: string & import("effect/Brand").Brand<"ProviderV2.ID">;
108
- azure: string & import("effect/Brand").Brand<"ProviderV2.ID">;
109
- openrouter: string & import("effect/Brand").Brand<"ProviderV2.ID">;
110
- mistral: string & import("effect/Brand").Brand<"ProviderV2.ID">;
111
- gitlab: string & import("effect/Brand").Brand<"ProviderV2.ID">;
112
- };
113
- readonly integrationID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Integration.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Integration.ID">>, never, never>;
114
- readonly name: Schema.String;
115
- readonly disabled: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
116
- readonly api: Schema.Union<readonly [Schema.Struct<{
117
- readonly type: Schema.Literal<"aisdk">;
118
- readonly package: Schema.String;
119
- readonly url: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
120
- readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
121
- }>, Schema.Struct<{
122
- readonly type: Schema.Literal<"native">;
123
- readonly url: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
124
- readonly settings: Schema.$Record<Schema.String, Schema.Unknown>;
125
- }>]>;
126
- readonly request: Schema.Struct<{
127
- readonly settings: Schema.withConstructorDefault<Schema.$Record<Schema.String, Schema.Unknown>>;
128
- readonly headers: Schema.$Record<Schema.String, Schema.String>;
129
- readonly body: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
130
- }>;
131
- }> & {
132
- empty: (id: Provider.ID) => {
133
- readonly id: string & import("effect/Brand").Brand<"ProviderV2.ID">;
134
- readonly name: string;
135
- readonly api: {
136
- readonly type: "aisdk";
137
- readonly package: string;
138
- readonly url?: string | undefined;
139
- readonly settings?: {
140
- readonly [x: string]: unknown;
141
- } | undefined;
142
- } | {
143
- readonly type: "native";
144
- readonly settings: {
145
- readonly [x: string]: unknown;
146
- };
147
- readonly url?: string | undefined;
148
- };
149
- readonly request: {
150
- readonly settings: {
151
- readonly [x: string]: unknown;
152
- };
153
- readonly headers: {
154
- readonly [x: string]: string;
155
- };
156
- readonly body: {
157
- readonly [x: string]: Schema.Json;
158
- };
159
- };
160
- readonly integrationID?: (string & import("effect/Brand").Brand<"Integration.ID">) | undefined;
161
- readonly disabled?: boolean | undefined;
162
- };
163
- };
164
- }>>, HttpApiEndpoint.Json<typeof ServiceUnavailableError | typeof ProviderNotFoundError>, never, never>, false>;
@@ -1,34 +0,0 @@
1
- import { Provider } from "@opencode-ai/schema/provider";
2
- import { Location } from "@opencode-ai/schema/location";
3
- import { Schema } from "effect";
4
- import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
5
- import { ProviderNotFoundError, ServiceUnavailableError } from "../errors.js";
6
- import { LocationQuery, locationQueryOpenApi } from "./location.js";
7
- export const ProviderGroup = HttpApiGroup.make("server.provider")
8
- .add(HttpApiEndpoint.get("provider.list", "/api/provider", {
9
- query: LocationQuery,
10
- success: Location.response(Schema.Array(Provider.Info)),
11
- error: ServiceUnavailableError,
12
- })
13
- .annotateMerge(locationQueryOpenApi)
14
- .annotateMerge(OpenApi.annotations({
15
- identifier: "v2.provider.list",
16
- summary: "List providers",
17
- description: "Retrieve active AI providers so clients can show provider availability and configuration.",
18
- })))
19
- .add(HttpApiEndpoint.get("provider.get", "/api/provider/:providerID", {
20
- params: { providerID: Provider.ID },
21
- query: LocationQuery,
22
- success: Location.response(Provider.Info),
23
- error: [ProviderNotFoundError, ServiceUnavailableError],
24
- })
25
- .annotateMerge(locationQueryOpenApi)
26
- .annotateMerge(OpenApi.annotations({
27
- identifier: "v2.provider.get",
28
- summary: "Get provider",
29
- description: "Retrieve a single AI provider so clients can inspect its availability and endpoint settings.",
30
- })))
31
- .annotateMerge(OpenApi.annotations({
32
- title: "providers",
33
- description: "Experimental provider routes.",
34
- }));
@@ -1,145 +0,0 @@
1
- import { Location } from "@opencode-ai/schema/location";
2
- import { Schema } from "effect";
3
- import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
4
- import { ForbiddenError, PtyNotFoundError } from "../errors.js";
5
- export declare const PTY_CONNECT_TICKET_QUERY = "ticket";
6
- export declare const PTY_CONNECT_TOKEN_HEADER = "x-opencode-ticket";
7
- export declare const PTY_CONNECT_TOKEN_HEADER_VALUE = "1";
8
- export declare function hasPtyConnectTicketURL(url: URL): boolean;
9
- export declare const PtyGroup: HttpApiGroup.HttpApiGroup<"server.pty", HttpApiEndpoint.HttpApiEndpoint<"pty.list", "GET", "/api/pty", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<Schema.Struct<{
10
- readonly location: Schema.optional<Schema.Struct<{
11
- readonly directory: Schema.optional<Schema.String>;
12
- readonly workspace: Schema.optional<Schema.String>;
13
- }>>;
14
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
15
- readonly location: typeof Location.Info;
16
- readonly data: Schema.$Array<Schema.Struct<{
17
- readonly id: Schema.brand<Schema.String, "PtyID"> & {
18
- create: () => string & import("effect/Brand").Brand<"PtyID">;
19
- ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
20
- };
21
- readonly title: Schema.String;
22
- readonly command: Schema.String;
23
- readonly args: Schema.$Array<Schema.String>;
24
- readonly cwd: Schema.String;
25
- readonly status: Schema.Literals<readonly ["running", "exited"]>;
26
- readonly pid: Schema.Int;
27
- readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
28
- }>>;
29
- }>>, HttpApiEndpoint.Json<never>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"pty.create", "POST", "/api/pty", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<Schema.Struct<{
30
- readonly location: Schema.optional<Schema.Struct<{
31
- readonly directory: Schema.optional<Schema.String>;
32
- readonly workspace: Schema.optional<Schema.String>;
33
- }>>;
34
- }>>, HttpApiEndpoint.Json<Schema.Struct<{
35
- readonly command: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
36
- readonly args: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
37
- readonly cwd: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
38
- readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
39
- readonly env: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
40
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
41
- readonly location: typeof Location.Info;
42
- readonly data: Schema.Struct<{
43
- readonly id: Schema.brand<Schema.String, "PtyID"> & {
44
- create: () => string & import("effect/Brand").Brand<"PtyID">;
45
- ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
46
- };
47
- readonly title: Schema.String;
48
- readonly command: Schema.String;
49
- readonly args: Schema.$Array<Schema.String>;
50
- readonly cwd: Schema.String;
51
- readonly status: Schema.Literals<readonly ["running", "exited"]>;
52
- readonly pid: Schema.Int;
53
- readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
54
- }>;
55
- }>>, HttpApiEndpoint.Json<never>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"pty.get", "GET", "/api/pty/:ptyID", HttpApiEndpoint.StringTree<Schema.Struct<{
56
- ptyID: Schema.brand<Schema.String, "PtyID"> & {
57
- create: () => string & import("effect/Brand").Brand<"PtyID">;
58
- ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
59
- };
60
- }>>, HttpApiEndpoint.StringTree<Schema.Struct<{
61
- readonly location: Schema.optional<Schema.Struct<{
62
- readonly directory: Schema.optional<Schema.String>;
63
- readonly workspace: Schema.optional<Schema.String>;
64
- }>>;
65
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
66
- readonly location: typeof Location.Info;
67
- readonly data: Schema.Struct<{
68
- readonly id: Schema.brand<Schema.String, "PtyID"> & {
69
- create: () => string & import("effect/Brand").Brand<"PtyID">;
70
- ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
71
- };
72
- readonly title: Schema.String;
73
- readonly command: Schema.String;
74
- readonly args: Schema.$Array<Schema.String>;
75
- readonly cwd: Schema.String;
76
- readonly status: Schema.Literals<readonly ["running", "exited"]>;
77
- readonly pid: Schema.Int;
78
- readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
79
- }>;
80
- }>>, HttpApiEndpoint.Json<typeof PtyNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"pty.update", "PUT", "/api/pty/:ptyID", HttpApiEndpoint.StringTree<Schema.Struct<{
81
- ptyID: Schema.brand<Schema.String, "PtyID"> & {
82
- create: () => string & import("effect/Brand").Brand<"PtyID">;
83
- ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
84
- };
85
- }>>, HttpApiEndpoint.StringTree<Schema.Struct<{
86
- readonly location: Schema.optional<Schema.Struct<{
87
- readonly directory: Schema.optional<Schema.String>;
88
- readonly workspace: Schema.optional<Schema.String>;
89
- }>>;
90
- }>>, HttpApiEndpoint.Json<Schema.Struct<{
91
- readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
92
- readonly size: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
93
- readonly rows: Schema.Int;
94
- readonly cols: Schema.Int;
95
- }>>>, Schema.optionalKey<Schema.Struct<{
96
- readonly rows: Schema.Int;
97
- readonly cols: Schema.Int;
98
- }>>, never, never>;
99
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
100
- readonly location: typeof Location.Info;
101
- readonly data: Schema.Struct<{
102
- readonly id: Schema.brand<Schema.String, "PtyID"> & {
103
- create: () => string & import("effect/Brand").Brand<"PtyID">;
104
- ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
105
- };
106
- readonly title: Schema.String;
107
- readonly command: Schema.String;
108
- readonly args: Schema.$Array<Schema.String>;
109
- readonly cwd: Schema.String;
110
- readonly status: Schema.Literals<readonly ["running", "exited"]>;
111
- readonly pid: Schema.Int;
112
- readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
113
- }>;
114
- }>>, HttpApiEndpoint.Json<typeof PtyNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"pty.remove", "DELETE", "/api/pty/:ptyID", HttpApiEndpoint.StringTree<Schema.Struct<{
115
- ptyID: Schema.brand<Schema.String, "PtyID"> & {
116
- create: () => string & import("effect/Brand").Brand<"PtyID">;
117
- ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
118
- };
119
- }>>, HttpApiEndpoint.StringTree<Schema.Struct<{
120
- readonly location: Schema.optional<Schema.Struct<{
121
- readonly directory: Schema.optional<Schema.String>;
122
- readonly workspace: Schema.optional<Schema.String>;
123
- }>>;
124
- }>>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<HttpApiSchema.NoContent>, HttpApiEndpoint.Json<typeof PtyNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"pty.connectToken", "POST", "/api/pty/:ptyID/connect-token", HttpApiEndpoint.StringTree<Schema.Struct<{
125
- ptyID: Schema.brand<Schema.String, "PtyID"> & {
126
- create: () => string & import("effect/Brand").Brand<"PtyID">;
127
- ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
128
- };
129
- }>>, HttpApiEndpoint.StringTree<Schema.Struct<{
130
- readonly location: Schema.optional<Schema.Struct<{
131
- readonly directory: Schema.optional<Schema.String>;
132
- readonly workspace: Schema.optional<Schema.String>;
133
- }>>;
134
- }>>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
135
- readonly location: typeof Location.Info;
136
- readonly data: Schema.Struct<{
137
- readonly ticket: Schema.String;
138
- readonly expires_in: Schema.Int;
139
- }>;
140
- }>>, HttpApiEndpoint.Json<typeof ForbiddenError | typeof PtyNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"pty.connect", "GET", "/api/pty/:ptyID/connect", HttpApiEndpoint.StringTree<Schema.Struct<{
141
- ptyID: Schema.brand<Schema.String, "PtyID"> & {
142
- create: () => string & import("effect/Brand").Brand<"PtyID">;
143
- ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
144
- };
145
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Boolean>, HttpApiEndpoint.Json<typeof ForbiddenError | typeof PtyNotFoundError>, never, never>, false>;
@@ -1,111 +0,0 @@
1
- import { Pty } from "@opencode-ai/schema/pty";
2
- import { PtyTicket } from "@opencode-ai/schema/pty-ticket";
3
- import { Location } from "@opencode-ai/schema/location";
4
- import { Schema } from "effect";
5
- import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
6
- import { ForbiddenError, PtyNotFoundError } from "../errors.js";
7
- import { LocationQuery, locationQueryOpenApi } from "./location.js";
8
- export const PTY_CONNECT_TICKET_QUERY = "ticket";
9
- export const PTY_CONNECT_TOKEN_HEADER = "x-opencode-ticket";
10
- export const PTY_CONNECT_TOKEN_HEADER_VALUE = "1";
11
- const PTY_CONNECT_PATH = /^\/api\/pty\/[^/]+\/connect$/;
12
- // Authorization middleware skips credential checks when this matches; the PTY connect handler
13
- // is then responsible for consuming and validating the ticket.
14
- export function hasPtyConnectTicketURL(url) {
15
- return PTY_CONNECT_PATH.test(url.pathname) && !!url.searchParams.get(PTY_CONNECT_TICKET_QUERY);
16
- }
17
- export const PtyGroup = HttpApiGroup.make("server.pty")
18
- .add(HttpApiEndpoint.get("pty.list", "/api/pty", {
19
- query: LocationQuery,
20
- success: Location.response(Schema.Array(Pty.Info)),
21
- })
22
- .annotateMerge(locationQueryOpenApi)
23
- .annotateMerge(OpenApi.annotations({
24
- identifier: "v2.pty.list",
25
- summary: "List PTY sessions",
26
- description: "List PTY sessions for a location, including exited sessions retained until removal.",
27
- })))
28
- .add(HttpApiEndpoint.post("pty.create", "/api/pty", {
29
- query: LocationQuery,
30
- payload: Pty.CreateInput,
31
- success: Location.response(Pty.Info),
32
- })
33
- .annotateMerge(locationQueryOpenApi)
34
- .annotateMerge(OpenApi.annotations({
35
- identifier: "v2.pty.create",
36
- summary: "Create PTY session",
37
- description: "Create a pseudo-terminal session for a location.",
38
- })))
39
- .add(HttpApiEndpoint.get("pty.get", "/api/pty/:ptyID", {
40
- params: { ptyID: Pty.ID },
41
- query: LocationQuery,
42
- success: Location.response(Pty.Info),
43
- error: PtyNotFoundError,
44
- })
45
- .annotateMerge(locationQueryOpenApi)
46
- .annotateMerge(OpenApi.annotations({
47
- identifier: "v2.pty.get",
48
- summary: "Get PTY session",
49
- description: "Get one PTY session, including its exit code once exited.",
50
- })))
51
- .add(HttpApiEndpoint.put("pty.update", "/api/pty/:ptyID", {
52
- params: { ptyID: Pty.ID },
53
- query: LocationQuery,
54
- payload: Pty.UpdateInput,
55
- success: Location.response(Pty.Info),
56
- error: PtyNotFoundError,
57
- })
58
- .annotateMerge(locationQueryOpenApi)
59
- .annotateMerge(OpenApi.annotations({
60
- identifier: "v2.pty.update",
61
- summary: "Update PTY session",
62
- description: "Update the title or viewport size of one PTY session.",
63
- })))
64
- .add(HttpApiEndpoint.delete("pty.remove", "/api/pty/:ptyID", {
65
- params: { ptyID: Pty.ID },
66
- query: LocationQuery,
67
- success: HttpApiSchema.NoContent,
68
- error: PtyNotFoundError,
69
- })
70
- .annotateMerge(locationQueryOpenApi)
71
- .annotateMerge(OpenApi.annotations({
72
- identifier: "v2.pty.remove",
73
- summary: "Remove PTY session",
74
- description: "Terminate and remove one PTY session.",
75
- })))
76
- .add(HttpApiEndpoint.post("pty.connectToken", "/api/pty/:ptyID/connect-token", {
77
- params: { ptyID: Pty.ID },
78
- query: LocationQuery,
79
- success: Location.response(PtyTicket.ConnectToken),
80
- error: [ForbiddenError, PtyNotFoundError],
81
- })
82
- .annotateMerge(locationQueryOpenApi)
83
- .annotateMerge(OpenApi.annotations({
84
- identifier: "v2.pty.connectToken",
85
- summary: "Create PTY WebSocket token",
86
- description: "Create a short-lived single-use ticket for opening a PTY WebSocket connection.",
87
- })))
88
- .add(
89
- // Query fields are decoded in the raw handler after the existence check so a missing
90
- // session responds with an empty 404 before any upgrade work.
91
- HttpApiEndpoint.get("pty.connect", "/api/pty/:ptyID/connect", {
92
- params: { ptyID: Pty.ID },
93
- success: Schema.Boolean,
94
- error: [ForbiddenError, PtyNotFoundError],
95
- }).annotateMerge(OpenApi.annotations({
96
- identifier: "v2.pty.connect",
97
- summary: "Connect to PTY session",
98
- description: "Establish a WebSocket connection streaming PTY output and accepting terminal input.",
99
- transform: (operation) => ({
100
- ...operation,
101
- parameters: [
102
- ...(operation.parameters ?? []),
103
- ...["location[directory]", "location[workspace]", "cursor", PTY_CONNECT_TICKET_QUERY].map((name) => ({
104
- in: "query",
105
- name,
106
- schema: { type: "string" },
107
- })),
108
- ],
109
- }),
110
- })))
111
- .annotateMerge(OpenApi.annotations({ title: "pty", description: "Experimental location-scoped PTY routes." }));