@opencode/protocol 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +4 -6
- package/dist/api.js +4 -8
- package/dist/client.d.ts +0 -2
- package/dist/client.js +0 -2
- package/dist/errors.d.ts +20 -0
- package/dist/errors.js +17 -0
- package/dist/groups/agent.d.ts +6 -5
- package/dist/groups/agent.js +2 -2
- package/dist/groups/command.d.ts +3 -3
- package/dist/groups/command.js +1 -1
- package/dist/groups/config.d.ts +5 -13
- package/dist/groups/config.js +11 -18
- package/dist/groups/credential.d.ts +3 -18
- package/dist/groups/credential.js +3 -10
- package/dist/groups/debug.d.ts +0 -8
- package/dist/groups/debug.js +3 -3
- package/dist/groups/event.d.ts +99 -74
- package/dist/groups/event.js +3 -3
- package/dist/groups/form.d.ts +6 -654
- package/dist/groups/form.js +6 -83
- package/dist/groups/fs.d.ts +6 -6
- package/dist/groups/fs.js +3 -3
- package/dist/groups/generate.d.ts +1 -1
- package/dist/groups/generate.js +2 -2
- package/dist/groups/integration.d.ts +27 -27
- package/dist/groups/integration.js +19 -16
- package/dist/groups/location.d.ts +10 -4
- package/dist/groups/location.js +2 -3
- package/dist/groups/mcp.d.ts +11 -13
- package/dist/groups/mcp.js +10 -10
- package/dist/groups/message.d.ts +710 -41
- package/dist/groups/message.js +26 -3
- package/dist/groups/migration.js +1 -1
- package/dist/groups/model.d.ts +12 -9
- package/dist/groups/model.js +2 -2
- package/dist/groups/permission.d.ts +9 -16
- package/dist/groups/permission.js +8 -20
- package/dist/groups/persistent-pty.js +1 -1
- package/dist/groups/plugin.d.ts +7 -12
- package/dist/groups/plugin.js +3 -13
- package/dist/groups/project.d.ts +1 -14
- package/dist/groups/project.js +2 -13
- package/dist/groups/provider.d.ts +8 -7
- package/dist/groups/provider.js +2 -2
- package/dist/groups/pty.d.ts +15 -12
- package/dist/groups/pty.js +8 -8
- package/dist/groups/reference.d.ts +8 -12
- package/dist/groups/reference.js +16 -3
- package/dist/groups/rpc.d.ts +0 -1
- package/dist/groups/rpc.js +1 -1
- package/dist/groups/server.d.ts +9 -1
- package/dist/groups/server.js +11 -5
- package/dist/groups/session.d.ts +1146 -787
- package/dist/groups/session.js +192 -93
- package/dist/groups/shell.d.ts +13 -43
- package/dist/groups/shell.js +6 -24
- package/dist/groups/skill.d.ts +4 -5
- package/dist/groups/skill.js +1 -1
- package/dist/groups/vcs.d.ts +17 -12
- package/dist/groups/vcs.js +6 -6
- package/dist/groups/websearch.d.ts +6 -5
- package/dist/groups/websearch.js +2 -2
- package/dist/groups/worktree.d.ts +17 -23
- package/dist/groups/worktree.js +21 -30
- package/package.json +2 -2
- package/dist/groups/health.d.ts +0 -15
- package/dist/groups/health.js +0 -20
- package/dist/groups/workspace.d.ts +0 -22
- package/dist/groups/workspace.js +0 -27
package/dist/groups/pty.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Location } from "@opencode/schema/location";
|
|
2
1
|
import { Schema } from "effect";
|
|
3
2
|
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
|
|
4
3
|
import { ForbiddenError, PtyNotFoundError } from "../errors.js";
|
|
@@ -9,10 +8,11 @@ export declare function hasPtyConnectTicketURL(url: URL): boolean;
|
|
|
9
8
|
export declare const PtyGroup: HttpApiGroup.HttpApiGroup<"server.pty", HttpApiEndpoint.HttpApiEndpoint<"pty.list", "GET", "/api/pty", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
10
9
|
readonly location: Schema.optional<Schema.Struct<{
|
|
11
10
|
readonly directory: Schema.optional<Schema.String>;
|
|
12
|
-
readonly workspace: Schema.optional<Schema.String>;
|
|
13
11
|
}>>;
|
|
14
12
|
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
15
|
-
readonly location:
|
|
13
|
+
readonly location: Schema.Struct<{
|
|
14
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
15
|
+
}>;
|
|
16
16
|
readonly data: Schema.$Array<Schema.Struct<{
|
|
17
17
|
readonly id: Schema.brand<Schema.String, "PtyID"> & {
|
|
18
18
|
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
@@ -29,7 +29,6 @@ export declare const PtyGroup: HttpApiGroup.HttpApiGroup<"server.pty", HttpApiEn
|
|
|
29
29
|
}>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"pty.create", "POST", "/api/pty", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
30
30
|
readonly location: Schema.optional<Schema.Struct<{
|
|
31
31
|
readonly directory: Schema.optional<Schema.String>;
|
|
32
|
-
readonly workspace: Schema.optional<Schema.String>;
|
|
33
32
|
}>>;
|
|
34
33
|
}>>, Schema.toCodecJson<Schema.Struct<{
|
|
35
34
|
readonly command: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
@@ -38,7 +37,9 @@ export declare const PtyGroup: HttpApiGroup.HttpApiGroup<"server.pty", HttpApiEn
|
|
|
38
37
|
readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
39
38
|
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
39
|
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
41
|
-
readonly location:
|
|
40
|
+
readonly location: Schema.Struct<{
|
|
41
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
42
|
+
}>;
|
|
42
43
|
readonly data: Schema.Struct<{
|
|
43
44
|
readonly id: Schema.brand<Schema.String, "PtyID"> & {
|
|
44
45
|
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
@@ -60,10 +61,11 @@ export declare const PtyGroup: HttpApiGroup.HttpApiGroup<"server.pty", HttpApiEn
|
|
|
60
61
|
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
61
62
|
readonly location: Schema.optional<Schema.Struct<{
|
|
62
63
|
readonly directory: Schema.optional<Schema.String>;
|
|
63
|
-
readonly workspace: Schema.optional<Schema.String>;
|
|
64
64
|
}>>;
|
|
65
65
|
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
66
|
-
readonly location:
|
|
66
|
+
readonly location: Schema.Struct<{
|
|
67
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
68
|
+
}>;
|
|
67
69
|
readonly data: Schema.Struct<{
|
|
68
70
|
readonly id: Schema.brand<Schema.String, "PtyID"> & {
|
|
69
71
|
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
@@ -85,7 +87,6 @@ export declare const PtyGroup: HttpApiGroup.HttpApiGroup<"server.pty", HttpApiEn
|
|
|
85
87
|
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
86
88
|
readonly location: Schema.optional<Schema.Struct<{
|
|
87
89
|
readonly directory: Schema.optional<Schema.String>;
|
|
88
|
-
readonly workspace: Schema.optional<Schema.String>;
|
|
89
90
|
}>>;
|
|
90
91
|
}>>, Schema.toCodecJson<Schema.Struct<{
|
|
91
92
|
readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
@@ -97,7 +98,9 @@ export declare const PtyGroup: HttpApiGroup.HttpApiGroup<"server.pty", HttpApiEn
|
|
|
97
98
|
readonly cols: Schema.Int;
|
|
98
99
|
}>>, never, never>;
|
|
99
100
|
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
100
|
-
readonly location:
|
|
101
|
+
readonly location: Schema.Struct<{
|
|
102
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
103
|
+
}>;
|
|
101
104
|
readonly data: Schema.Struct<{
|
|
102
105
|
readonly id: Schema.brand<Schema.String, "PtyID"> & {
|
|
103
106
|
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
@@ -119,7 +122,6 @@ export declare const PtyGroup: HttpApiGroup.HttpApiGroup<"server.pty", HttpApiEn
|
|
|
119
122
|
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
120
123
|
readonly location: Schema.optional<Schema.Struct<{
|
|
121
124
|
readonly directory: Schema.optional<Schema.String>;
|
|
122
|
-
readonly workspace: Schema.optional<Schema.String>;
|
|
123
125
|
}>>;
|
|
124
126
|
}>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof PtyNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"pty.connectToken", "POST", "/api/pty/:ptyID/connect-token", Schema.toCodecStringTree<Schema.Struct<{
|
|
125
127
|
ptyID: Schema.brand<Schema.String, "PtyID"> & {
|
|
@@ -129,12 +131,13 @@ export declare const PtyGroup: HttpApiGroup.HttpApiGroup<"server.pty", HttpApiEn
|
|
|
129
131
|
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
130
132
|
readonly location: Schema.optional<Schema.Struct<{
|
|
131
133
|
readonly directory: Schema.optional<Schema.String>;
|
|
132
|
-
readonly workspace: Schema.optional<Schema.String>;
|
|
133
134
|
}>>;
|
|
134
135
|
}>>, never, Schema.toCodecStringTree<Schema.Struct<{
|
|
135
136
|
readonly "x-opencode-ticket": Schema.optional<Schema.String>;
|
|
136
137
|
}>>, Schema.toCodecJson<Schema.Struct<{
|
|
137
|
-
readonly location:
|
|
138
|
+
readonly location: Schema.Struct<{
|
|
139
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
140
|
+
}>;
|
|
138
141
|
readonly data: Schema.Struct<{
|
|
139
142
|
readonly ticket: Schema.String;
|
|
140
143
|
readonly expires_in: Schema.Int;
|
package/dist/groups/pty.js
CHANGED
|
@@ -21,7 +21,7 @@ export const PtyGroup = HttpApiGroup.make("server.pty")
|
|
|
21
21
|
})
|
|
22
22
|
.annotateMerge(locationQueryOpenApi)
|
|
23
23
|
.annotateMerge(OpenApi.annotations({
|
|
24
|
-
identifier: "
|
|
24
|
+
identifier: "pty.list",
|
|
25
25
|
summary: "List PTY sessions",
|
|
26
26
|
description: "List PTY sessions for a location, including exited sessions retained until removal.",
|
|
27
27
|
})))
|
|
@@ -32,7 +32,7 @@ export const PtyGroup = HttpApiGroup.make("server.pty")
|
|
|
32
32
|
})
|
|
33
33
|
.annotateMerge(locationQueryOpenApi)
|
|
34
34
|
.annotateMerge(OpenApi.annotations({
|
|
35
|
-
identifier: "
|
|
35
|
+
identifier: "pty.create",
|
|
36
36
|
summary: "Create PTY session",
|
|
37
37
|
description: "Create a pseudo-terminal session for a location.",
|
|
38
38
|
})))
|
|
@@ -44,7 +44,7 @@ export const PtyGroup = HttpApiGroup.make("server.pty")
|
|
|
44
44
|
})
|
|
45
45
|
.annotateMerge(locationQueryOpenApi)
|
|
46
46
|
.annotateMerge(OpenApi.annotations({
|
|
47
|
-
identifier: "
|
|
47
|
+
identifier: "pty.get",
|
|
48
48
|
summary: "Get PTY session",
|
|
49
49
|
description: "Get one PTY session, including its exit code once exited.",
|
|
50
50
|
})))
|
|
@@ -57,7 +57,7 @@ export const PtyGroup = HttpApiGroup.make("server.pty")
|
|
|
57
57
|
})
|
|
58
58
|
.annotateMerge(locationQueryOpenApi)
|
|
59
59
|
.annotateMerge(OpenApi.annotations({
|
|
60
|
-
identifier: "
|
|
60
|
+
identifier: "pty.update",
|
|
61
61
|
summary: "Update PTY session",
|
|
62
62
|
description: "Update the title or viewport size of one PTY session.",
|
|
63
63
|
})))
|
|
@@ -69,7 +69,7 @@ export const PtyGroup = HttpApiGroup.make("server.pty")
|
|
|
69
69
|
})
|
|
70
70
|
.annotateMerge(locationQueryOpenApi)
|
|
71
71
|
.annotateMerge(OpenApi.annotations({
|
|
72
|
-
identifier: "
|
|
72
|
+
identifier: "pty.remove",
|
|
73
73
|
summary: "Remove PTY session",
|
|
74
74
|
description: "Terminate and remove one PTY session.",
|
|
75
75
|
})))
|
|
@@ -82,7 +82,7 @@ export const PtyGroup = HttpApiGroup.make("server.pty")
|
|
|
82
82
|
})
|
|
83
83
|
.annotateMerge(locationQueryOpenApi)
|
|
84
84
|
.annotateMerge(OpenApi.annotations({
|
|
85
|
-
identifier: "
|
|
85
|
+
identifier: "pty.connect.token",
|
|
86
86
|
summary: "Create PTY WebSocket token",
|
|
87
87
|
description: "Create a short-lived single-use ticket for opening a PTY WebSocket connection.",
|
|
88
88
|
})))
|
|
@@ -94,7 +94,7 @@ HttpApiEndpoint.get("pty.connect", "/api/pty/:ptyID/connect", {
|
|
|
94
94
|
success: Schema.Boolean,
|
|
95
95
|
error: [ForbiddenError, PtyNotFoundError],
|
|
96
96
|
}).annotateMerge(OpenApi.annotations({
|
|
97
|
-
identifier: "
|
|
97
|
+
identifier: "pty.connect",
|
|
98
98
|
summary: "Connect to PTY session",
|
|
99
99
|
description: "Establish a WebSocket connection streaming PTY output and accepting terminal input.",
|
|
100
100
|
transform: (operation) => ({
|
|
@@ -102,7 +102,7 @@ HttpApiEndpoint.get("pty.connect", "/api/pty/:ptyID/connect", {
|
|
|
102
102
|
"x-websocket": true,
|
|
103
103
|
parameters: [
|
|
104
104
|
...(operation.parameters ?? []),
|
|
105
|
-
...["location[directory]", "
|
|
105
|
+
...["location[directory]", "cursor", PTY_CONNECT_TICKET_QUERY].map((name) => ({
|
|
106
106
|
in: "query",
|
|
107
107
|
name,
|
|
108
108
|
schema: { type: "string" },
|
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
import { Location } from "@opencode/schema/location";
|
|
2
1
|
import { Schema } from "effect";
|
|
3
2
|
import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
4
3
|
export declare const ReferenceGroup: HttpApiGroup.HttpApiGroup<"server.reference", HttpApiEndpoint.HttpApiEndpoint<"reference.list", "GET", "/api/reference", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
5
4
|
readonly location: Schema.optional<Schema.Struct<{
|
|
6
5
|
readonly directory: Schema.optional<Schema.String>;
|
|
7
|
-
readonly workspace: Schema.optional<Schema.String>;
|
|
8
6
|
}>>;
|
|
9
7
|
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
10
|
-
readonly location:
|
|
8
|
+
readonly location: Schema.Struct<{
|
|
9
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
10
|
+
}>;
|
|
11
11
|
readonly data: Schema.$Array<Schema.Struct<{
|
|
12
|
-
readonly name: Schema.String;
|
|
13
|
-
readonly path: Schema.brand<Schema.String, "AbsolutePath">;
|
|
14
|
-
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
15
|
-
readonly hidden: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
16
12
|
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
17
13
|
readonly type: Schema.Literal<"local">;
|
|
18
14
|
readonly path: Schema.brand<Schema.String, "AbsolutePath">;
|
|
19
|
-
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
20
|
-
readonly hidden: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
21
15
|
}>, Schema.Struct<{
|
|
22
16
|
readonly type: Schema.Literal<"git">;
|
|
23
|
-
readonly repository: Schema.String;
|
|
24
17
|
readonly branch: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
25
|
-
readonly
|
|
26
|
-
readonly hidden: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
18
|
+
readonly repository: Schema.String;
|
|
27
19
|
}>]>;
|
|
20
|
+
readonly path: Schema.brand<Schema.String, "AbsolutePath">;
|
|
21
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
22
|
+
readonly name: Schema.String;
|
|
23
|
+
readonly hidden: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
28
24
|
}>>;
|
|
29
25
|
}>>, never, never, never>, false>;
|
package/dist/groups/reference.js
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
import { Location } from "@opencode/schema/location";
|
|
2
2
|
import { Reference } from "@opencode/schema/reference";
|
|
3
|
-
import { Schema } from "effect";
|
|
3
|
+
import { Schema, Struct } from "effect";
|
|
4
4
|
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
|
|
5
5
|
import { LocationQuery, locationQueryOpenApi } from "./location.js";
|
|
6
|
+
const PublicLocalSource = Schema.Struct(Struct.omit(Reference.LocalSource.fields, ["description", "hidden"])).annotate({
|
|
7
|
+
identifier: "Reference.LocalSource",
|
|
8
|
+
});
|
|
9
|
+
const PublicGitSource = Schema.Struct(Struct.omit(Reference.GitSource.fields, ["description", "hidden"])).annotate({
|
|
10
|
+
identifier: "Reference.GitSource",
|
|
11
|
+
});
|
|
12
|
+
const PublicSource = Schema.Union([PublicLocalSource, PublicGitSource])
|
|
13
|
+
.pipe(Schema.toTaggedUnion("type"))
|
|
14
|
+
.annotate({ identifier: "Reference.Source" });
|
|
15
|
+
const PublicInfo = Schema.Struct({
|
|
16
|
+
...Struct.omit(Reference.Info.fields, ["source"]),
|
|
17
|
+
source: PublicSource,
|
|
18
|
+
}).annotate({ identifier: "Reference.Info" });
|
|
6
19
|
export const ReferenceGroup = HttpApiGroup.make("server.reference")
|
|
7
20
|
.add(HttpApiEndpoint.get("reference.list", "/api/reference", {
|
|
8
21
|
query: LocationQuery,
|
|
9
|
-
success: Location.response(Schema.Array(
|
|
22
|
+
success: Location.response(Schema.Array(PublicInfo)),
|
|
10
23
|
})
|
|
11
24
|
.annotateMerge(locationQueryOpenApi)
|
|
12
25
|
.annotateMerge(OpenApi.annotations({
|
|
13
|
-
identifier: "
|
|
26
|
+
identifier: "reference.list",
|
|
14
27
|
summary: "List references",
|
|
15
28
|
description: "List references available in the requested location.",
|
|
16
29
|
})))
|
package/dist/groups/rpc.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ export declare const RpcGroup: HttpApiGroup.HttpApiGroup<"server.rpc", HttpApiEn
|
|
|
13
13
|
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
14
14
|
readonly location: Schema.optional<Schema.Struct<{
|
|
15
15
|
readonly directory: Schema.optional<Schema.String>;
|
|
16
|
-
readonly workspace: Schema.optional<Schema.String>;
|
|
17
16
|
}>>;
|
|
18
17
|
}>>, Schema.toCodecJson<Schema.Struct<{
|
|
19
18
|
readonly input: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Unknown>>, Schema.optionalKey<Schema.Unknown>, never, never>;
|
package/dist/groups/rpc.js
CHANGED
|
@@ -17,7 +17,7 @@ export const RpcGroup = HttpApiGroup.make("server.rpc")
|
|
|
17
17
|
})
|
|
18
18
|
.annotateMerge(locationQueryOpenApi)
|
|
19
19
|
.annotateMerge(OpenApi.annotations({
|
|
20
|
-
identifier: "
|
|
20
|
+
identifier: "rpc.call",
|
|
21
21
|
summary: "Call a plugin RPC",
|
|
22
22
|
description: "Dispatch a method to the currently registered RPC at the requested location.",
|
|
23
23
|
})))
|
package/dist/groups/server.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const ServerStatus: Schema.Struct<{
|
|
4
|
+
readonly version: Schema.String;
|
|
5
|
+
readonly pid: Schema.Int;
|
|
6
|
+
readonly urls: Schema.$Array<Schema.String>;
|
|
7
|
+
}>;
|
|
8
|
+
export type ServerStatus = typeof ServerStatus.Type;
|
|
9
|
+
export declare const ServerGroup: HttpApiGroup.HttpApiGroup<"server.server", HttpApiEndpoint.HttpApiEndpoint<"server.status", "GET", "/api/status", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
10
|
+
readonly version: Schema.String;
|
|
11
|
+
readonly pid: Schema.Int;
|
|
4
12
|
readonly urls: Schema.$Array<Schema.String>;
|
|
5
13
|
}>>, never, never, never>, false>;
|
package/dist/groups/server.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
|
|
3
|
+
export const ServerStatus = Schema.Struct({
|
|
4
|
+
version: Schema.String,
|
|
5
|
+
// 0 means the runtime has no OS process identity (e.g. workerd).
|
|
6
|
+
pid: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
7
|
+
urls: Schema.Array(Schema.String),
|
|
8
|
+
}).annotate({ identifier: "ServerStatus" });
|
|
3
9
|
export const ServerGroup = HttpApiGroup.make("server.server")
|
|
4
|
-
.add(HttpApiEndpoint.get("server.
|
|
5
|
-
success:
|
|
10
|
+
.add(HttpApiEndpoint.get("server.status", "/api/status", {
|
|
11
|
+
success: ServerStatus,
|
|
6
12
|
}).annotateMerge(OpenApi.annotations({
|
|
7
|
-
identifier: "
|
|
8
|
-
summary: "Get server
|
|
9
|
-
description: "Return the
|
|
13
|
+
identifier: "server.status",
|
|
14
|
+
summary: "Get server status",
|
|
15
|
+
description: "Return the server identity, connection URLs, and readiness status.",
|
|
10
16
|
})))
|
|
11
17
|
.annotateMerge(OpenApi.annotations({ title: "server" }));
|