@opencode-ai/protocol 0.0.0-next-15551 → 0.0.0-next-15555
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/groups/health.d.ts +61 -0
- package/dist/groups/health.js +40 -6
- package/package.json +2 -2
package/dist/groups/health.d.ts
CHANGED
|
@@ -1,7 +1,68 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
3
|
+
export declare namespace ServiceStatus {
|
|
4
|
+
const State: Schema.Union<readonly [Schema.Struct<{
|
|
5
|
+
readonly type: Schema.Literal<"starting">;
|
|
6
|
+
}>, Schema.Struct<{
|
|
7
|
+
readonly type: Schema.Literal<"ready">;
|
|
8
|
+
}>, Schema.Struct<{
|
|
9
|
+
readonly type: Schema.Literal<"stopping">;
|
|
10
|
+
readonly targetVersion: Schema.optional<Schema.String>;
|
|
11
|
+
}>, Schema.Struct<{
|
|
12
|
+
readonly type: Schema.Literal<"failed">;
|
|
13
|
+
readonly message: Schema.String;
|
|
14
|
+
readonly action: Schema.String;
|
|
15
|
+
}>]>;
|
|
16
|
+
type State = typeof State.Type;
|
|
17
|
+
const Health: Schema.Struct<{
|
|
18
|
+
readonly healthy: Schema.Literal<true>;
|
|
19
|
+
readonly version: Schema.String;
|
|
20
|
+
readonly pid: Schema.Int;
|
|
21
|
+
readonly instanceID: Schema.optional<Schema.String>;
|
|
22
|
+
readonly status: Schema.withDecodingDefaultKey<Schema.Union<readonly [Schema.Struct<{
|
|
23
|
+
readonly type: Schema.Literal<"starting">;
|
|
24
|
+
}>, Schema.Struct<{
|
|
25
|
+
readonly type: Schema.Literal<"ready">;
|
|
26
|
+
}>, Schema.Struct<{
|
|
27
|
+
readonly type: Schema.Literal<"stopping">;
|
|
28
|
+
readonly targetVersion: Schema.optional<Schema.String>;
|
|
29
|
+
}>, Schema.Struct<{
|
|
30
|
+
readonly type: Schema.Literal<"failed">;
|
|
31
|
+
readonly message: Schema.String;
|
|
32
|
+
readonly action: Schema.String;
|
|
33
|
+
}>]>, never>;
|
|
34
|
+
}>;
|
|
35
|
+
type Health = typeof Health.Type;
|
|
36
|
+
const StopRequest: Schema.Struct<{
|
|
37
|
+
readonly instanceID: Schema.String;
|
|
38
|
+
readonly targetVersion: Schema.optional<Schema.String>;
|
|
39
|
+
}>;
|
|
40
|
+
type StopRequest = typeof StopRequest.Type;
|
|
41
|
+
const StopResponse: Schema.Struct<{
|
|
42
|
+
readonly accepted: Schema.Boolean;
|
|
43
|
+
}>;
|
|
44
|
+
type StopResponse = typeof StopResponse.Type;
|
|
45
|
+
}
|
|
3
46
|
export declare const HealthGroup: HttpApiGroup.HttpApiGroup<"server.health", HttpApiEndpoint.HttpApiEndpoint<"health.get", "GET", "/api/health", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
4
47
|
readonly healthy: Schema.Literal<true>;
|
|
5
48
|
readonly version: Schema.String;
|
|
6
49
|
readonly pid: Schema.Int;
|
|
50
|
+
readonly instanceID: Schema.optional<Schema.String>;
|
|
51
|
+
readonly status: Schema.withDecodingDefaultKey<Schema.Union<readonly [Schema.Struct<{
|
|
52
|
+
readonly type: Schema.Literal<"starting">;
|
|
53
|
+
}>, Schema.Struct<{
|
|
54
|
+
readonly type: Schema.Literal<"ready">;
|
|
55
|
+
}>, Schema.Struct<{
|
|
56
|
+
readonly type: Schema.Literal<"stopping">;
|
|
57
|
+
readonly targetVersion: Schema.optional<Schema.String>;
|
|
58
|
+
}>, Schema.Struct<{
|
|
59
|
+
readonly type: Schema.Literal<"failed">;
|
|
60
|
+
readonly message: Schema.String;
|
|
61
|
+
readonly action: Schema.String;
|
|
62
|
+
}>]>, never>;
|
|
63
|
+
}>>, HttpApiEndpoint.Json<never>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"health.stop", "POST", "/api/service/stop", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
64
|
+
readonly instanceID: Schema.String;
|
|
65
|
+
readonly targetVersion: Schema.optional<Schema.String>;
|
|
66
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
67
|
+
readonly accepted: Schema.Boolean;
|
|
7
68
|
}>>, HttpApiEndpoint.Json<never>, never, never>, false>;
|
package/dist/groups/health.js
CHANGED
|
@@ -1,15 +1,49 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
2
|
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export var ServiceStatus;
|
|
4
|
+
(function (ServiceStatus) {
|
|
5
|
+
ServiceStatus.State = Schema.Union([
|
|
6
|
+
Schema.Struct({ type: Schema.Literal("starting") }),
|
|
7
|
+
Schema.Struct({ type: Schema.Literal("ready") }),
|
|
8
|
+
Schema.Struct({
|
|
9
|
+
type: Schema.Literal("stopping"),
|
|
10
|
+
targetVersion: Schema.String.pipe(Schema.optional),
|
|
11
|
+
}),
|
|
12
|
+
Schema.Struct({
|
|
13
|
+
type: Schema.Literal("failed"),
|
|
14
|
+
message: Schema.String,
|
|
15
|
+
action: Schema.String,
|
|
16
|
+
}),
|
|
17
|
+
]).annotate({ identifier: "ServiceStatus" });
|
|
18
|
+
ServiceStatus.Health = Schema.Struct({
|
|
6
19
|
healthy: Schema.Literal(true),
|
|
7
20
|
version: Schema.String,
|
|
8
21
|
pid: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
9
|
-
|
|
22
|
+
instanceID: Schema.String.pipe(Schema.optional),
|
|
23
|
+
status: ServiceStatus.State.pipe(Schema.withDecodingDefaultKey(Effect.succeed({ type: "ready" }))),
|
|
24
|
+
}).annotate({ identifier: "ServiceHealth" });
|
|
25
|
+
ServiceStatus.StopRequest = Schema.Struct({
|
|
26
|
+
instanceID: Schema.String,
|
|
27
|
+
targetVersion: Schema.String.pipe(Schema.optional),
|
|
28
|
+
}).annotate({ identifier: "ServiceStopRequest" });
|
|
29
|
+
ServiceStatus.StopResponse = Schema.Struct({
|
|
30
|
+
accepted: Schema.Boolean,
|
|
31
|
+
}).annotate({ identifier: "ServiceStopResponse" });
|
|
32
|
+
})(ServiceStatus || (ServiceStatus = {}));
|
|
33
|
+
export const HealthGroup = HttpApiGroup.make("server.health")
|
|
34
|
+
.add(HttpApiEndpoint.get("health.get", "/api/health", {
|
|
35
|
+
success: ServiceStatus.Health,
|
|
10
36
|
}).annotateMerge(OpenApi.annotations({
|
|
11
37
|
identifier: "v2.health.get",
|
|
12
38
|
summary: "Check server health",
|
|
13
|
-
description: "
|
|
39
|
+
description: "Report the owning server process and its application status.",
|
|
40
|
+
})))
|
|
41
|
+
.add(HttpApiEndpoint.post("health.stop", "/api/service/stop", {
|
|
42
|
+
payload: ServiceStatus.StopRequest,
|
|
43
|
+
success: ServiceStatus.StopResponse,
|
|
44
|
+
}).annotateMerge(OpenApi.annotations({
|
|
45
|
+
identifier: "v2.health.stop",
|
|
46
|
+
summary: "Stop the managed server",
|
|
47
|
+
description: "Request graceful shutdown of one exact managed server instance.",
|
|
14
48
|
})))
|
|
15
49
|
.annotateMerge(OpenApi.annotations({ title: "health" }));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@opencode-ai/protocol",
|
|
4
|
-
"version": "0.0.0-next-
|
|
4
|
+
"version": "0.0.0-next-15555",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"typecheck": "tsgo --noEmit"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@opencode-ai/schema": "0.0.0-next-
|
|
29
|
+
"@opencode-ai/schema": "0.0.0-next-15555",
|
|
30
30
|
"effect": "4.0.0-beta.83"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|