🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@opencode-ai/protocol

Package Overview
Dependencies
Maintainers
2
Versions
364
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opencode-ai/protocol - npm Package Compare versions

Comparing version
0.0.0-next-15551
to
0.0.0-next-15555
+61
-0
dist/groups/health.d.ts
import { Schema } from "effect";
import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
export declare namespace ServiceStatus {
const State: Schema.Union<readonly [Schema.Struct<{
readonly type: Schema.Literal<"starting">;
}>, Schema.Struct<{
readonly type: Schema.Literal<"ready">;
}>, Schema.Struct<{
readonly type: Schema.Literal<"stopping">;
readonly targetVersion: Schema.optional<Schema.String>;
}>, Schema.Struct<{
readonly type: Schema.Literal<"failed">;
readonly message: Schema.String;
readonly action: Schema.String;
}>]>;
type State = typeof State.Type;
const Health: Schema.Struct<{
readonly healthy: Schema.Literal<true>;
readonly version: Schema.String;
readonly pid: Schema.Int;
readonly instanceID: Schema.optional<Schema.String>;
readonly status: Schema.withDecodingDefaultKey<Schema.Union<readonly [Schema.Struct<{
readonly type: Schema.Literal<"starting">;
}>, Schema.Struct<{
readonly type: Schema.Literal<"ready">;
}>, Schema.Struct<{
readonly type: Schema.Literal<"stopping">;
readonly targetVersion: Schema.optional<Schema.String>;
}>, Schema.Struct<{
readonly type: Schema.Literal<"failed">;
readonly message: Schema.String;
readonly action: Schema.String;
}>]>, never>;
}>;
type Health = typeof Health.Type;
const StopRequest: Schema.Struct<{
readonly instanceID: Schema.String;
readonly targetVersion: Schema.optional<Schema.String>;
}>;
type StopRequest = typeof StopRequest.Type;
const StopResponse: Schema.Struct<{
readonly accepted: Schema.Boolean;
}>;
type StopResponse = typeof StopResponse.Type;
}
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<{

@@ -7,2 +50,20 @@ readonly healthy: Schema.Literal<true>;

readonly pid: Schema.Int;
readonly instanceID: Schema.optional<Schema.String>;
readonly status: Schema.withDecodingDefaultKey<Schema.Union<readonly [Schema.Struct<{
readonly type: Schema.Literal<"starting">;
}>, Schema.Struct<{
readonly type: Schema.Literal<"ready">;
}>, Schema.Struct<{
readonly type: Schema.Literal<"stopping">;
readonly targetVersion: Schema.optional<Schema.String>;
}>, Schema.Struct<{
readonly type: Schema.Literal<"failed">;
readonly message: Schema.String;
readonly action: Schema.String;
}>]>, never>;
}>>, HttpApiEndpoint.Json<never>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"health.stop", "POST", "/api/service/stop", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
readonly instanceID: Schema.String;
readonly targetVersion: Schema.optional<Schema.String>;
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
readonly accepted: Schema.Boolean;
}>>, HttpApiEndpoint.Json<never>, never, never>, false>;
+40
-6

@@ -1,15 +0,49 @@

import { Schema } from "effect";
import { Effect, Schema } from "effect";
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
export const HealthGroup = HttpApiGroup.make("server.health")
.add(HttpApiEndpoint.get("health.get", "/api/health", {
success: Schema.Struct({
export var ServiceStatus;
(function (ServiceStatus) {
ServiceStatus.State = Schema.Union([
Schema.Struct({ type: Schema.Literal("starting") }),
Schema.Struct({ type: Schema.Literal("ready") }),
Schema.Struct({
type: Schema.Literal("stopping"),
targetVersion: Schema.String.pipe(Schema.optional),
}),
Schema.Struct({
type: Schema.Literal("failed"),
message: Schema.String,
action: Schema.String,
}),
]).annotate({ identifier: "ServiceStatus" });
ServiceStatus.Health = Schema.Struct({
healthy: Schema.Literal(true),
version: Schema.String,
pid: Schema.Int.check(Schema.isGreaterThan(0)),
}),
instanceID: Schema.String.pipe(Schema.optional),
status: ServiceStatus.State.pipe(Schema.withDecodingDefaultKey(Effect.succeed({ type: "ready" }))),
}).annotate({ identifier: "ServiceHealth" });
ServiceStatus.StopRequest = Schema.Struct({
instanceID: Schema.String,
targetVersion: Schema.String.pipe(Schema.optional),
}).annotate({ identifier: "ServiceStopRequest" });
ServiceStatus.StopResponse = Schema.Struct({
accepted: Schema.Boolean,
}).annotate({ identifier: "ServiceStopResponse" });
})(ServiceStatus || (ServiceStatus = {}));
export const HealthGroup = HttpApiGroup.make("server.health")
.add(HttpApiEndpoint.get("health.get", "/api/health", {
success: ServiceStatus.Health,
}).annotateMerge(OpenApi.annotations({
identifier: "v2.health.get",
summary: "Check server health",
description: "Check whether the API server is ready to accept requests.",
description: "Report the owning server process and its application status.",
})))
.add(HttpApiEndpoint.post("health.stop", "/api/service/stop", {
payload: ServiceStatus.StopRequest,
success: ServiceStatus.StopResponse,
}).annotateMerge(OpenApi.annotations({
identifier: "v2.health.stop",
summary: "Stop the managed server",
description: "Request graceful shutdown of one exact managed server instance.",
})))
.annotateMerge(OpenApi.annotations({ title: "health" }));
+2
-2
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/protocol",
"version": "0.0.0-next-15551",
"version": "0.0.0-next-15555",
"type": "module",

@@ -29,3 +29,3 @@ "license": "MIT",

"dependencies": {
"@opencode-ai/schema": "0.0.0-next-15551",
"@opencode-ai/schema": "0.0.0-next-15555",
"effect": "4.0.0-beta.83"

@@ -32,0 +32,0 @@ },