summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/utils
diff options
context:
space:
mode:
authorBrendan Allan <[email protected]>2026-03-12 16:10:52 +0800
committerGitHub <[email protected]>2026-03-12 08:10:52 +0000
commitb76ead3fe80a6159fdbfcc9b82c7c6318be68e7f (patch)
treebad16ba8185403eb9dc97b6c996bbfa78ae7918b /packages/app/src/utils
parent51835ecf90e23b34957f4dde843bbba1134f17fe (diff)
downloadopencode-b76ead3fe80a6159fdbfcc9b82c7c6318be68e7f.tar.gz
opencode-b76ead3fe80a6159fdbfcc9b82c7c6318be68e7f.zip
refactor(desktop): rework default server initialization and connection handling (#16965)
Diffstat (limited to 'packages/app/src/utils')
-rw-r--r--packages/app/src/utils/server-health.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/app/src/utils/server-health.ts b/packages/app/src/utils/server-health.ts
index db4aa89bd..45a323c7b 100644
--- a/packages/app/src/utils/server-health.ts
+++ b/packages/app/src/utils/server-health.ts
@@ -1,3 +1,4 @@
+import { usePlatform } from "@/context/platform"
import type { ServerConnection } from "@/context/server"
import { createSdkForServer } from "./server"
@@ -81,3 +82,10 @@ export async function checkServerHealth(
.catch((error) => next(count, error))
return attempt(0).finally(() => timeout?.clear?.())
}
+
+export function useCheckServerHealth() {
+ const platform = usePlatform()
+ const fetcher = platform.fetch ?? globalThis.fetch
+
+ return (http: ServerConnection.HttpBase) => checkServerHealth(http, fetcher)
+}