refactor(protocol): consolidate server status

This commit is contained in:
Dax Raad
2026-09-13 16:56:01 -04:00
Unverified
parent e16c56fe8b
commit 13453f2da8
64 changed files with 310 additions and 633 deletions
+14 -67
View File
@@ -6,71 +6,19 @@
"description": "Experimental HttpApi surface for selected instance routes."
},
"paths": {
"/api/health": {
"get": {
"tags": ["health"],
"operationId": "health.get",
"parameters": [],
"security": [],
"responses": {
"200": {
"description": "ServiceHealth",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ServiceHealth"
}
}
}
},
"400": {
"description": "InvalidRequestError",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/InvalidRequestErrorEncoded"
}
}
}
},
"401": {
"description": "UnauthorizedError",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UnauthorizedErrorEncoded"
}
}
}
}
},
"description": "Report the owning server process and its application status.",
"summary": "Check server health"
}
},
"/api/server": {
"/api/status": {
"get": {
"tags": ["server"],
"operationId": "server.get",
"operationId": "server.status",
"parameters": [],
"security": [],
"responses": {
"200": {
"description": "Success",
"description": "ServerStatus",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"urls": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["urls"],
"additionalProperties": false
"$ref": "#/components/schemas/ServerStatus"
}
}
}
@@ -96,8 +44,8 @@
}
}
},
"description": "Return the URLs that can be used to connect to this server.",
"summary": "Get server information"
"description": "Return the server identity, connection URLs, and readiness status.",
"summary": "Get server status"
}
},
"/api/location": {
@@ -17959,22 +17907,24 @@
"required": ["_tag", "type", "message"],
"additionalProperties": false
},
"ServiceHealth": {
"ServerStatus": {
"type": "object",
"properties": {
"healthy": {
"type": "boolean",
"enum": [true]
},
"version": {
"type": "string"
},
"pid": {
"type": "integer",
"minimum": 0
},
"urls": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["healthy", "version", "pid"],
"required": ["version", "pid", "urls"],
"additionalProperties": false
},
"ServiceUnavailableErrorEncoded": {
@@ -20199,9 +20149,6 @@
},
"security": [],
"tags": [
{
"name": "health"
},
{
"name": "server"
},
+14 -67
View File
@@ -6,71 +6,19 @@
"description": "Experimental HttpApi surface for selected instance routes."
},
"paths": {
"/api/health": {
"get": {
"tags": ["health"],
"operationId": "health.get",
"parameters": [],
"security": [],
"responses": {
"200": {
"description": "ServiceHealth",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ServiceHealth"
}
}
}
},
"400": {
"description": "InvalidRequestError",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/InvalidRequestErrorEncoded"
}
}
}
},
"401": {
"description": "UnauthorizedError",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UnauthorizedErrorEncoded"
}
}
}
}
},
"description": "Report the owning server process and its application status.",
"summary": "Check server health"
}
},
"/api/server": {
"/api/status": {
"get": {
"tags": ["server"],
"operationId": "server.get",
"operationId": "server.status",
"parameters": [],
"security": [],
"responses": {
"200": {
"description": "Success",
"description": "ServerStatus",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"urls": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["urls"],
"additionalProperties": false
"$ref": "#/components/schemas/ServerStatus"
}
}
}
@@ -96,8 +44,8 @@
}
}
},
"description": "Return the URLs that can be used to connect to this server.",
"summary": "Get server information"
"description": "Return the server identity, connection URLs, and readiness status.",
"summary": "Get server status"
}
},
"/api/location": {
@@ -17959,22 +17907,24 @@
"required": ["_tag", "type", "message"],
"additionalProperties": false
},
"ServiceHealth": {
"ServerStatus": {
"type": "object",
"properties": {
"healthy": {
"type": "boolean",
"enum": [true]
},
"version": {
"type": "string"
},
"pid": {
"type": "integer",
"minimum": 0
},
"urls": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["healthy", "version", "pid"],
"required": ["version", "pid", "urls"],
"additionalProperties": false
},
"ServiceUnavailableErrorEncoded": {
@@ -20199,9 +20149,6 @@
},
"security": [],
"tags": [
{
"name": "health"
},
{
"name": "server"
},
@@ -134,7 +134,7 @@ const program = Effect.gen(function* () {
HttpClient.mapRequest(httpClient, (request) => HttpClientRequest.setHeaders(request, Service.headers(endpoint))),
),
)
return yield* client.health.get()
return yield* client.server.status()
})
const health = await Effect.runPromise(
@@ -156,7 +156,7 @@ const client = OpenCode.make({
headers: Service.headers(endpoint),
})
const health = await client.health.get()
const status = await client.server.status()
```
`Service.ensure()` accepts an optional registration file, version, service
@@ -30,7 +30,7 @@ export class OpenCodeDO {
async fetch() {
const opencode = await this.opencode
return Response.json(await opencode.health.get())
return Response.json(await opencode.server.status())
}
}
```
@@ -38,7 +38,7 @@ The embedded host uses the same schema values, declared errors, request options,
`@opencode/client/effect`.
```ts
const health = yield* opencode.health.get()
const status = yield* opencode.server.status()
const sessions = yield* opencode.sessions.list()
```
@@ -94,7 +94,7 @@ import { Effect } from "effect"
const program = Effect.gen(function* () {
const opencode = yield* OpenCode.Service
return yield* opencode.health.get()
return yield* opencode.server.status()
})
const health = await Effect.runPromise(program.pipe(Effect.provide(OpenCode.layer())))
+1 -1
View File
@@ -97,7 +97,7 @@ opencode serve
Check that the CLI can reach the background service after applying the settings:
```bash
opencode api get /api/health
opencode api get /api/status
```
A successful health response verifies the local client-to-service connection. Run a normal provider request to verify the
@@ -21,7 +21,7 @@ opencode service status
Verify that its API is healthy:
```bash
opencode api get /api/health
opencode api get /api/status
```
If the service is stuck or unhealthy, restart it:
@@ -117,7 +117,7 @@ On macOS and Linux, you can signal a running OpenCode process to capture diagnos
from the health endpoint:
```bash
opencode api get /api/health
opencode api get /api/status
```
Use the `pid` from the response with one of these signals: