mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-29 21:19:48 +00:00
fix(desktop): better error messages on connection failure
This commit is contained in:
parent
3a54ab68d1
commit
680a63e3de
6 changed files with 97 additions and 12 deletions
|
|
@ -30,6 +30,7 @@ import type {
|
|||
FormatterStatusResponses,
|
||||
GlobalDisposeResponses,
|
||||
GlobalEventResponses,
|
||||
GlobalHealthResponses,
|
||||
InstanceDisposeResponses,
|
||||
LspStatusResponses,
|
||||
McpAddErrors,
|
||||
|
|
@ -188,6 +189,18 @@ class HeyApiRegistry<T> {
|
|||
}
|
||||
|
||||
export class Global extends HeyApiClient {
|
||||
/**
|
||||
* Get health
|
||||
*
|
||||
* Get health information about the OpenCode server.
|
||||
*/
|
||||
public health<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<GlobalHealthResponses, unknown, ThrowOnError>({
|
||||
url: "/global/health",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get global events
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1897,6 +1897,25 @@ export type WellKnownAuth = {
|
|||
|
||||
export type Auth = OAuth | ApiAuth | WellKnownAuth
|
||||
|
||||
export type GlobalHealthData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
url: "/global/health"
|
||||
}
|
||||
|
||||
export type GlobalHealthResponses = {
|
||||
/**
|
||||
* Health information
|
||||
*/
|
||||
200: {
|
||||
healthy: true
|
||||
version: string
|
||||
}
|
||||
}
|
||||
|
||||
export type GlobalHealthResponse = GlobalHealthResponses[keyof GlobalHealthResponses]
|
||||
|
||||
export type GlobalEventData = {
|
||||
body?: never
|
||||
path?: never
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue