@radheim/protocol 0.0.0-stage → 2.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +60 -0
- package/dist/api.js +81 -0
- package/dist/client.d.ts +69 -0
- package/dist/client.js +102 -0
- package/dist/errors.d.ts +273 -0
- package/dist/errors.js +227 -0
- package/dist/groups/agent.d.ts +299 -0
- package/dist/groups/agent.js +30 -0
- package/dist/groups/artifact.d.ts +173 -0
- package/dist/groups/artifact.js +80 -0
- package/dist/groups/automation.d.ts +480 -0
- package/dist/groups/automation.js +55 -0
- package/dist/groups/blob.d.ts +415 -0
- package/dist/groups/blob.js +79 -0
- package/dist/groups/command.d.ts +15 -0
- package/dist/groups/command.js +20 -0
- package/dist/groups/config.d.ts +27 -0
- package/dist/groups/config.js +32 -0
- package/dist/groups/credential.d.ts +93 -0
- package/dist/groups/credential.js +50 -0
- package/dist/groups/debug.d.ts +22 -0
- package/dist/groups/debug.js +49 -0
- package/dist/groups/event.d.ts +16442 -0
- package/dist/groups/event.js +68 -0
- package/dist/groups/experimental/browser-tunnel.d.ts +20 -0
- package/dist/groups/experimental/browser-tunnel.js +29 -0
- package/dist/groups/experimental.d.ts +1519 -0
- package/dist/groups/experimental.js +12 -0
- package/dist/groups/flag.d.ts +12 -0
- package/dist/groups/flag.js +19 -0
- package/dist/groups/form.d.ts +138 -0
- package/dist/groups/form.js +18 -0
- package/dist/groups/fs.d.ts +60 -0
- package/dist/groups/fs.js +101 -0
- package/dist/groups/generate.d.ts +397 -0
- package/dist/groups/generate.js +77 -0
- package/dist/groups/integration.d.ts +1724 -0
- package/dist/groups/integration.js +169 -0
- package/dist/groups/job.d.ts +95 -0
- package/dist/groups/job.js +45 -0
- package/dist/groups/location.d.ts +23 -0
- package/dist/groups/location.js +47 -0
- package/dist/groups/machine.d.ts +91 -0
- package/dist/groups/machine.js +61 -0
- package/dist/groups/mcp.d.ts +104 -0
- package/dist/groups/mcp.js +125 -0
- package/dist/groups/media.d.ts +8 -0
- package/dist/groups/media.js +18 -0
- package/dist/groups/message.d.ts +3696 -0
- package/dist/groups/message.js +102 -0
- package/dist/groups/migration.d.ts +28 -0
- package/dist/groups/migration.js +21 -0
- package/dist/groups/model.d.ts +536 -0
- package/dist/groups/model.js +39 -0
- package/dist/groups/permission.d.ts +175 -0
- package/dist/groups/permission.js +115 -0
- package/dist/groups/persistent-pty.d.ts +251 -0
- package/dist/groups/persistent-pty.js +109 -0
- package/dist/groups/plugin.d.ts +102 -0
- package/dist/groups/plugin.js +59 -0
- package/dist/groups/project.d.ts +83 -0
- package/dist/groups/project.js +37 -0
- package/dist/groups/provider.d.ts +354 -0
- package/dist/groups/provider.js +34 -0
- package/dist/groups/pty.d.ts +151 -0
- package/dist/groups/pty.js +117 -0
- package/dist/groups/push.d.ts +123 -0
- package/dist/groups/push.js +60 -0
- package/dist/groups/reference.d.ts +25 -0
- package/dist/groups/reference.js +33 -0
- package/dist/groups/rpc.d.ts +21 -0
- package/dist/groups/rpc.js +24 -0
- package/dist/groups/server.d.ts +46 -0
- package/dist/groups/server.js +55 -0
- package/dist/groups/session.d.ts +11874 -0
- package/dist/groups/session.js +663 -0
- package/dist/groups/shell.d.ts +125 -0
- package/dist/groups/shell.js +65 -0
- package/dist/groups/skill.d.ts +26 -0
- package/dist/groups/skill.js +34 -0
- package/dist/groups/space.d.ts +56 -0
- package/dist/groups/space.js +59 -0
- package/dist/groups/usage.d.ts +96 -0
- package/dist/groups/usage.js +22 -0
- package/dist/groups/vcs.d.ts +89 -0
- package/dist/groups/vcs.js +94 -0
- package/dist/groups/voice.d.ts +81 -0
- package/dist/groups/voice.js +75 -0
- package/dist/groups/websearch.d.ts +29 -0
- package/dist/groups/websearch.js +34 -0
- package/dist/groups/worktree.d.ts +41 -0
- package/dist/groups/worktree.js +52 -0
- package/dist/middleware/authorization.d.ts +13 -0
- package/dist/middleware/authorization.js +6 -0
- package/dist/middleware/schema-error.d.ts +13 -0
- package/dist/middleware/schema-error.js +4 -0
- package/dist/simulation/image.d.ts +35 -0
- package/dist/simulation/image.js +21 -0
- package/dist/simulation/terminal.d.ts +81 -0
- package/dist/simulation/terminal.js +49 -0
- package/dist/simulation.d.ts +1784 -0
- package/dist/simulation.js +485 -0
- package/package.json +46 -4
- package/README.md +0 -3
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { Integration } from "@radheim/schema/integration";
|
|
2
|
+
import { Location } from "@radheim/schema/location";
|
|
3
|
+
import { Form } from "@radheim/schema/form";
|
|
4
|
+
import { Schema } from "effect";
|
|
5
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
|
|
6
|
+
import { IntegrationAttemptNotFoundError, IntegrationMethodNotFoundError, IntegrationNotFoundError, InvalidRequestError, } from "../errors.js";
|
|
7
|
+
import { LocationQuery, locationQueryOpenApi } from "./location.js";
|
|
8
|
+
export const IntegrationGroup = HttpApiGroup.make("server.integration")
|
|
9
|
+
.add(HttpApiEndpoint.get("integration.list", "/api/integration", {
|
|
10
|
+
query: LocationQuery,
|
|
11
|
+
success: Location.response(Schema.Array(Integration.Info)),
|
|
12
|
+
})
|
|
13
|
+
.annotateMerge(locationQueryOpenApi)
|
|
14
|
+
.annotateMerge(OpenApi.annotations({
|
|
15
|
+
identifier: "integration.list",
|
|
16
|
+
summary: "List integrations",
|
|
17
|
+
description: "Retrieve available integrations and their authentication methods.",
|
|
18
|
+
})))
|
|
19
|
+
.add(HttpApiEndpoint.get("integration.get", "/api/integration/:integrationID", {
|
|
20
|
+
params: { integrationID: Integration.ID },
|
|
21
|
+
query: LocationQuery,
|
|
22
|
+
success: Location.response(Integration.Info),
|
|
23
|
+
error: IntegrationNotFoundError,
|
|
24
|
+
})
|
|
25
|
+
.annotateMerge(locationQueryOpenApi)
|
|
26
|
+
.annotateMerge(OpenApi.annotations({
|
|
27
|
+
identifier: "integration.get",
|
|
28
|
+
summary: "Get integration",
|
|
29
|
+
description: "Retrieve one integration and its authentication methods.",
|
|
30
|
+
})))
|
|
31
|
+
.add(HttpApiEndpoint.post("integration.wellknown.add", "/api/experimental/integration/wellknown", {
|
|
32
|
+
query: LocationQuery,
|
|
33
|
+
payload: Schema.Struct({ url: Schema.String }),
|
|
34
|
+
success: HttpApiSchema.NoContent,
|
|
35
|
+
error: InvalidRequestError,
|
|
36
|
+
})
|
|
37
|
+
.annotateMerge(locationQueryOpenApi)
|
|
38
|
+
.annotateMerge(OpenApi.annotations({
|
|
39
|
+
identifier: "experimental.integration.wellknown.add",
|
|
40
|
+
summary: "Add wellknown integration",
|
|
41
|
+
description: "Discover and persist an experimental wellknown integration source.",
|
|
42
|
+
})))
|
|
43
|
+
.add(HttpApiEndpoint.post("integration.connect.key", "/api/integration/:integrationID/connect/key", {
|
|
44
|
+
params: { integrationID: Integration.ID },
|
|
45
|
+
query: LocationQuery,
|
|
46
|
+
payload: Schema.Struct({
|
|
47
|
+
key: Schema.String,
|
|
48
|
+
answer: Schema.optional(Form.Answer),
|
|
49
|
+
label: Schema.optional(Schema.String),
|
|
50
|
+
}),
|
|
51
|
+
success: HttpApiSchema.NoContent,
|
|
52
|
+
error: [IntegrationNotFoundError, InvalidRequestError],
|
|
53
|
+
})
|
|
54
|
+
.annotateMerge(locationQueryOpenApi)
|
|
55
|
+
.annotateMerge(OpenApi.annotations({
|
|
56
|
+
identifier: "integration.connect.key",
|
|
57
|
+
summary: "Connect with key",
|
|
58
|
+
description: "Run a key authentication method and store the resulting credential.",
|
|
59
|
+
})))
|
|
60
|
+
.add(HttpApiEndpoint.post("integration.connect.external", "/api/integration/:integrationID/connect/external", {
|
|
61
|
+
params: { integrationID: Integration.ID },
|
|
62
|
+
query: LocationQuery,
|
|
63
|
+
payload: Schema.Struct({
|
|
64
|
+
methodID: Integration.MethodID,
|
|
65
|
+
answer: Schema.optional(Form.Answer),
|
|
66
|
+
label: Schema.optional(Schema.String),
|
|
67
|
+
}),
|
|
68
|
+
success: HttpApiSchema.NoContent,
|
|
69
|
+
error: [IntegrationNotFoundError, InvalidRequestError],
|
|
70
|
+
})
|
|
71
|
+
.annotateMerge(locationQueryOpenApi)
|
|
72
|
+
.annotateMerge(OpenApi.annotations({
|
|
73
|
+
identifier: "integration.connect.external",
|
|
74
|
+
summary: "Connect with external credentials",
|
|
75
|
+
description: "Run an external authentication method and store a reference to its credential source.",
|
|
76
|
+
})))
|
|
77
|
+
.add(HttpApiEndpoint.post("integration.oauth.connect", "/api/integration/:integrationID/connect/oauth", {
|
|
78
|
+
params: { integrationID: Integration.ID },
|
|
79
|
+
query: LocationQuery,
|
|
80
|
+
payload: Schema.Struct({
|
|
81
|
+
methodID: Integration.MethodID,
|
|
82
|
+
answer: Schema.optional(Form.Answer),
|
|
83
|
+
label: Schema.optional(Schema.String),
|
|
84
|
+
}),
|
|
85
|
+
success: Location.response(Integration.Attempt),
|
|
86
|
+
error: InvalidRequestError,
|
|
87
|
+
})
|
|
88
|
+
.annotateMerge(locationQueryOpenApi)
|
|
89
|
+
.annotateMerge(OpenApi.annotations({
|
|
90
|
+
identifier: "integration.oauth.connect",
|
|
91
|
+
summary: "Begin OAuth connection",
|
|
92
|
+
description: "Start an OAuth attempt and return the authorization details.",
|
|
93
|
+
})))
|
|
94
|
+
.add(HttpApiEndpoint.get("integration.oauth.status", "/api/integration/:integrationID/connect/oauth/:attemptID", {
|
|
95
|
+
params: { integrationID: Integration.ID, attemptID: Integration.AttemptID },
|
|
96
|
+
query: LocationQuery,
|
|
97
|
+
success: Location.response(Integration.AttemptStatus),
|
|
98
|
+
error: [IntegrationNotFoundError, IntegrationAttemptNotFoundError],
|
|
99
|
+
})
|
|
100
|
+
.annotateMerge(locationQueryOpenApi)
|
|
101
|
+
.annotateMerge(OpenApi.annotations({
|
|
102
|
+
identifier: "integration.oauth.status",
|
|
103
|
+
summary: "Get OAuth attempt status",
|
|
104
|
+
description: "Poll the current status of an OAuth attempt.",
|
|
105
|
+
})))
|
|
106
|
+
.add(HttpApiEndpoint.post("integration.oauth.complete", "/api/integration/:integrationID/connect/oauth/:attemptID/complete", {
|
|
107
|
+
params: { integrationID: Integration.ID, attemptID: Integration.AttemptID },
|
|
108
|
+
query: LocationQuery,
|
|
109
|
+
payload: Schema.Struct({ code: Schema.optional(Schema.String) }),
|
|
110
|
+
success: HttpApiSchema.NoContent,
|
|
111
|
+
error: [IntegrationNotFoundError, IntegrationAttemptNotFoundError, InvalidRequestError],
|
|
112
|
+
})
|
|
113
|
+
.annotateMerge(locationQueryOpenApi)
|
|
114
|
+
.annotateMerge(OpenApi.annotations({
|
|
115
|
+
identifier: "integration.oauth.complete",
|
|
116
|
+
summary: "Complete OAuth connection",
|
|
117
|
+
description: "Complete a code-based OAuth attempt and store the resulting credential. For an automatic attempt with `paste`, `code` is the redirect URL copied from the browser, and the result arrives through the attempt status.",
|
|
118
|
+
})))
|
|
119
|
+
.add(HttpApiEndpoint.delete("integration.oauth.cancel", "/api/integration/:integrationID/connect/oauth/:attemptID", {
|
|
120
|
+
params: { integrationID: Integration.ID, attemptID: Integration.AttemptID },
|
|
121
|
+
query: LocationQuery,
|
|
122
|
+
success: HttpApiSchema.NoContent,
|
|
123
|
+
})
|
|
124
|
+
.annotateMerge(locationQueryOpenApi)
|
|
125
|
+
.annotateMerge(OpenApi.annotations({
|
|
126
|
+
identifier: "integration.oauth.cancel",
|
|
127
|
+
summary: "Cancel OAuth connection",
|
|
128
|
+
description: "Cancel an OAuth attempt and release its resources.",
|
|
129
|
+
})))
|
|
130
|
+
.add(HttpApiEndpoint.post("integration.command.connect", "/api/integration/:integrationID/connect/command", {
|
|
131
|
+
params: { integrationID: Integration.ID },
|
|
132
|
+
query: LocationQuery,
|
|
133
|
+
payload: Schema.Struct({
|
|
134
|
+
methodID: Integration.MethodID,
|
|
135
|
+
label: Schema.optional(Schema.String),
|
|
136
|
+
}),
|
|
137
|
+
success: Location.response(Integration.CommandAttempt),
|
|
138
|
+
error: [IntegrationNotFoundError, IntegrationMethodNotFoundError, InvalidRequestError],
|
|
139
|
+
})
|
|
140
|
+
.annotateMerge(locationQueryOpenApi)
|
|
141
|
+
.annotateMerge(OpenApi.annotations({
|
|
142
|
+
identifier: "integration.command.connect",
|
|
143
|
+
summary: "Begin command connection",
|
|
144
|
+
description: "Start a command authentication attempt.",
|
|
145
|
+
})))
|
|
146
|
+
.add(HttpApiEndpoint.get("integration.command.status", "/api/integration/:integrationID/connect/command/:attemptID", {
|
|
147
|
+
params: { integrationID: Integration.ID, attemptID: Integration.AttemptID },
|
|
148
|
+
query: LocationQuery,
|
|
149
|
+
success: Location.response(Integration.CommandAttemptStatus),
|
|
150
|
+
error: [IntegrationNotFoundError, IntegrationAttemptNotFoundError],
|
|
151
|
+
})
|
|
152
|
+
.annotateMerge(locationQueryOpenApi)
|
|
153
|
+
.annotateMerge(OpenApi.annotations({
|
|
154
|
+
identifier: "integration.command.status",
|
|
155
|
+
summary: "Get command attempt status",
|
|
156
|
+
description: "Poll the current status and output of a command authentication attempt.",
|
|
157
|
+
})))
|
|
158
|
+
.add(HttpApiEndpoint.delete("integration.command.cancel", "/api/integration/:integrationID/connect/command/:attemptID", {
|
|
159
|
+
params: { integrationID: Integration.ID, attemptID: Integration.AttemptID },
|
|
160
|
+
query: LocationQuery,
|
|
161
|
+
success: HttpApiSchema.NoContent,
|
|
162
|
+
})
|
|
163
|
+
.annotateMerge(locationQueryOpenApi)
|
|
164
|
+
.annotateMerge(OpenApi.annotations({
|
|
165
|
+
identifier: "integration.command.cancel",
|
|
166
|
+
summary: "Cancel command connection",
|
|
167
|
+
description: "Cancel a command authentication attempt and terminate its process.",
|
|
168
|
+
})))
|
|
169
|
+
.annotateMerge(OpenApi.annotations({ title: "integration", description: "Integration discovery and authentication routes." }));
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiSchema } from "effect/http-api";
|
|
3
|
+
import { InvalidRequestError, SessionNotFoundError } from "../errors.js";
|
|
4
|
+
export declare const ListQuery: Schema.Struct<{
|
|
5
|
+
readonly sessionID: Schema.optional<Schema.brand<Schema.String, "SessionID"> & {
|
|
6
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
7
|
+
}>;
|
|
8
|
+
readonly kind: Schema.optional<Schema.Literals<readonly ["shell", "subagent", "image", "video", "codemode"]>>;
|
|
9
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>>;
|
|
10
|
+
readonly descendants: Schema.optional<Schema.decodeTo<Schema.Boolean, Schema.Literals<readonly ["true", "false"]>, never, never>>;
|
|
11
|
+
}>;
|
|
12
|
+
export type ListQuery = typeof ListQuery.Type;
|
|
13
|
+
/** Lives in the `server.experimental` group (see `groups/experimental.ts`). */
|
|
14
|
+
export declare const JobEndpoints: readonly [HttpApiEndpoint.HttpApiEndpoint<"job.list", "GET", "/api/experimental/job", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
15
|
+
readonly sessionID: Schema.optional<Schema.brand<Schema.String, "SessionID"> & {
|
|
16
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
17
|
+
}>;
|
|
18
|
+
readonly kind: Schema.optional<Schema.Literals<readonly ["shell", "subagent", "image", "video", "codemode"]>>;
|
|
19
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>>;
|
|
20
|
+
readonly descendants: Schema.optional<Schema.decodeTo<Schema.Boolean, Schema.Literals<readonly ["true", "false"]>, never, never>>;
|
|
21
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
22
|
+
readonly data: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
23
|
+
readonly id: Schema.String;
|
|
24
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
25
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
26
|
+
};
|
|
27
|
+
readonly status: Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
28
|
+
readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
29
|
+
readonly time: Schema.Struct<{
|
|
30
|
+
readonly started: Schema.Finite;
|
|
31
|
+
readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
32
|
+
}>;
|
|
33
|
+
readonly kind: Schema.tag<"shell">;
|
|
34
|
+
readonly shellID: Schema.String;
|
|
35
|
+
readonly command: Schema.String;
|
|
36
|
+
}>, Schema.Struct<{
|
|
37
|
+
readonly id: Schema.String;
|
|
38
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
39
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
40
|
+
};
|
|
41
|
+
readonly status: Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
42
|
+
readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
43
|
+
readonly time: Schema.Struct<{
|
|
44
|
+
readonly started: Schema.Finite;
|
|
45
|
+
readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
46
|
+
}>;
|
|
47
|
+
readonly kind: Schema.tag<"subagent">;
|
|
48
|
+
readonly childSessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
49
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
50
|
+
};
|
|
51
|
+
readonly agent: Schema.String;
|
|
52
|
+
readonly description: Schema.String;
|
|
53
|
+
}>, Schema.Struct<{
|
|
54
|
+
readonly id: Schema.String;
|
|
55
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
56
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
57
|
+
};
|
|
58
|
+
readonly status: Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
59
|
+
readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
60
|
+
readonly time: Schema.Struct<{
|
|
61
|
+
readonly started: Schema.Finite;
|
|
62
|
+
readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
63
|
+
}>;
|
|
64
|
+
readonly kind: Schema.tag<"image">;
|
|
65
|
+
readonly path: Schema.String;
|
|
66
|
+
readonly model: Schema.String;
|
|
67
|
+
}>, Schema.Struct<{
|
|
68
|
+
readonly id: Schema.String;
|
|
69
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
70
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
71
|
+
};
|
|
72
|
+
readonly status: Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
73
|
+
readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
74
|
+
readonly time: Schema.Struct<{
|
|
75
|
+
readonly started: Schema.Finite;
|
|
76
|
+
readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
77
|
+
}>;
|
|
78
|
+
readonly kind: Schema.tag<"video">;
|
|
79
|
+
readonly path: Schema.String;
|
|
80
|
+
}>, Schema.Struct<{
|
|
81
|
+
readonly id: Schema.String;
|
|
82
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
83
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
84
|
+
};
|
|
85
|
+
readonly status: Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
86
|
+
readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
87
|
+
readonly time: Schema.Struct<{
|
|
88
|
+
readonly started: Schema.Finite;
|
|
89
|
+
readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
90
|
+
}>;
|
|
91
|
+
readonly kind: Schema.tag<"codemode">;
|
|
92
|
+
}>]>>;
|
|
93
|
+
}>>, Schema.toCodecJson<typeof InvalidRequestError | typeof SessionNotFoundError>, never, never>, HttpApiEndpoint.HttpApiEndpoint<"job.cancel", "POST", "/api/experimental/job/:id/cancel", Schema.toCodecStringTree<Schema.Struct<{
|
|
94
|
+
id: Schema.String;
|
|
95
|
+
}>>, never, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, never, never, never>];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Job } from "@radheim/schema/job";
|
|
2
|
+
import { Session } from "@radheim/schema/session";
|
|
3
|
+
import { Schema, SchemaGetter } from "effect";
|
|
4
|
+
import { HttpApiEndpoint, HttpApiSchema, OpenApi } from "effect/http-api";
|
|
5
|
+
import { InvalidRequestError, SessionNotFoundError } from "../errors.js";
|
|
6
|
+
const BooleanFromString = Schema.Literals(["true", "false"]).pipe(Schema.decodeTo(Schema.Boolean, {
|
|
7
|
+
decode: SchemaGetter.transform((value) => value === "true"),
|
|
8
|
+
encode: SchemaGetter.transform((value) => (value ? "true" : "false")),
|
|
9
|
+
}));
|
|
10
|
+
export const ListQuery = Schema.Struct({
|
|
11
|
+
sessionID: Schema.optional(Session.ID).annotate({
|
|
12
|
+
description: "Filter to background jobs owned by this session.",
|
|
13
|
+
}),
|
|
14
|
+
kind: Schema.optional(Job.Kind).annotate({
|
|
15
|
+
description: "Filter by background job kind.",
|
|
16
|
+
}),
|
|
17
|
+
status: Schema.optional(Job.Status).annotate({
|
|
18
|
+
description: "Filter by job status (running, completed, error, or cancelled).",
|
|
19
|
+
}),
|
|
20
|
+
descendants: Schema.optional(BooleanFromString).annotate({
|
|
21
|
+
description: "When sessionID is set, also include background jobs owned by child and nested subagent sessions.",
|
|
22
|
+
}),
|
|
23
|
+
}).annotate({ identifier: "Job.ListQuery" });
|
|
24
|
+
/** Lives in the `server.experimental` group (see `groups/experimental.ts`). */
|
|
25
|
+
export const JobEndpoints = [
|
|
26
|
+
HttpApiEndpoint.get("job.list", "/api/experimental/job", {
|
|
27
|
+
query: ListQuery,
|
|
28
|
+
success: Schema.Struct({ data: Schema.Array(Job.Info) }),
|
|
29
|
+
error: [InvalidRequestError, SessionNotFoundError],
|
|
30
|
+
}).annotateMerge(OpenApi.annotations({
|
|
31
|
+
identifier: "experimental.job.list",
|
|
32
|
+
summary: "List background jobs",
|
|
33
|
+
description: "List active and unconsumed background jobs, optionally filtered by owning session, descendants, or kind. Experimental: may change without compatibility guarantees.",
|
|
34
|
+
transform: (operation) => ({ ...operation, tags: ["experimental"] }),
|
|
35
|
+
})),
|
|
36
|
+
HttpApiEndpoint.post("job.cancel", "/api/experimental/job/:id/cancel", {
|
|
37
|
+
params: { id: Schema.String },
|
|
38
|
+
success: HttpApiSchema.NoContent,
|
|
39
|
+
}).annotateMerge(OpenApi.annotations({
|
|
40
|
+
identifier: "experimental.job.cancel",
|
|
41
|
+
summary: "Cancel background job",
|
|
42
|
+
description: "Cancel a running background job, interrupting the work it started. Cancelling a job that already finished does nothing. Experimental: may change without compatibility guarantees.",
|
|
43
|
+
transform: (operation) => ({ ...operation, tags: ["experimental"] }),
|
|
44
|
+
})),
|
|
45
|
+
];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Context, Schema } from "effect";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema } from "effect/http-api";
|
|
3
|
+
import { ServiceUnavailableError } from "../errors.js";
|
|
4
|
+
export declare const LocationQuery: Schema.Struct<{
|
|
5
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
6
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
7
|
+
}>>;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const locationQueryOpenApi: Context.Context<never>;
|
|
10
|
+
export declare const makeLocationGroup: <LocationId extends HttpApiMiddleware.AnyId, LocationService>(locationMiddleware: Context.Key<LocationId, LocationService>) => HttpApiGroup.HttpApiGroup<"server.location", HttpApiEndpoint.HttpApiEndpoint<"location.get", "GET", "/api/location", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
11
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
12
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
13
|
+
}>>;
|
|
14
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
15
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
16
|
+
readonly project: Schema.Struct<{
|
|
17
|
+
readonly id: Schema.brand<Schema.String, "Project.ID"> & {
|
|
18
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
19
|
+
};
|
|
20
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
21
|
+
readonly canonical: Schema.brand<Schema.String, "AbsolutePath">;
|
|
22
|
+
}>;
|
|
23
|
+
}>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"location.reload", "POST", "/api/location/reload", never, never, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never>, false>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Location } from "@radheim/schema/location";
|
|
2
|
+
import { Context, Schema } from "effect";
|
|
3
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, OpenApi } from "effect/http-api";
|
|
4
|
+
import { ServiceUnavailableError } from "../errors.js";
|
|
5
|
+
export const LocationQuery = Schema.Struct({
|
|
6
|
+
location: Schema.optional(Schema.Struct({
|
|
7
|
+
directory: Schema.optional(Schema.String).annotate({ description: "Absolute path of the directory." }),
|
|
8
|
+
})).annotateKey({
|
|
9
|
+
description: "Location to run the request in, sent as location[directory]. Omit to use the server's default location.",
|
|
10
|
+
}),
|
|
11
|
+
}).annotate({ identifier: "LocationQuery" });
|
|
12
|
+
export const locationQueryOpenApi = OpenApi.annotations({
|
|
13
|
+
transform: (operation) => {
|
|
14
|
+
const parameters = operation.parameters;
|
|
15
|
+
if (!Array.isArray(parameters))
|
|
16
|
+
return operation;
|
|
17
|
+
return {
|
|
18
|
+
...operation,
|
|
19
|
+
parameters: parameters.map((parameter) => parameter?.name === "location" && parameter?.in === "query"
|
|
20
|
+
? { ...parameter, style: "deepObject", explode: true }
|
|
21
|
+
: parameter),
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
// Middleware is applied per endpoint: reload acts on every loaded location and
|
|
26
|
+
// must not boot the caller's location first.
|
|
27
|
+
export const makeLocationGroup = (locationMiddleware) => HttpApiGroup.make("server.location")
|
|
28
|
+
.add(HttpApiEndpoint.get("location.get", "/api/location", {
|
|
29
|
+
query: LocationQuery,
|
|
30
|
+
success: Location.PublicInfo,
|
|
31
|
+
})
|
|
32
|
+
.middleware(locationMiddleware)
|
|
33
|
+
.annotateMerge(locationQueryOpenApi)
|
|
34
|
+
.annotateMerge(OpenApi.annotations({
|
|
35
|
+
identifier: "location.get",
|
|
36
|
+
summary: "Get location",
|
|
37
|
+
description: "Resolve the requested location or the server default location.",
|
|
38
|
+
})))
|
|
39
|
+
.add(HttpApiEndpoint.post("location.reload", "/api/location/reload", {
|
|
40
|
+
success: HttpApiSchema.NoContent,
|
|
41
|
+
error: ServiceUnavailableError,
|
|
42
|
+
}).annotateMerge(OpenApi.annotations({
|
|
43
|
+
identifier: "location.reload",
|
|
44
|
+
summary: "Reload configuration",
|
|
45
|
+
description: "Shut down and rebuild every loaded location. Pending permissions and forms are cancelled; running sessions continue with fresh services at the next step boundary. Emits location.shutdown for client recovery and responds once all replacement builds settle.",
|
|
46
|
+
})))
|
|
47
|
+
.annotateMerge(OpenApi.annotations({ title: "location" }));
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiSchema } from "effect/http-api";
|
|
3
|
+
import { ConflictError, ForbiddenError, InvalidRequestError, MachineNotFoundError, ServiceUnavailableError } from "../errors.js";
|
|
4
|
+
export declare const MACHINE_LINK_PATH = "/api/experimental/machine/link";
|
|
5
|
+
/**
|
|
6
|
+
* Whether a request asks to become a WebSocket, the one request the machine link serves and the one the server lets in
|
|
7
|
+
* without its password: a GET with `Upgrade: websocket` and `upgrade` among its `Connection` tokens.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isWebSocketUpgrade(request: {
|
|
10
|
+
readonly method: string;
|
|
11
|
+
readonly headers: Readonly<Record<string, string | undefined>>;
|
|
12
|
+
}): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The same, for code that runs before the router has matched a route: the path is the request's own, up to its query,
|
|
15
|
+
* compared as it was sent. A URL parser would resolve `..` and a leading `//host` to this path, and the router would not.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isMachineLinkUpgrade(request: {
|
|
18
|
+
readonly method: string;
|
|
19
|
+
readonly url: string;
|
|
20
|
+
readonly headers: Readonly<Record<string, string | undefined>>;
|
|
21
|
+
}): boolean;
|
|
22
|
+
/** Lives in the `server.experimental` group (see `groups/experimental.ts`). */
|
|
23
|
+
export declare const MachineLinkEndpoint: HttpApiEndpoint.HttpApiEndpoint<"machine.link", "GET", "/api/experimental/machine/link", never, never, never, never, Schema.toCodecJson<Schema.Boolean>, never, never, never>;
|
|
24
|
+
/** Lives in the `server.experimental` group (see `groups/experimental.ts`). */
|
|
25
|
+
export declare const MachineEndpoints: readonly [HttpApiEndpoint.HttpApiEndpoint<"machine.link", "GET", "/api/experimental/machine/link", never, never, never, never, Schema.toCodecJson<Schema.Boolean>, never, never, never>, HttpApiEndpoint.HttpApiEndpoint<"machine.list", "GET", "/api/experimental/machine", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
26
|
+
readonly data: Schema.$Array<Schema.Struct<{
|
|
27
|
+
readonly id: Schema.String;
|
|
28
|
+
readonly status: Schema.Union<readonly [Schema.Struct<{
|
|
29
|
+
readonly type: Schema.Literal<"unpaired">;
|
|
30
|
+
}>, Schema.Struct<{
|
|
31
|
+
readonly type: Schema.Literal<"offline">;
|
|
32
|
+
}>, Schema.Struct<{
|
|
33
|
+
readonly type: Schema.Literal<"online">;
|
|
34
|
+
readonly os: Schema.String;
|
|
35
|
+
readonly arch: Schema.String;
|
|
36
|
+
readonly version: Schema.optionalKey<Schema.String>;
|
|
37
|
+
readonly connection: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
38
|
+
readonly type: Schema.Literal<"websocket">;
|
|
39
|
+
}>, Schema.Struct<{
|
|
40
|
+
readonly type: Schema.Literal<"iroh">;
|
|
41
|
+
readonly route: Schema.optionalKey<Schema.Struct<{
|
|
42
|
+
readonly path: Schema.Literals<readonly ["direct", "relayed"]>;
|
|
43
|
+
readonly rtt: Schema.Number;
|
|
44
|
+
}>>;
|
|
45
|
+
}>]>>;
|
|
46
|
+
}>, Schema.Struct<{
|
|
47
|
+
readonly type: Schema.Literal<"incompatible">;
|
|
48
|
+
readonly reason: Schema.Union<readonly [Schema.Struct<{
|
|
49
|
+
readonly type: Schema.Literal<"protocol-mismatch">;
|
|
50
|
+
readonly worker: Schema.Int;
|
|
51
|
+
readonly server: Schema.Int;
|
|
52
|
+
}>, Schema.Struct<{
|
|
53
|
+
readonly type: Schema.Literal<"protocol-error">;
|
|
54
|
+
}>]>;
|
|
55
|
+
}>]>;
|
|
56
|
+
}>>;
|
|
57
|
+
}>>, Schema.toCodecJson<typeof ForbiddenError>, never, never>, HttpApiEndpoint.HttpApiEndpoint<"machine.add", "POST", "/api/experimental/machine", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
58
|
+
readonly name: Schema.String;
|
|
59
|
+
readonly reach: Schema.$Array<Schema.Struct<{
|
|
60
|
+
readonly type: Schema.Literal<"url">;
|
|
61
|
+
readonly url: Schema.String;
|
|
62
|
+
}>>;
|
|
63
|
+
readonly replace: Schema.optional<Schema.Boolean>;
|
|
64
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
65
|
+
readonly data: Schema.Struct<{
|
|
66
|
+
readonly name: Schema.String;
|
|
67
|
+
readonly join: Schema.String;
|
|
68
|
+
readonly expires: Schema.Int;
|
|
69
|
+
readonly reach: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
70
|
+
readonly type: Schema.Literal<"url">;
|
|
71
|
+
readonly url: Schema.String;
|
|
72
|
+
}>, Schema.Struct<{
|
|
73
|
+
readonly type: Schema.Literal<"iroh">;
|
|
74
|
+
}>]>>;
|
|
75
|
+
}>;
|
|
76
|
+
}>>, Schema.toCodecJson<typeof InvalidRequestError | typeof ConflictError | typeof ForbiddenError | typeof MachineNotFoundError>, never, never>, HttpApiEndpoint.HttpApiEndpoint<"machine.remove", "DELETE", "/api/experimental/machine/:name", Schema.toCodecStringTree<Schema.Struct<{
|
|
77
|
+
name: Schema.String;
|
|
78
|
+
}>>, never, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof ForbiddenError | typeof MachineNotFoundError>, never, never>, HttpApiEndpoint.HttpApiEndpoint<"machine.update", "POST", "/api/experimental/machine/:name/update", Schema.toCodecStringTree<Schema.Struct<{
|
|
79
|
+
name: Schema.String;
|
|
80
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
81
|
+
readonly version: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
82
|
+
readonly mode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["drain", "force"]>>>, Schema.optionalKey<Schema.Literals<readonly ["drain", "force"]>>, never, never>;
|
|
83
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
84
|
+
readonly data: Schema.Struct<{
|
|
85
|
+
readonly machine: Schema.String;
|
|
86
|
+
readonly version: Schema.String;
|
|
87
|
+
readonly state: Schema.Literals<readonly ["downloading", "draining", "restarting", "up-to-date"]>;
|
|
88
|
+
readonly runningProcesses: Schema.optionalKey<Schema.Int>;
|
|
89
|
+
readonly activeForwards: Schema.optionalKey<Schema.Int>;
|
|
90
|
+
}>;
|
|
91
|
+
}>>, Schema.toCodecJson<typeof InvalidRequestError | typeof ConflictError | typeof ServiceUnavailableError | typeof ForbiddenError | typeof MachineNotFoundError>, never, never>];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Machine } from "@radheim/schema/machine";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { HttpApiEndpoint, HttpApiSchema, OpenApi } from "effect/http-api";
|
|
4
|
+
import { ConflictError, ForbiddenError, InvalidRequestError, MachineNotFoundError, ServiceUnavailableError, } from "../errors.js";
|
|
5
|
+
export const MACHINE_LINK_PATH = "/api/experimental/machine/link";
|
|
6
|
+
const EXPERIMENTAL = "Behind the machines flag. Experimental: may change without compatibility guarantees.";
|
|
7
|
+
const annotations = (identifier, summary, description) => OpenApi.annotations({
|
|
8
|
+
identifier: `experimental.machine.${identifier}`,
|
|
9
|
+
summary,
|
|
10
|
+
description: `${description} ${EXPERIMENTAL}`,
|
|
11
|
+
transform: (operation) => ({ ...operation, tags: ["experimental"] }),
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Whether a request asks to become a WebSocket, the one request the machine link serves and the one the server lets in
|
|
15
|
+
* without its password: a GET with `Upgrade: websocket` and `upgrade` among its `Connection` tokens.
|
|
16
|
+
*/
|
|
17
|
+
export function isWebSocketUpgrade(request) {
|
|
18
|
+
return (request.method === "GET" &&
|
|
19
|
+
request.headers.upgrade?.toLowerCase() === "websocket" &&
|
|
20
|
+
(request.headers.connection ?? "").split(",").some((token) => token.trim().toLowerCase() === "upgrade"));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The same, for code that runs before the router has matched a route: the path is the request's own, up to its query,
|
|
24
|
+
* compared as it was sent. A URL parser would resolve `..` and a leading `//host` to this path, and the router would not.
|
|
25
|
+
*/
|
|
26
|
+
export function isMachineLinkUpgrade(request) {
|
|
27
|
+
return request.url.split("?", 1)[0] === MACHINE_LINK_PATH && isWebSocketUpgrade(request);
|
|
28
|
+
}
|
|
29
|
+
/** Lives in the `server.experimental` group (see `groups/experimental.ts`). */
|
|
30
|
+
export const MachineLinkEndpoint = HttpApiEndpoint.get("machine.link", MACHINE_LINK_PATH, {
|
|
31
|
+
success: Schema.Boolean,
|
|
32
|
+
}).annotateMerge(OpenApi.annotations({
|
|
33
|
+
identifier: "experimental.machine.link",
|
|
34
|
+
summary: "Connect a machine",
|
|
35
|
+
description: "Upgrade to a WebSocket that carries a machine's link to this server: binary messages only, each at most 65,535 bytes. It takes no server password. The link's own handshake, which starts with the machine's first message, is the only way in: it admits a key this server has paired or a valid join string, and closes the socket on anything else without saying why. Behind the machines flag; without it the route does not exist. Experimental: may change without compatibility guarantees.",
|
|
36
|
+
transform: (operation) => ({ ...operation, "x-websocket": true, tags: ["experimental"] }),
|
|
37
|
+
}));
|
|
38
|
+
/** Lives in the `server.experimental` group (see `groups/experimental.ts`). */
|
|
39
|
+
export const MachineEndpoints = [
|
|
40
|
+
MachineLinkEndpoint,
|
|
41
|
+
HttpApiEndpoint.get("machine.list", "/api/experimental/machine", {
|
|
42
|
+
success: Schema.Struct({ data: Schema.Array(Machine.Info) }),
|
|
43
|
+
error: [ForbiddenError],
|
|
44
|
+
}).annotateMerge(annotations("list", "List machines", "List known machines and the status of each.")),
|
|
45
|
+
HttpApiEndpoint.post("machine.add", "/api/experimental/machine", {
|
|
46
|
+
payload: Machine.AddPayload,
|
|
47
|
+
success: Schema.Struct({ data: Machine.Invite }),
|
|
48
|
+
error: [InvalidRequestError, ForbiddenError, MachineNotFoundError, ConflictError],
|
|
49
|
+
}).annotateMerge(annotations("add", "Add or invite a machine", "Add a machine by name if it does not exist, then create a single-use join string carrying the given reach addresses.")),
|
|
50
|
+
HttpApiEndpoint.delete("machine.remove", "/api/experimental/machine/:name", {
|
|
51
|
+
params: { name: Schema.String },
|
|
52
|
+
success: HttpApiSchema.NoContent,
|
|
53
|
+
error: [ForbiddenError, MachineNotFoundError],
|
|
54
|
+
}).annotateMerge(annotations("remove", "Remove a machine", "Forget a machine by name, closing any live link and revoking its key.")),
|
|
55
|
+
HttpApiEndpoint.post("machine.update", "/api/experimental/machine/:name/update", {
|
|
56
|
+
params: { name: Schema.String },
|
|
57
|
+
payload: Machine.UpdatePayload,
|
|
58
|
+
success: Schema.Struct({ data: Machine.UpdateResult }),
|
|
59
|
+
error: [InvalidRequestError, ForbiddenError, MachineNotFoundError, ConflictError, ServiceUnavailableError],
|
|
60
|
+
}).annotateMerge(annotations("update", "Update a machine's worker", "Ask an online machine's worker to update itself to a version, fetched and verified from its own update source, and return its first answer. `drain` (the default) waits for running commands and port forwards to finish; `force` stops them. The machine lists the new version once it reconnects. An invalid version is a 400 InvalidRequestError, a worker that refuses is a 409 ConflictError, and an offline machine or one that does not answer is a 503 ServiceUnavailableError.")),
|
|
61
|
+
];
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Mcp } from "@radheim/schema/mcp";
|
|
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.add", "PUT", "/api/experimental/mcp/:server", Schema.toCodecStringTree<Schema.Struct<{
|
|
8
|
+
server: Schema.String;
|
|
9
|
+
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
10
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
11
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
12
|
+
}>>;
|
|
13
|
+
}>>, Schema.toCodecJson<Schema.Struct<{
|
|
14
|
+
readonly config: Schema.toTaggedUnion<"type", readonly [typeof Mcp.LocalConfig, typeof Mcp.RemoteConfig]>;
|
|
15
|
+
}>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"mcp.list", "GET", "/api/mcp", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
16
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
17
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
18
|
+
}>>;
|
|
19
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
20
|
+
readonly location: Schema.Struct<{
|
|
21
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
22
|
+
}>;
|
|
23
|
+
readonly data: Schema.$Array<Schema.Struct<{
|
|
24
|
+
readonly name: Schema.String;
|
|
25
|
+
readonly status: Schema.toTaggedUnion<"status", readonly [Schema.Struct<{
|
|
26
|
+
readonly status: Schema.Literal<"connected">;
|
|
27
|
+
}>, Schema.Struct<{
|
|
28
|
+
readonly status: Schema.Literal<"pending">;
|
|
29
|
+
}>, Schema.Struct<{
|
|
30
|
+
readonly status: Schema.Literal<"disabled">;
|
|
31
|
+
}>, Schema.Struct<{
|
|
32
|
+
readonly status: Schema.Literal<"failed">;
|
|
33
|
+
readonly error: Schema.String;
|
|
34
|
+
}>, Schema.Struct<{
|
|
35
|
+
readonly status: Schema.Literal<"needs_auth">;
|
|
36
|
+
readonly error: Schema.String;
|
|
37
|
+
}>]>;
|
|
38
|
+
readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
39
|
+
readonly integrationID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Integration.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Integration.ID">>, never, never>;
|
|
40
|
+
}>>;
|
|
41
|
+
}>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"mcp.resource.catalog", "GET", "/api/mcp/resource", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
42
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
43
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
44
|
+
}>>;
|
|
45
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
46
|
+
readonly location: Schema.Struct<{
|
|
47
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
48
|
+
}>;
|
|
49
|
+
readonly data: Schema.Struct<{
|
|
50
|
+
readonly resources: Schema.$Array<Schema.Struct<{
|
|
51
|
+
readonly server: Schema.String;
|
|
52
|
+
readonly name: Schema.String;
|
|
53
|
+
readonly uri: Schema.String;
|
|
54
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
55
|
+
readonly mimeType: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
56
|
+
}>>;
|
|
57
|
+
readonly templates: Schema.$Array<Schema.Struct<{
|
|
58
|
+
readonly server: Schema.String;
|
|
59
|
+
readonly name: Schema.String;
|
|
60
|
+
readonly uriTemplate: Schema.String;
|
|
61
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
62
|
+
readonly mimeType: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
63
|
+
}>>;
|
|
64
|
+
}>;
|
|
65
|
+
}>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"mcp.connect", "POST", "/api/experimental/mcp/:server/connect", Schema.toCodecStringTree<Schema.Struct<{
|
|
66
|
+
server: Schema.String;
|
|
67
|
+
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
68
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
69
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
70
|
+
}>>;
|
|
71
|
+
}>>, 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<{
|
|
72
|
+
server: Schema.String;
|
|
73
|
+
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
74
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
75
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
76
|
+
}>>;
|
|
77
|
+
}>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof McpServerNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"mcp.remove", "DELETE", "/api/experimental/mcp/:server", Schema.toCodecStringTree<Schema.Struct<{
|
|
78
|
+
server: Schema.String;
|
|
79
|
+
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
80
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
81
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
82
|
+
}>>;
|
|
83
|
+
}>>, 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<{
|
|
84
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
85
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
86
|
+
}>>;
|
|
87
|
+
readonly name: Schema.String;
|
|
88
|
+
}>>, never, Schema.toCodecStringTree<Schema.Struct<{
|
|
89
|
+
readonly "x-opencode-ticket": Schema.optional<Schema.String>;
|
|
90
|
+
}>>, Schema.toCodecJson<Schema.Struct<{
|
|
91
|
+
readonly location: Schema.Struct<{
|
|
92
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
93
|
+
}>;
|
|
94
|
+
readonly data: Schema.Struct<{
|
|
95
|
+
readonly ticket: Schema.String;
|
|
96
|
+
readonly expires_in: Schema.Int;
|
|
97
|
+
}>;
|
|
98
|
+
}>>, Schema.toCodecJson<typeof ForbiddenError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"mcp.client", "GET", "/api/experimental/client-mcp", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
99
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
100
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
101
|
+
}>>;
|
|
102
|
+
readonly name: Schema.String;
|
|
103
|
+
readonly ticket: Schema.optional<Schema.String>;
|
|
104
|
+
}>>, never, never, Schema.toCodecJson<Schema.Boolean>, Schema.toCodecJson<typeof LocationNotFoundError | typeof ForbiddenError>, never, never>, false>;
|